Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIO contest loader #14

Open
wants to merge 9 commits into
base: lio
Choose a base branch
from
Open

Conversation

PPakalns
Copy link
Member

@PPakalns PPakalns commented Dec 6, 2018

Implemented simple LIO format loader based mainly on Italy (yaml) format and taking some ideas from polygon loader. Implemented only features that are needed for lio. #12

This can be run on contest configuration file or on task configuration file.
./cmscontrib/ImportContest.py -L Lio-contest contest_dir/contest.yaml
./cmscontrib/ImportTask.py -L Lio-task contest_dir/task_dir/task.yaml

Example configuration files for a part of this year warmup contest:

name: warmup_test
description: 'Iesildīšanās kārta'
start: 2018-12-06T12:05:16+02:00
stop: 2018-12-06T19:05:16+02:00
per_user_time: 18000 # 5 * 3600
tasks:
  Palindr2:
    config: palindr/task.yaml
  Taisnst:
    config: taisnst/task.yaml
name: 'Palindr2'
title: 'Palindroms'
statements:
  - ['../Uzdevumi/Skola2019_palindr2.pdf', 'lv']
public_groups: [0, 1, 2, 8, 15]
time_limit: 0.5
memory_limit: 256
name: 'Taisnst'
title: 'Taisnstūri'
statements:
  - ['../Uzdevumi/Skola2019_taisnst2.pdf', 'lv']
time_limit: 0.7
memory_limit: 128
public_groups: [0, 1, 8, 16]
checker: ./checker/checker_jv.cpp
test_archive: ./testi/testi.zip

Some observations:
All contest, task imports of cms are intended to be run on the path that points to a directory. This creates a small issue for us because we often have the same task in two different contests. Additionally, we keep the tasks for each contest in the same directory. So we need to split them apart. Therefore I implemented loaders to work on the path to a config file instead of to the path to a directory.

The only issue with this is ContestLoader and get_task_loader already assumes that the provided task name is the real name of the task, therefore this creates a duplication in both config files: task configuration name field and contest configuration task name must be set to the same name.

If we implemented this with separate directories then this duplication is simply kept in a different form (in the name of a task directory and still in the contest config file) And this still would rise issues with one task in two contests.

Remaining issue:

  • automatic newline converter to Unix newlines when extracting tests from zip archive. (Didn't find a nice way how to do this in python) This probably could be done better without loading all file in memory.

@PPakalns
Copy link
Member Author

Successfully imported warmup2 contest.

My observations:

  • The location and name of the test archive should be precisely defined. It differs between tasks in our repository.
  • Options like:
    Minimum interval between submissions, minimum interval between user tests for contest.
    Maximum number of submissions, maximum number of user tests for task.
    Should have default value in task loader. (30, 30, 40, 40)
    So that we do not need to repeat them in contest.yaml, task.yaml configuration files.
  • Timezone is not set to "Europe/Riga".
  • Contest allowed localizations is not set to "lv".

All other settings are set up correctly.

@andreyv andreyv self-assigned this Jan 19, 2019
@PPakalns
Copy link
Member Author

PPakalns commented Jan 19, 2019

Successfully imported regional contests that share one task. See svn for configuration file setup.

Additionally, tested the case when there are submissions and task configuration (tests, public groups) is changed.

For example, I saw this message:

 Publiski redzamais rezultāts:
10 / 6 

What happens. When a user sees the score or the detailed results for submission, he sees the results for the old dataset. Detailed results don't seem to leak any information about the new dataset, it shows detailed results for old dataset. (with scores for old public groups)

Therefore, when setting up contest before the start, we can execute the import multiple times. After each import we should reevaluate all solutions for affected tasks (use task importer if necessary).

In conclusion, the configuration part of contests and tasks before the start is moved to these config files. We can keep version history of them.

@andreyv
Copy link
Member

andreyv commented Jul 22, 2019

Running cmsImportContest -L Lio-contest 2_novads/contest_junior.yaml, I get

2019-07-22 20:33:57,936 - INFO [<unknown>] Using configuration file /etc/cms.conf.
2019-07-22 20:33:58,379 - INFO [<unknown>] Loading parameters for contest junior.
2019-07-22 20:33:58,380 - INFO [<unknown>] Contest parameters loaded.
2019-07-22 20:33:58,394 - INFO [<unknown>] Creating contest on the database.
2019-07-22 20:33:58,407 - ERROR [<unknown>] Task "Mazakais" not found in database. Use --import-task to import it.
2019-07-22 20:33:58,407 - INFO [<unknown>] Error while importing, no changes were made.

Is it supposed to work this way?

Copy link
Member

@andreyv andreyv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like how the newlines are converted :)

cmscontrib/loaders/lio.py Outdated Show resolved Hide resolved
cmscontrib/loaders/lio.py Show resolved Hide resolved
cmscontrib/loaders/lio.py Outdated Show resolved Hide resolved
cmscontrib/loaders/lio.py Show resolved Hide resolved
cmscontrib/loaders/lio.py Outdated Show resolved Hide resolved
cmscontrib/loaders/lio.py Outdated Show resolved Hide resolved
cmscontrib/loaders/lio.py Outdated Show resolved Hide resolved
cmscontrib/loaders/lio.py Show resolved Hide resolved
cmscontrib/loaders/lio.py Outdated Show resolved Hide resolved
cmscontrib/loaders/lio.py Outdated Show resolved Hide resolved
andreyv and others added 7 commits October 27, 2019 20:47
Default values for following options:
timezone, allowed_localizations,
minimum interval between submissions, minimum interval between user
tests, maximum number of submissions, maximum number of user tests.
@PPakalns
Copy link
Member Author

PPakalns commented Dec 1, 2019

Running cmsImportContest -L Lio-contest 2_novads/contest_junior.yaml, I get

2019-07-22 20:33:57,936 - INFO [<unknown>] Using configuration file /etc/cms.conf.
2019-07-22 20:33:58,379 - INFO [<unknown>] Loading parameters for contest junior.
2019-07-22 20:33:58,380 - INFO [<unknown>] Contest parameters loaded.
2019-07-22 20:33:58,394 - INFO [<unknown>] Creating contest on the database.
2019-07-22 20:33:58,407 - ERROR [<unknown>] Task "Mazakais" not found in database. Use --import-task to import it.
2019-07-22 20:33:58,407 - INFO [<unknown>] Error while importing, no changes were made.

Is it supposed to work this way?

When importing contest you need to pass the relevant flags to define the behaviour for importer:

  -i, --import-tasks    import tasks if they do not exist
  -u, --update-contest  update an existing contest
  -U, --update-tasks    update existing tasks
  -S, --no-statements   do not import / update task statements
  --delete-stale-participations
                        when updating a contest, delete the participations not
                        in the new contest, including their submissions and
                        other data

@andreyv
Copy link
Member

andreyv commented Sep 27, 2020

I think this is good now, thanks :)

The diff shows some unrelated changes, can you please fix this before merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants