From 4ab7f7c930255fdc3fb5983dec6feb0d509f1cba Mon Sep 17 00:00:00 2001 From: Ismayil Hasanov Date: Thu, 23 May 2019 12:37:15 +0400 Subject: [PATCH 1/9] fix: increase JVM heap and stack size --- cms/grading/languages/java_jdk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cms/grading/languages/java_jdk.py b/cms/grading/languages/java_jdk.py index dbc6ba6eaf..523863f6be 100644 --- a/cms/grading/languages/java_jdk.py +++ b/cms/grading/languages/java_jdk.py @@ -78,10 +78,10 @@ def get_evaluation_commands( if JavaJDK.USE_JAR: # executable_filename is a jar file, main is the name of # the main java class - return [["/usr/bin/java", "-Deval=true", "-Xmx512M", "-Xss64M", + return [["/usr/bin/java", "-Deval=true", "-Xmx1024M", "-Xss1024M", "-cp", executable_filename, main] + args] else: unzip_command = ["/usr/bin/unzip", executable_filename] - command = ["/usr/bin/java", "-Deval=true", "-Xmx512M", "-Xss64M", + command = ["/usr/bin/java", "-Deval=true", "-Xmx1024M", "-Xss1024M", main] + args return [unzip_command, command] From 98ba4f70f43ce6956865a201b3cdfdeb998a221f Mon Sep 17 00:00:00 2001 From: Ismayil Hasanov Date: Thu, 23 May 2019 12:43:59 +0400 Subject: [PATCH 2/9] feat: made JVM more deterministic acording to the checklist recommendations at https://wiki.ioinformatics.org/wiki/HostingAnIOI/TechnicalChecklist --- cms/grading/languages/java_jdk.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cms/grading/languages/java_jdk.py b/cms/grading/languages/java_jdk.py index 523863f6be..2ac7378486 100644 --- a/cms/grading/languages/java_jdk.py +++ b/cms/grading/languages/java_jdk.py @@ -79,9 +79,11 @@ def get_evaluation_commands( # executable_filename is a jar file, main is the name of # the main java class return [["/usr/bin/java", "-Deval=true", "-Xmx1024M", "-Xss1024M", - "-cp", executable_filename, main] + args] + "-Xbatch", "-XX:+UseSerialGC", "-XX:-TieredCompilation", + "-XX:CICompilerCount=1", "-cp", executable_filename, main] + args] else: unzip_command = ["/usr/bin/unzip", executable_filename] command = ["/usr/bin/java", "-Deval=true", "-Xmx1024M", "-Xss1024M", - main] + args + "-Xbatch", "-XX:+UseSerialGC", "-XX:-TieredCompilation", + "-XX:CICompilerCount=1", main] + args return [unzip_command, command] From 0f9874dbd9bb59a75f87ef37471879fcc318f613 Mon Sep 17 00:00:00 2001 From: Jamal Hasanov Date: Mon, 27 May 2019 14:11:27 +0400 Subject: [PATCH 3/9] Special character in team code - fixed --- cms/service/ProxyService.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/service/ProxyService.py b/cms/service/ProxyService.py index 8f16fa464f..2100a44f66 100644 --- a/cms/service/ProxyService.py +++ b/cms/service/ProxyService.py @@ -336,7 +336,7 @@ def initialize(self): users[encode_id(user.username)] = { "f_name": user.first_name, "l_name": user.last_name, - "team": team.code if team is not None else None, + "team": encode_id(team.code) if team is not None else None, } if team is not None: teams[encode_id(team.code)] = { From 528ab4ec7ace7cdd6c15b36f4134382de3163bb2 Mon Sep 17 00:00:00 2001 From: Jamal Hasanov Date: Thu, 20 Jun 2019 10:18:52 +0400 Subject: [PATCH 4/9] Azerbaijani translation added --- cms/locale/az/LC_MESSAGES/cms.po | 1055 ++++++++++++++++++++++++++++++ 1 file changed, 1055 insertions(+) create mode 100644 cms/locale/az/LC_MESSAGES/cms.po diff --git a/cms/locale/az/LC_MESSAGES/cms.po b/cms/locale/az/LC_MESSAGES/cms.po new file mode 100644 index 0000000000..85708172a1 --- /dev/null +++ b/cms/locale/az/LC_MESSAGES/cms.po @@ -0,0 +1,1055 @@ +# Azerbaijani translations for CMS: +# Jamal Hasanov , 2019. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-04-30 18:53+0400\n" +"PO-Revision-Date: 2019-04-30 18:53+0400\n" +"Last-Translator: Jamal Hasanov \n" +"Language-Team: Azerbaijan\n" +"Language: az\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;\n" +"X-Language: az_AZ\n" +"X-Source-Language: C\n" + +msgid "Compilation succeeded" +msgstr "Uğurlu kompilyasiya" + +msgid "Your submission successfully compiled to an executable." +msgstr "Sizin yükləməniz uğurla işlək proqrama çevrildi." + +msgid "Compilation failed" +msgstr "Kompilyasiya səhvi" + +msgid "Your submission did not compile correctly." +msgstr "Sizin teqdiminiz duzgun kompilyasiya olunmur" + +msgid "Compilation timed out" +msgstr "Kompilyasiya ayrılmış vaxt limiti aşıb" + +msgid "" +"Your submission exceeded the time limit while compiling. This might be " +"caused by an excessive use of C++ templates, for example." +msgstr "sizin teqdim kompilyasiya zamanı vaxt limitini keçmişdir. Bu artıq işledilmiş C++ şablonundan neticelene biler." + +#, fuzzy, python-format +msgid "" +"Compilation killed with signal %s (could be triggered by violating memory " +"limits)" +msgstr "Kompilyasiya %s siqnalı ilə dayandırılmışdır (yaddaş limiti ilə bağlı ola bilər)." + +msgid "Output is correct" +msgstr "Netice düzgündür" + +msgid "Your submission ran and gave the correct answer" +msgstr "Sizin həll işledi ve düzgün cavab verdi" + +#, fuzzy +msgid "Output is partially correct" +msgstr "Netice qismen düzgündür" + +msgid "Your submission ran and gave the partially correct answer" +msgstr "Sizin həll işlədi ve qismən düzgün cavab verdi" + +msgid "Output isn't correct" +msgstr "Nəticə düzgün deyil" + +msgid "Your submission ran, but gave the wrong answer" +msgstr "Sizin həll işledi ve yanlış cavab verdi" + +#, python-format +msgid "Evaluation didn't produce file %s" +msgstr "Yoxlama %s faylını yarada bilmədi" + +msgid "Your submission ran, but did not write on the correct output file" +msgstr "Sizin həll işlədi lakin düzgün nəticə faylinda yazılmadı" + +msgid "Execution timed out" +msgstr "İcraya ayrılan limit aşıb" + +msgid "Your submission used too much CPU time." +msgstr "Sizin teqdim heddinden artıq CPU vaxtı işledib" + +msgid "Execution timed out (wall clock limit exceeded)" +msgstr "İcra dayandırılmışdır (divar saatı limiti icra edildi" + +msgid "" +"Your submission used too much total time. This might be triggered by " +"undefined code, or buffer overflow, for example. Note that in this case the " +"CPU time visible in the submission details might be much smaller than the " +"time limit." +msgstr "" +"Sizin həll həddindən artıq zaman istifadə edib. Bu yanlış kodlaşdırma, buferin dolması kimi " +"səbələrdən ola bilər. Nəzərə alın ki, bu halda həllin təfərrüatlarında göstərilən " +"CPU zamanı işləmə zamanından kiçik ola bilər." + +#, python-format +msgid "" +"Execution killed with signal %s (could be triggered by violating memory " +"limits)" +msgstr "" +"İcra %s siqnalı ilə dayandırılmışdır (yaddaş limiti ilə bağlı ola bilər)" + +msgid "" +"Your submission was killed with the specified signal. Among other things, " +"this might be caused by exceeding the memory limit. Note that if this is the " +"reason, the memory usage visible in the submission details is the usage " +"before the allocation that caused the signal." +msgstr "" +"İcra məcburi şəkildə dayandırılmışdır. Bu ifrat yaddaş istifadəsi ilə bağlı ola bilər." + +msgid "Execution failed because the return code was nonzero" +msgstr "Cavab kodu sıfırdan fərqli olduğu üçün icra səhvi qeydə alındı" + +msgid "" +"Your submission failed because it exited with a return code different from 0." +msgstr "Sizin təqdim 0-dan fərqli kod qaytardığı üçün uğursuzdur" + +msgid "N/A" +msgstr "məlumat yoxdur" + +msgid "Score details temporarily unavailable." +msgstr "Hesab detalları müvəqqəti olaraq əlçatan deyildir." + +#, python-format +msgid "Subtask %(index)s" +msgstr "Altməsələ %(index)s" + +msgid "Outcome" +msgstr "Nəticə" + +msgid "Details" +msgstr "Təfərrüatlar" + +msgid "Execution time" +msgstr "İcra vaxtı" + +msgid "Memory used" +msgstr "Yaddaş istifadəsi" + +msgid "Not correct" +msgstr "Düzgün deyil" + +msgid "Correct" +msgstr "Düzgün" + +msgid "Partially correct" +msgstr "Qismən düzgün" + +msgid "Invalid files in submission" +msgstr "Teqdimde yanlış fayl" + +msgid "Execution completed successfully" +msgstr "İcra müvəffəqiyyətlə başa çatıb" + +msgid "No compilation needed" +msgstr "Kompilyasiyaya ehtiyac yoxdur" + +msgid "File not submitted" +msgstr "Fayl yuklənməyib" + +msgid "loading..." +msgstr "yuklenir..." + +msgid "unknown" +msgstr "naməlum" + +msgid "contest-token" +msgstr "müsabiqə-açar" + +msgid "contest-tokens" +msgstr "müsabiqə-açarları" + +msgid "task-token" +msgstr "tapşırıq-açar" + +msgid "task-tokens" +msgstr "tapşırıq-açarları" + +msgid "token" +msgstr "açar" + +msgid "tokens" +msgstr "açarlar" + +#, python-format +msgid "You don't have %(type_pl)s available for this task." +msgstr "Sizin bu tapşırıq üçün uyğun %(type_pl)s yoxdur." + +#, python-format +msgid "You have an infinite number of %(type_pl)s for this task." +msgstr "Для этой задачи у вас неограниченное количество %(type_pl)s." + +#, python-format +msgid "You start with no %(type_pl)s." +msgstr "Вы начинаете без %(type_pl)s." + +#, python-format +msgid "You start with one %(type_s)s." +msgid_plural "You start with %(gen_initial)d %(type_pl)s." +msgstr[0] "Siz %(type_s)s ilə başlayırsınız." +msgstr[1] "Siz %(type_s)s ilə başlayırsınız." + +#, python-format +msgid "Every minute " +msgid_plural "Every %(gen_interval)g minutes " +msgstr[0] "Hər dəqiqə " +msgstr[2] "Hər %(gen_interval)g dəqiqədən bir " + +#, python-format +msgid "you get another %(type_s)s, " +msgid_plural "you get %(gen_number)d other %(type_pl)s, " +msgstr[0] "siz daha bir %(type_s)s alırsınız," +msgstr[0] "siz əlavə %(type_s)s alırsınız," + +#, python-format +msgid "up to a maximum of one %(type_s)s." +msgid_plural "up to a maximum of %(gen_max)d %(type_pl)s." +msgstr[0] "maksimum bir %(type_s)s" +msgstr[1] "maksimal olaraq %(type_s)s" + +#, python-format +msgid "you get another %(type_s)s." +msgid_plural "you get %(gen_number)d other %(type_pl)s." +msgstr[0] "siz əlavə %(type_s)s alırsınız." +msgstr[1] "siz əlavə %(type_s)s alırsınız." + +#, python-format +msgid "You don't get other %(type_pl)s." +msgstr "Sizdə artıq %(type_pl)s yoxdur." + +#, python-format +msgid "You can use a %(type_s)s every second " +msgid_plural "You can use a %(type_s)s every %(min_interval)g seconds " +msgstr[0] "Siz hər saniiyədə bir %(type_s)s istifadə edə bilərsiniz" +msgstr[1] "Siz hər %(min_interval)g saniyədə bir %(type_s)s istifadə edə bilərsiniz" + +#, python-format +msgid "and no more than one %(type_s)s in total." +msgid_plural "and no more than %(max_number)d %(type_pl)s in total." +msgstr[0] "və maksimum bir %(type_s)s" +msgstr[1] "və maksimum %(max_number)d sayda %(type_s)s" + +#, python-format +msgid "You can use a %(type_s)s every second." +msgid_plural "You can use a %(type_s)s every %(min_interval)g seconds." +msgstr[0] "Siz hər saniyədə bir %(type_s)s istifadə edə bilərsiniz" +msgstr[1] "Siz hər %(min_interval)g saniyədə bir %(type_s)s istifadə edə bilərsiniz" + +#, python-format +msgid "You can use no more than one %(type_s)s in total." +msgid_plural "You can use no more than %(max_number)d %(type_pl)s in total." +msgstr[0] "Siz cəmi bir %(type_s)s istifadə edə bilərsiniz." +msgstr[1] "Siz maksimum %(max_number)d sayda %(type_s)s. istifadə edə bilərsiniz" + +#, fuzzy +msgid "You have no limitations on how you use them." +msgstr "İstifadə üçün limitlenmə yoxdur." + +#, fuzzy +msgid "Question too big!" +msgstr "Sual çox böyükdür!" + +msgid "You have reached the question length limit." +msgstr "Siz sual ölçü limitinə çatdınız" + +msgid "Question received" +msgstr "Sual qəbul edildi" + +msgid "" +"Your question has been received, you will be notified when it is answered." +msgstr "Sizin sual qəbul edildi ve siz cavablandıqda bildiriş alacaqsınız." + +#, fuzzy +msgid "Too many print jobs!" +msgstr "Çoxlu çap etmə işləri!" + +#, fuzzy, python-format +msgid "You have reached the maximum limit of at most %d print jobs." +msgstr "Siz maksimum çap etme %d işlerine çatmısınız." + +#, fuzzy +msgid "Invalid format!" +msgstr "Etibarsız format!" + +msgid "Please select the correct files." +msgstr "Zəhmət olmasa düzgün faylı seçin." + +#, fuzzy +msgid "File too big!" +msgstr "Fayl çox böyükdür!" + +#, fuzzy, python-format +msgid "Each file must be at most %d bytes long." +msgstr "Her fayl en çoxu %d baytlar uzunluğunda olmalıdır ." + +#, fuzzy +msgid "Print job storage failed!" +msgstr "çap işi saxlanması uğursuzdur!" + +msgid "Please try again." +msgstr "Zəhmət olmasa yeniden cəhd edin." + +#, fuzzy +msgid "Print job received" +msgstr "çap işi qəbul edildi" + +msgid "Your print job has been received." +msgstr " Sizin çap işiniz əldə edildi" + +#, python-format +msgid "" +"You have reached the maximum limit of at most %d submissions among all tasks." +msgstr "" +"Siz butun tapşırıqlar boyunca maksimum teqdim limitinə çatmısınız %d." + +#, python-format +msgid "" +"You have reached the maximum limit of at most %d submissions on this task." +msgstr "" +"Siz bu tapşırıqda maksimum teqdim limitinə çatmısınız %d." + +msgid "Too many submissions!" +msgstr "Çoxlu teqdim!" + +#, python-format +msgid "" +"Among all tasks, you can submit again after %d seconds from last submission." +msgstr "" +"Butun tapşırıqlar arasında axırıncı təqdim etdiyinizden dərhal sonra siz yenidən təqdim edə bilərsiniz." + +#, python-format +msgid "" +"For this task, you can submit again after %d seconds from last submission." +msgstr "Bu tapşırığı, axırıncı yükləmədən %d saniyə sonra yenidən yükləyə bilərsiniz. " + +msgid "Submissions too frequent!" +msgstr "Yükləmələr çox tez-tez baş verir!" + +msgid "Invalid submission format!" +msgstr "Yüklənilən fayl yanlış formatdadır!" + +msgid "Invalid archive format!" +msgstr "Yanlış formatda arxiv faylı!" + +msgid "The submitted archive could not be opened." +msgstr "Göndərilən arxiv fayl açıla bilmir." + +#, fuzzy +msgid "Cannot recognize the submission language." +msgstr "Yüklənmiş faylın proqramlaşdırma dili tanınmır." + +#, python-format +msgid "Language %s not allowed in this contest." +msgstr "%s dili yarışmada icazə verilmir." + +msgid "Invalid submission!" +msgstr "Yanlış yükləmə!" + +msgid "Submission too big!" +msgstr "Yüklənilən faylın həcmi çox böyükdür!" + +#, python-format +msgid "Each source file must be at most %d bytes long." +msgstr "Hər bir mənbə faylı maksimum %d bayt uzunluğunda olmalıdır." + +msgid "Submission storage failed!" +msgstr "Fayl yaddaşa yazılmadı!" + +msgid "Submission received" +msgstr "Fayl qəbul olundu" + +msgid "Your submission has been received and is currently being evaluated." +msgstr "Yükləməniz qəbul olundu və hal hazırda qiymətləndirmə mərhəsindədir." + +msgid "Compiling..." +msgstr "Emal olunur..." + +msgid "details" +msgstr "Detallar" + +msgid "Evaluating..." +msgstr "Qiymətləndirilir..." + +msgid "Scoring..." +msgstr "Xallar verilir..." + +msgid "Evaluated" +msgstr "Qiymətləndirildi" + +msgid "Token request discarded" +msgstr "Açar müraciəti ləğv edildi" + +msgid "Your request has been discarded because you have no tokens available." +msgstr "Sizin müraciət ləğv olundu çünki, sizdə kifayət qədər açar yoxdur" + +msgid "" +"Your request has been discarded because you already used a token on that " +"submission." +msgstr "" +"Sizin müraciət qəbul edilmədi, çünki siz artıq açarı istifadə etmisiniz." + +msgid "Token request received" +msgstr "Açar müraciəti qəbul olundu." + +msgid "Your request has been received and applied to the submission." +msgstr "Sizin müraciət qəbul olundu və yüklənmə üçün təqdim edildi." + +#, python-format +msgid "You have reached the maximum limit of at most %d tests among all tasks." +msgstr "Siz bütün tapşırıqlar arasında maximum %d test sayına çatmısınız." + +#, python-format +msgid "You have reached the maximum limit of at most %d tests on this task." +msgstr "Siz maximum %d test sayına çatmısınız." + +msgid "Too many tests!" +msgstr "Həddindən çox testlər!" + +#, python-format +msgid "Among all tasks, you can test again after %d seconds from last test." +msgstr "" +"Bütün tapşırıqlar arasından yenidən test etməyi axırıncı testdən %d saniyə sonra edə bilərsiniz. " + + +#, python-format +msgid "For this task, you can test again after %d seconds from last test." +msgstr "" +"Bu tapşırıq üçün, yenidən test etməyi axırıncı testdən %d saniyə sonra edə bilərsiniz. " + + +msgid "Tests too frequent!" +msgstr "Testlər tez-tez baş verir!" + +msgid "Invalid test format!" +msgstr "Yanlış test formatı!" + +#, fuzzy +msgid "Cannot recognize the user test language." +msgstr "İstifadəçinin daxil etdiyiest dili müəyyən edilmədi" + +msgid "Invalid test!" +msgstr "Yanlış test!" + +msgid "Test too big!" +msgstr "Testin həcmi çox böyükdür!" + +msgid "Input too big!" +msgstr "Daxil edilən fayl çox böyükdür!" + +#, python-format +msgid "The input file must be at most %d bytes long." +msgstr "Daxil edilən fayl ən azı %d bayt olmalıdır." + +msgid "Test storage failed!" +msgstr "Testin yaddaşa yazılmasında səhv baş verdi!" + +msgid "Test received" +msgstr "Test qəbul olundu" + +msgid "Your test has been received and is currently being executed." +msgstr "Sizin test qəbul olundu və hal-hazırda icra olunur." + +msgid "Executing..." +msgstr "İcra olunur..." + +msgid "Executed" +msgstr "İcra olundu" + +msgid "Communication" +msgstr "Kommunikasiya" + +msgid "Announcements" +msgstr "Elanlar" + +msgid "(no subject)" +msgstr "(mövzsuz)" + +msgid "Questions" +msgstr "Suallar" + +msgid "Subject" +msgstr "Mövzu" + +msgid "Text" +msgstr "Tekst" + +msgid "Ask question" +msgstr "Sual soruş" + +msgid "Reset" +msgstr "Təmizlə" + +msgid "no answer yet" +msgstr "Hələlik cavab yoxdur." + +msgid "Messages" +msgstr "Mesajlar" + +#, python-format +msgid "Automatic (%(lang)s)" +msgstr "Avtomatik (%(lang)s)" + +msgid "Logout" +msgstr "Çıxış" + +#, python-format +msgid "" +"Logged in as %(first_name)s %(last_name)s " +"(%(username)s)" +msgstr "" +"Daxil oldu %(first_name)s %(last_name)s (%(username)s)" + +msgid "Failed to log in." +msgstr "Daxil oluna bilinmədi." + +msgid "Welcome" +msgstr "Xoş gəlmişsiniz" + +msgid "Please log in" +msgstr "Zəhmət olmasa daxil olun" + +msgid "Username" +msgstr "İstifadəçi adı" + +msgid "Password" +msgstr "Şifrə" + +msgid "Login" +msgstr "Daxil ol" + +msgid "New message" +msgstr "Yeni ismarıc" + +msgid "New announcement" +msgstr "Yeni elan" + +msgid "New answer" +msgstr "Yeni cavab" + +#, python-format +msgid "%d unread" +msgstr "%d oxunmamış" + +msgid "Until contest starts:" +msgstr "Yarışın başlanmasına:" + +msgid "Until contest ends:" +msgstr "Yarışın sonuna:" + +#, fuzzy +msgid "Until analysis starts:" +msgstr "Təhlilin başlanmasına:" + +#, fuzzy +msgid "Until analysis ends:" +msgstr "Təhlilin sonuna:" + +msgid "Time left:" +msgstr "Qalmiş vaxt:" + +msgid "Server time:" +msgstr "Server vaxtı:" + +msgid "Overview" +msgstr "Baxış" + +msgid "Statement" +msgstr "Məsələnin şərti" + +msgid "Submissions" +msgstr "Məsələnin həlli" + +msgid "Documentation" +msgstr "Sənədlər" + +msgid "Testing" +msgstr "Yoxlama" + +msgid "Printing" +msgstr "Çap etmə" + +msgid "Contest Management System" +msgstr "Contest Management System" + +msgid "is released under the" +msgstr "is released under the" + +msgid "GNU Affero General Public License" +msgstr "GNU Affero General Public License" + +msgid "Programming languages and libraries" +msgstr "Proqramlaşdırma dillləri və kitabxanaları" + +msgid "Standard Template Library" +msgstr "Standard Template Library" + +msgid "" +"The main Java class of the solution should have exactly the same name as the " +"task." +msgstr Əsas Java classın adı eyniylə tapşırıq adı kimi olmalıdır + +#, fuzzy +msgid "Submission details for compilation" +msgstr "Kompilyasiya üçün dəqiqləşmələr" + +#, fuzzy +msgid "Message" +msgstr "İsmarıc" + +msgid "Explanation" +msgstr "İzah" + +#, fuzzy +msgid "Submission details for evaluation" +msgstr "Göndərişin detalları" + +#, python-format +msgid "Error %(status_code)s" +msgstr "Xəta %(status_code)s" + +msgid "An error occured while the server was handling your request." +msgstr "Emal zamanı xəta baş verdi." + + +msgid "An error occured while the server was handling your request." +msgstr "Emal zamanı xəta baş verdi." + +msgid "" +"Note that attempts to tamper with Contest Management System (such as probing " +"the server with customized URLs) may be considered cheating and may lead to " +"disqualification." +msgstr " " +"Nəzərə alın ki, sistəmə müdaxilə etmək cəhdləri köçürmə kimi qiymətləndrilə bilər " +"və bu səbəbdən diskvalifikasiya oluna bilərsiniz." + +msgid "" +"If you encountered this error during normal usage, please notify the contest " +"administrators." +msgstr " Əgər normal istifadə zamanı bu səhvlə qarşılaşsanızç zəhmət olmasa " +" administratorlara bildirin" + +msgid "General information" +msgstr "Ümumi məlumat" + +msgid "The contest hasn't started yet." +msgstr "Yarış hələ başlamayıb." + +#, python-format +msgid "The contest will start at %(start_time)s and will end at %(stop_time)s." +msgstr "Yarışın başlama vaxtı %(start_time)s, bitmə vaxtı isə %(stop_time)s." + +msgid "The contest is currently running." +msgstr "Yarış gedir." + +#, python-format +msgid "The contest started at %(start_time)s and will end at %(stop_time)s." +msgstr "Yarışın başlama vaxtı %(start_time)s və bitmə vaxtı %(stop_time)s." + +msgid "The contest has already ended." +msgstr "Yarış artıq bitmişdir." + +#, python-format +msgid "The contest started at %(start_time)s and ended at %(stop_time)s." +msgstr "Yarış başlama vaxtı %(start_time)s və bitmə vaxtı в %(stop_time)s." + +#, fuzzy +msgid "The analysis mode hasn't started yet." +msgstr "Analiz üsulu hələ başlamayıb." + +#, fuzzy, python-format +msgid "" +"The analysis mode will start at %(start_time)s and will end at %(stop_time)s." +msgstr "Analiz modu bashlayacaq vaxtı %(start_time)s ve bitecek vaxtı %(stop_time)s." + +#, fuzzy +msgid "The analysis mode is currently running." +msgstr "Analiz üsulu davam edir." + +#, fuzzy, python-format +msgid "" +"The analysis mode started at %(start_time)s and will end at %(stop_time)s." +msgstr "Analizin başlama vaxtı %(start_time)s ve bitme vaxtı %(stop_time)s." + +#, fuzzy +msgid "The analysis mode has already ended." +msgstr "Analiz üsulu artıq sona çatıb." + +#, fuzzy, python-format +msgid "The analysis mode started at %(start_time)s and ended at %(stop_time)s." +msgstr "Analiz modun başlama vaxtı %(start_time)s ve bitme vaxtı %(stop_time)s." + +msgid "You have an infinite number of tokens." +msgstr "Sizin sonsuz sayda açarlarınız var." + +msgid "You can see the detailed result of a submission by using a token on it." +msgstr "Açar istifadə edərək siz detallı teqdim neticələrini gorə bilersiniz" + +msgid "" +"Your score for each task will be the maximum among the tokened submissions " +"and the last one." +msgstr "Açarla göndərilmiş yukləmələr arasında hər bir tapşırıq üçün " +"sizin hesabınız maksimum olacaqdır" + +msgid "You have a distinct set of tokens for each task." +msgstr "Sizin hər bir tapşırıq üçün fərqli açar toplusu var." + +#, python-format +msgid "" +"You can find the rules for the %(type_pl)s on each task's description page." +msgstr "Siz hər bir %(type_pl)s üçün qayda ilə müvafiq tapşırığın səhifəsində tanış ola bilərsiniz." + +msgid "You have a set of tokens shared among all tasks." +msgstr "Paylaşılan tapşırıqlar boyunca sizin açarlar dəstiniz var." + +msgid "" +"You have two types of tokens: a set of contest-tokens shared among " +"all tasks and a distinct set of task-tokens for each task." +msgstr "" +"Sizin iki növ açar mövcuddur: bütün tapşırıqlar üçün contest-token toplusu, " +" və hər bir tapşırıq üçün olan task-token." + +msgid "" +"You can see the detailed result of a submission by using two tokens on it, " +"one of each type." +msgstr "Siz yukləmələrin detallı nəticələrini iki açarı istifadə edərək gorə bilersiniz" + + +#, fuzzy, python-format +msgid "You can submit at most %(submissions)s solutions during this contest." +msgstr "" +"Siz yarış müddətində en çoxu %(submissions)s heller yukləyə bilərsiniz " + +#, python-format +msgid "You can submit at most %(user_tests)s user tests during this contest." +msgstr "Siz yarış müddətində en çoxu %(user_tests)s admin testləri yukləyə bilərsiniz" + +#, python-format +msgid "" +"Every user is allowed to compete (i.e. submit solutions) for a uninterrupted " +"time frame of %(per_user_time)s." +msgstr "" +"Hər bir iştirakçı %(per_user_time)s zaman ərzində öz həllərini göndərə bilər." + +msgid "As soon as the contest starts you can choose to start your time frame." +msgstr "Yarış başladıqda siz öz vaxt limitinizi seçə bilərsiniz." + +msgid "" +"Once you start, you can submit solutions until the end of the time frame or " +"until the end of the contest, whatever comes first." +msgstr "Yarış başladıqdan sonra siz həllərinizi vaxt limitinin və ya " +"yarış vaxtı bitənə qədər göndərə bilərsniz." + + +msgid "By clicking on the button below you can start your time frame." +msgstr "Siz düyməyə basmaqla vaxt limitinizə başlaya bilərsiniz." + +#, python-format +msgid "You started your time frame at %(start_time)s." +msgstr "Siz vaxt limitinizə %(start_time)s də başladınız." + +msgid "" +"You can submit solutions until the end of the time frame or until the end of " +"the contest, whatever comes first." +msgstr "" +"Siz həllərinizi vaxt limitinin və ya yarış vaxtı bitənə qədər göndərə bilərsniz." + +#, python-format +msgid "" +"You started your time frame at %(start_time)s and you already finished it." +msgstr "siz vaxt limitinə başladınız %(start_time)s və artıq bitirdiniz." + +msgid "There's nothing you can do now." +msgstr "Sizin edə biləcəyiniz heçnə yoxdur." + +msgid "You never started your time frame. Now it's too late." +msgstr "Siz heç vaxt vaxt limitinizə başlamadınız. İndi isə çox gecdir" + +msgid "Start!" +msgstr "Başla!" + +msgid "Task overview" +msgstr "Tapşırığa ümumi baxış" + +msgid "Task" +msgstr "Tapşırıq" + +msgid "Name" +msgstr "Ad" + +msgid "Time limit" +msgstr "Vaxt limiti" + +msgid "Memory limit" +msgstr "Yaddaş limiti" + +msgid "Type" +msgstr "Növ" + +msgid "Files" +msgstr "Fayllar" + +msgid "Tokens" +msgstr "Açarlar" + +msgid "Yes" +msgstr "Bəli" + +msgid "No" +msgstr "Xeyr" + +msgid "Print" +msgstr "Çap Et" + +#, python-format +msgid "" +"You can print %(remaining_jobs)s more text or PDF files of up to " +"%(max_pages)s pages each." +msgstr " Siz daha çox metn və yaxud PDF faylları çap ede %(remaining_jobs)s bilərsiniz " +" - maksimum %(max_pages)s səhifə." + +#, python-format +msgid "" +"You can print %(remaining_jobs)s more text files of up to %(max_pages)s " +"pages each." +msgstr "" +"Siz səhifə sayı maksimum %(max_pages)s olan %(remaining_jobs)s sənəd " +"çap edə bilərsiniz." + +msgid "File (text or PDF)" +msgstr "Fayl (mətn və ya PDF)" + +msgid "File (text)" +msgstr "Fayl (məzmun)" + +msgid "Submit" +msgstr "Göndər" + +msgid "" +"You cannot print anything any more as you have used up your printing quota." +msgstr "Siz çap etmə normasına qədər istifadə etdiyiniz heçnəyi artıq çap edə bilməzsiniz" + +#, fuzzy +msgid "Previous print jobs" +msgstr "Əvvəlki çap işləri" + +msgid "Date and time" +msgstr "Tarix və vaxt" + +msgid "Time" +msgstr "Vaxt" + +msgid "File name" +msgstr "Faylın adı" + +msgid "Status" +msgstr "Status" + +#, fuzzy +msgid "no print jobs yet" +msgstr "çap işi yoxdur" + +#, fuzzy +msgid "Preparing..." +msgstr "Hazırlanır..." + +msgid "Compilation output" +msgstr "Kompilyasiya nəticəsi" + +msgid "Compilation outcome:" +msgstr "Kompilyasiya nəticəsi:" + +msgid "Compilation time:" +msgstr "Kompilyasiya vaxtı:" + +msgid "Memory used:" +msgstr "Yaddaş işledildi:" + +msgid "Standard output" +msgstr "Standart nəticə" + +msgid "Standard error" +msgstr "Standart səhv" + +msgid "None" +msgstr "Heç biri" + +msgid "Download" +msgstr "Yüklə" + +msgid "Played" +msgstr "İcrada" + +msgid "Play!" +msgstr "İcra et!" + +msgid "Wait..." +msgstr "Gözlə..." + +msgid "No tokens" +msgstr "Açar yoxdur" + +#, python-format +msgid "%(name)s (%(short_name)s) description" +msgstr "%(name)s (%(short_name)s) təsvir" + +msgid "no statement available" +msgstr "şərt verilməyib" + +msgid "Download task statement" +msgstr "Tapşiriq şərtlərini yüklə" + +msgid "" +"The statement for this task is available in multiple versions, in different " +"languages." +msgstr "Bu tapşırıq üçün şərt müxtətlif versiyalarda və müxtəlif dillərdə mövcuddur." + +msgid "You can see (and download) all of them using the list on the right." +msgstr "Sağdakı siyahıdan onlari istifadə edə (yukləyə) bilərsiniz." + +msgid "Some suggested translations follow." +msgstr "Bəzi teklif edilmiş tərcumeləri izlə." + +#, python-format +msgid "Statement in %(lang)s" +msgstr " %(lang)s də şərh" + +#, python-format +msgid "Statement in %(lang)s" +msgstr " %(lang)s də şərt" + +#, python-format +msgid "%(lang)s" +msgstr "%(lang)s" + +#, python-format +msgid "%(lang)s" +msgstr "%(lang)s" + +msgid "Some details" +msgstr "Bəzi məqamlar" + +msgid "Compilation commands" +msgstr "Kompilyasiya əmrləri" + +#, fuzzy, python-format +msgid "" +"You can find the rules for the %(type_pl)s on the contest overview page." +msgstr "" +"Siz %(type_pl)s üçün qaydaları burda oxuya bilərsiniz: yarış səhifəsi." + +msgid "" +"Remember that to see the detailed result of a submission you need to use both " +"a contest-token and a task-token." +msgstr "" +"Nəzərə alın ki, siz ətraflı nəticələr üçün həm contest-token, " +"həm də task-token açarlarından istifadə etməlisiniz + +msgid "Attachments" +msgstr "Yüklənənlər" + +#, python-format +msgid "%(name)s (%(short_name)s) submissions" +msgstr "%(name)s (%(short_name)s) göndərilmiş həllər" + +msgid "Submit a solution" +msgstr "Həlli təqdim et" + +#, python-format +msgid "You can submit %(submissions_left)s more solution(s)." +msgstr "Siz daha %(submissions_left)s həll yollaya edə bilərsiniz." + +msgid "submission.zip" +msgstr "submission.zip" + +msgid "Previous submissions" +msgstr "Əvvelki həllər" + +msgid "Right now, you have infinite tokens available on this task." +msgstr "Hal-hazırda sizin bu tapşırıqla bağlı sonsuz sayda açarlarınız vardır." + +msgid "Right now, you have one token available on this task." +msgstr "Hal-hazırda sizin bu tapşırıqla bağlı bir açarınız var." + +#, python-format +msgid "Right now, you have %(tokens)s tokens available on this task." +msgstr "Hal-hazırda sizin bu tapşırıqla bağlı %(tokens)s açarınız var." + +#, python-format +msgid "But you have to wait until %(expiration_time)s to use them." +msgstr "Lakin siz onları %(expiration_time)s qədər istifadə edə bilərsiniz." + +#, python-format +msgid "You will receive a new token at %(gen_time)s." +msgstr "Yeni açarı alacağınız vaxt: %(gen_time)s." + +msgid "In the current situation, no more tokens will be generated." +msgstr "Cari vəziyyətde heç bir açar yaradılmayacaq." + +msgid "Right now, you do not have tokens available for this task." +msgstr "Hal hazırda bu tapşırıqda sizin uyğun açar yoxdur." + +#, python-format +msgid "But you will have to wait until %(expiration_time)s to use it." +msgstr "Lakin siz %(expiration_time)s zamanına qədər gözləməlisiniz." + +msgid "Public score" +msgstr "İctimai xal" + +msgid "Total score" +msgstr "Yekun xal" + +msgid "Score" +msgstr "Xal" + +msgid "Official" +msgstr "Rəsmi" + +msgid "Token" +msgstr "Açar" + +msgid "no submissions yet" +msgstr "həll təqdim olunmayıb" + +msgid "Submission details" +msgstr "Təqdimat detalları" + +msgid "Close" +msgstr "Bağla" + +msgid "Submit a test" +msgstr "Test təqdim et" + +#, python-format +msgid "You can submit %(user_tests_left)s more test(s)." +msgstr "Siz daha %(user_tests_left)s test yükləyə bilərsiniz." + +msgid "input" +msgstr "giriş" + +msgid "Previous tests" +msgstr "Əvvəlki testlər" + +msgid "Input" +msgstr "Giriş" + +msgid "Output" +msgstr "Nəticə" + +msgid "no tests yet" +msgstr "testlər verilməyib" + +msgid "Test details" +msgstr "Test təfərrüatları"" + +msgid "Evaluation outcome" +msgstr "Qiymətləndirmə nəticəsi" + +#~ msgid "All sources must be in the same language." +#~ msgstr "Bütün kodlar eyni dildə olmalıdır." From 8477ec4892881546dd444f0096abd0cb1659ccc2 Mon Sep 17 00:00:00 2001 From: Farid Ahmadov Date: Tue, 9 Jul 2019 00:18:33 +0400 Subject: [PATCH 5/9] New task type added --- cms/grading/tasktypes/TwoSteps2019.py | 342 ++++++++++++++++++++++++++ cmscontrib/loaders/tps.py | 2 +- setup.py | 1 + 3 files changed, 344 insertions(+), 1 deletion(-) create mode 100644 cms/grading/tasktypes/TwoSteps2019.py diff --git a/cms/grading/tasktypes/TwoSteps2019.py b/cms/grading/tasktypes/TwoSteps2019.py new file mode 100644 index 0000000000..bf7dc2bcd7 --- /dev/null +++ b/cms/grading/tasktypes/TwoSteps2019.py @@ -0,0 +1,342 @@ +#!/usr/bin/env python3 + +# Contest Management System - http://cms-dev.github.io/ +# Copyright © 2010-2012 Giovanni Mascellani +# Copyright © 2010-2018 Stefano Maggiolo +# Copyright © 2010-2012 Matteo Boscariol +# Copyright © 2012-2013 Luca Wehrstedt +# Copyright © 2016 Petar Veličković +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import logging +import os +import tempfile + +from cms import config +from cms.db import Executable +from cms.grading.ParameterTypes import ParameterTypeChoice +from cms.grading.Sandbox import wait_without_std +from cms.grading.languagemanager import LANGUAGES, get_language +from cms.grading.steps import compilation_step, evaluation_step_before_run, \ + evaluation_step_after_run, human_evaluation_message, merge_execution_stats +from . import TaskType, \ + check_executables_number, check_files_number, check_manager_present, \ + create_sandbox, delete_sandbox, eval_output + + +logger = logging.getLogger(__name__) + + +# Dummy function to mark translatable string. +def N_(message): + return message + + +class TwoSteps2019(TaskType): + """Task type class for tasks where the user must submit two files + with a function each; the first function compute some data, that + get passed to the second function that must recover some data. + + The admins must provide a grader source file (for each language), + called grader.%l, that get compiled with both two user sources, + get the input as stdin, and get two parameters: 0 if it is the + first instance, 1 if it is the second instance, and the name of + the pipe. + + Admins must provide also header files, named "foo{.h|lib.pas}" for + the two sources (manager and user provided). + + Parameters are given by a singleton list of strings (for possible + expansions in the future), which may be 'diff' or 'comparator', + specifying whether the evaluation is done using white diff or a + comparator. + + """ + # Codename of the checker, if it is used. + CHECKER_CODENAME = "checker" + # Filename of the input and of the contestant's solution. + INPUT_FILENAME = "input.txt" + OUTPUT_FILENAME = "output.txt" + + # Constants used in the parameter definition. + OUTPUT_EVAL_DIFF = "diff" + OUTPUT_EVAL_CHECKER = "comparator" + + ALLOW_PARTIAL_SUBMISSION = False + + _EVALUATION = ParameterTypeChoice( + "Output evaluation", + "output_eval", + "", + {OUTPUT_EVAL_DIFF: "Outputs compared with white diff", + OUTPUT_EVAL_CHECKER: "Outputs are compared by a comparator"}) + + ACCEPTED_PARAMETERS = [_EVALUATION] + + @property + def name(self): + """See TaskType.name.""" + # TODO add some details if a comparator is used, etc... + return "Two steps" + + def __init__(self, parameters): + super().__init__(parameters) + self.output_eval = self.parameters[0] + + def get_compilation_commands(self, submission_format): + """See TaskType.get_compilation_commands.""" + res = dict() + for language in LANGUAGES: + source_ext = language.source_extension + header_ext = language.header_extension + source_filenames = [] + # Manager + manager_source_filename = "grader%s" % source_ext + source_filenames.append(manager_source_filename) + # Manager's header. + if header_ext is not None: + manager_header_filename = "grader%s" % header_ext + source_filenames.append(manager_header_filename) + + for filename in submission_format: + source_filename = filename.replace(".%l", source_ext) + source_filenames.append(source_filename) + # Headers + if header_ext is not None: + header_filename = filename.replace(".%l", header_ext) + source_filenames.append(header_filename) + + # Get compilation command and compile. + executable_filename = "manager" + commands = language.get_compilation_commands( + source_filenames, executable_filename) + res[language.name] = commands + return res + + def get_user_managers(self): + """See TaskType.get_user_managers.""" + return ["grader.%l"] + + def get_auto_managers(self): + """See TaskType.get_auto_managers.""" + return [] + + def _uses_checker(self): + return self.output_eval == TwoSteps2019.OUTPUT_EVAL_CHECKER + + def compile(self, job, file_cacher): + """See TaskType.compile.""" + language = get_language(job.language) + source_ext = language.source_extension + header_ext = language.header_extension + + if not check_files_number(job, 1): + return + + files_to_get = {} + source_filenames = [] + + # Manager. + manager_filename = "grader%s" % source_ext + if not check_manager_present(job, manager_filename): + return + source_filenames.append(manager_filename) + files_to_get[manager_filename] = job.managers[manager_filename].digest + # Manager's header. + if header_ext is not None: + manager_filename = "grader%s" % header_ext + if check_manager_present(job, manager_filename): + source_filenames.append(manager_filename) + files_to_get[manager_filename] = job.managers[manager_filename].digest + + # User's submissions and headers. + for filename, file_ in job.files.items(): + source_filename = filename.replace(".%l", source_ext) + source_filenames.append(source_filename) + files_to_get[source_filename] = file_.digest + # Headers (fixing compile error again here). + if header_ext is not None: + header_filename = filename.replace(".%l", header_ext) + if not check_manager_present(job, header_filename): + return + source_filenames.append(header_filename) + files_to_get[header_filename] = job.managers[header_filename].digest + + # Get compilation command. + executable_filename = "grader" + commands = language.get_compilation_commands(source_filenames, executable_filename) + + # Create the sandbox and put the required files in it. + sandbox = create_sandbox(file_cacher, name="compile") + job.sandboxes.append(sandbox.get_root_path()) + + for filename, digest in files_to_get.items(): + sandbox.create_file_from_storage(filename, digest) + + # Run the compilation. + box_success, compilation_success, text, stats = \ + compilation_step(sandbox, commands) + + # Retrieve the compiled executables + job.success = box_success + job.compilation_success = compilation_success + job.text = text + job.plus = stats + if box_success and compilation_success: + digest = sandbox.get_file_to_storage( + executable_filename, + "Executable %s for %s" % + (executable_filename, job.info)) + job.executables[executable_filename] = \ + Executable(executable_filename, digest) + + # Cleanup + delete_sandbox(sandbox, job.success, job.keep_sandbox) + + def evaluate(self, job, file_cacher): + """See TaskType.evaluate.""" + if not check_executables_number(job, 1): + return + + executable_filename = next(iter(job.executables.keys())) + executable_digest = job.executables[executable_filename].digest + + first_sandbox = create_sandbox(file_cacher, name="first_evaluate") + second_sandbox = create_sandbox(file_cacher, name="second_evaluate") + job.sandboxes.append(first_sandbox.get_root_path()) + job.sandboxes.append(second_sandbox.get_root_path()) + + fifo_dir = tempfile.mkdtemp(dir=config.temp_dir) + fifo = os.path.join(fifo_dir, "fifo") + os.mkfifo(fifo) + os.chmod(fifo_dir, 0o755) + os.chmod(fifo, 0o666) + + # First step: we start the first manager. + first_command = ["./%s" % executable_filename, "0", "/fifo/fifo"] + first_executables_to_get = {executable_filename: executable_digest} + first_files_to_get = { + TwoSteps2019.INPUT_FILENAME: job.input + } + + # Put the required files into the sandbox + for filename, digest in first_executables_to_get.items(): + first_sandbox.create_file_from_storage(filename, + digest, + executable=True) + for filename, digest in first_files_to_get.items(): + first_sandbox.create_file_from_storage(filename, digest) + + first = evaluation_step_before_run( + first_sandbox, + first_command, + job.time_limit, + job.memory_limit, + dirs_map={fifo_dir: ("/fifo", "rw")}, + stdin_redirect=TwoSteps2019.INPUT_FILENAME, + multiprocess=job.multithreaded_sandbox, + wait=False) + + # Second step: we start the second manager. + second_command = ["./%s" % executable_filename, "1", "/fifo/fifo"] + second_executables_to_get = {executable_filename: executable_digest} + second_files_to_get = {} + + # Put the required files into the second sandbox + for filename, digest in second_executables_to_get.items(): + second_sandbox.create_file_from_storage(filename, + digest, + executable=True) + for filename, digest in second_files_to_get.items(): + second_sandbox.create_file_from_storage(filename, digest) + + second = evaluation_step_before_run( + second_sandbox, + second_command, + job.time_limit, + job.memory_limit, + dirs_map={fifo_dir: ("/fifo", "rw")}, + stdout_redirect=TwoSteps2019.OUTPUT_FILENAME, + multiprocess=job.multithreaded_sandbox, + wait=False) + + # Consume output. + wait_without_std([second, first]) + + box_success_first, evaluation_success_first, first_stats = \ + evaluation_step_after_run(first_sandbox) + box_success_second, evaluation_success_second, second_stats = \ + evaluation_step_after_run(second_sandbox) + + box_success = box_success_first and box_success_second + evaluation_success = \ + evaluation_success_first and evaluation_success_second + stats = merge_execution_stats(first_stats, second_stats) + + outcome = None + text = None + + # Error in the sandbox: nothing to do! + if not box_success: + pass + + # Contestant's error: the marks won't be good + elif not evaluation_success: + outcome = 0.0 + text = human_evaluation_message(stats) + if job.get_output: + job.user_output = None + + # Otherwise, advance to checking the solution + else: + + # Check that the output file was created + if not second_sandbox.file_exists(TwoSteps2019.OUTPUT_FILENAME): + outcome = 0.0 + text = [N_("Evaluation didn't produce file %s"), + TwoSteps2019.OUTPUT_FILENAME] + if job.get_output: + job.user_output = None + + else: + # If asked so, put the output file into the storage + if job.get_output: + job.user_output = second_sandbox.get_file_to_storage( + TwoSteps2019.OUTPUT_FILENAME, + "Output file in job %s" % job.info, + trunc_len=100 * 1024) + + # If just asked to execute, fill text and set dummy outcome. + if job.only_execution: + outcome = 0.0 + text = [N_("Execution completed successfully")] + + # Otherwise evaluate the output file. + else: + box_success, outcome, text = eval_output( + file_cacher, job, + TwoSteps2019.CHECKER_CODENAME + if self._uses_checker() else None, + user_output_path=second_sandbox.relative_path( + TwoSteps2019.OUTPUT_FILENAME)) + + # Fill in the job with the results. + job.success = box_success + job.outcome = str(outcome) if outcome is not None else None + job.text = text + job.plus = stats + + delete_sandbox(first_sandbox, job.success, job.keep_sandbox) + delete_sandbox(second_sandbox, job.success, job.keep_sandbox) diff --git a/cmscontrib/loaders/tps.py b/cmscontrib/loaders/tps.py index 2fcbc96cf9..e0ff5a4c72 100644 --- a/cmscontrib/loaders/tps.py +++ b/cmscontrib/loaders/tps.py @@ -99,7 +99,7 @@ def _get_task_type_parameters(self, data, task_type, evaluation_param): task_type_parameters[par_processes] = 1 return [task_type_parameters[par_processes], "stub", "fifo_io"] - if task_type == 'TwoSteps' or task_type == 'OutputOnly': + if task_type == 'TwoSteps' or task_type == 'TwoSteps2019' or task_type == 'OutputOnly': return [evaluation_param] return [] diff --git a/setup.py b/setup.py index fdc8c6eee4..586cbae6f5 100755 --- a/setup.py +++ b/setup.py @@ -174,6 +174,7 @@ def run(self): "Communication=cms.grading.tasktypes.Communication:Communication", "OutputOnly=cms.grading.tasktypes.OutputOnly:OutputOnly", "TwoSteps=cms.grading.tasktypes.TwoSteps:TwoSteps", + "TwoSteps2019=cms.grading.tasktypes.TwoSteps2019:TwoSteps2019", ], "cms.grading.scoretypes": [ "Sum=cms.grading.scoretypes.Sum:Sum", From f1ee8185d365b24bb2c9b0545c0baaebe4a4c1be Mon Sep 17 00:00:00 2001 From: Farid Ahmadov Date: Tue, 9 Jul 2019 00:57:05 +0400 Subject: [PATCH 6/9] C++14 added --- cms/grading/languages/cpp11_gpp.py | 9 ++++ cms/grading/languages/cpp14_gpp.py | 76 ++++++++++++++++++++++++++++++ setup.py | 1 + 3 files changed, 86 insertions(+) create mode 100644 cms/grading/languages/cpp14_gpp.py diff --git a/cms/grading/languages/cpp11_gpp.py b/cms/grading/languages/cpp11_gpp.py index 298966e816..8d76d3f66f 100644 --- a/cms/grading/languages/cpp11_gpp.py +++ b/cms/grading/languages/cpp11_gpp.py @@ -61,3 +61,12 @@ def get_compilation_commands(self, "-s", "-o", executable_filename] command += source_filenames return [command] + + def get_compilation_no_link_command(self, source_filenames): + """See Language.get_compilation_no_link_command.""" + command = ["/usr/bin/g++"] + command += ["-std=c++11", "-O2", "-pipe", "-static", + "-s", "-c"] + command += source_filenames + return [command] + diff --git a/cms/grading/languages/cpp14_gpp.py b/cms/grading/languages/cpp14_gpp.py new file mode 100644 index 0000000000..6b5699ae1c --- /dev/null +++ b/cms/grading/languages/cpp14_gpp.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python2 +# -*- coding: utf-8 -*- + +# Contest Management System - http://cms-dev.github.io/ +# Copyright © 2016 Stefano Maggiolo +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +"""C++ programming language definition.""" + +from __future__ import absolute_import +from __future__ import print_function +from __future__ import unicode_literals + +from cms.grading import CompiledLanguage + + +__all__ = ["Cpp14Gpp"] + + +class Cpp14Gpp(CompiledLanguage): + """This defines the C++ programming language, compiled with g++ (the + version available on the system) using the C++11 standard. + + """ + + @property + def name(self): + """See Language.name.""" + return "C++14 / g++" + + @property + def source_extensions(self): + """See Language.source_extensions.""" + return [".cpp", ".cc", ".cxx", ".c++", ".C"] + + @property + def header_extensions(self): + """See Language.source_extensions.""" + return [".h"] + + @property + def object_extensions(self): + """See Language.source_extensions.""" + return [".o"] + + def get_compilation_commands(self, + source_filenames, executable_filename, + for_evaluation=True): + """See Language.get_compilation_commands.""" + command = ["/usr/bin/g++"] + if for_evaluation: + command += ["-DEVAL"] + command += ["-std=gnu++14", "-O2", "-pipe", "-static", + "-s", "-o", executable_filename] + command += source_filenames + return [command] + + def get_compilation_no_link_command(self, source_filenames): + """See Language.get_compilation_no_link_command.""" + command = ["/usr/bin/g++"] + command += ["-std=gnu++14", "-O2", "-pipe", "-static", + "-s", "-c"] + command += source_filenames + return [command] diff --git a/setup.py b/setup.py index 586cbae6f5..e558ef684d 100755 --- a/setup.py +++ b/setup.py @@ -184,6 +184,7 @@ def run(self): ], "cms.grading.languages": [ "C++11 / g++=cms.grading.languages.cpp11_gpp:Cpp11Gpp", + "C++14 / g++=cms.grading.languages.cpp14_gpp:Cpp14Gpp", "C11 / gcc=cms.grading.languages.c11_gcc:C11Gcc", "C# / Mono=cms.grading.languages.csharp_mono:CSharpMono", "Haskell / ghc=cms.grading.languages.haskell_ghc:HaskellGhc", From ea1c22535c84a9aedae6fc9d785d9afb943167cc Mon Sep 17 00:00:00 2001 From: System Administrator Date: Tue, 9 Jul 2019 01:46:41 +0400 Subject: [PATCH 7/9] Could not build CMS because of minor errors in az translation file --- cms/locale/az/LC_MESSAGES/cms.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cms/locale/az/LC_MESSAGES/cms.po b/cms/locale/az/LC_MESSAGES/cms.po index 85708172a1..212e62eb23 100644 --- a/cms/locale/az/LC_MESSAGES/cms.po +++ b/cms/locale/az/LC_MESSAGES/cms.po @@ -198,13 +198,13 @@ msgstr[1] "Siz %(type_s)s ilə başlayırsınız." msgid "Every minute " msgid_plural "Every %(gen_interval)g minutes " msgstr[0] "Hər dəqiqə " -msgstr[2] "Hər %(gen_interval)g dəqiqədən bir " +msgstr[1] "Hər %(gen_interval)g dəqiqədən bir " #, python-format msgid "you get another %(type_s)s, " msgid_plural "you get %(gen_number)d other %(type_pl)s, " msgstr[0] "siz daha bir %(type_s)s alırsınız," -msgstr[0] "siz əlavə %(type_s)s alırsınız," +msgstr[1] "siz əlavə %(type_s)s alırsınız," #, python-format msgid "up to a maximum of one %(type_s)s." From 668f0ebfb534dd60693d415fe81f0a82b465aadd Mon Sep 17 00:00:00 2001 From: Farid Ahmadov Date: Thu, 11 Jul 2019 04:09:44 +0400 Subject: [PATCH 8/9] Minor change to prevent 'state None' exception --- cms/grading/tasktypes/TwoSteps2019.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cms/grading/tasktypes/TwoSteps2019.py b/cms/grading/tasktypes/TwoSteps2019.py index bf7dc2bcd7..fb9703eeed 100644 --- a/cms/grading/tasktypes/TwoSteps2019.py +++ b/cms/grading/tasktypes/TwoSteps2019.py @@ -283,7 +283,9 @@ def evaluate(self, job, file_cacher): box_success = box_success_first and box_success_second evaluation_success = \ evaluation_success_first and evaluation_success_second - stats = merge_execution_stats(first_stats, second_stats) + + if first_stats and second_stats: + stats = merge_execution_stats(first_stats, second_stats) outcome = None text = None From fa736dbf7000a8b95987d44542a8105d26052cf3 Mon Sep 17 00:00:00 2001 From: Farid Ahmadov Date: Fri, 12 Jul 2019 10:05:11 +0400 Subject: [PATCH 9/9] Task type twostep2019 fixed --- cms/grading/tasktypes/TwoSteps2019.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cms/grading/tasktypes/TwoSteps2019.py b/cms/grading/tasktypes/TwoSteps2019.py index fb9703eeed..8c789b043c 100644 --- a/cms/grading/tasktypes/TwoSteps2019.py +++ b/cms/grading/tasktypes/TwoSteps2019.py @@ -210,6 +210,7 @@ def evaluate(self, job, file_cacher): if not check_executables_number(job, 1): return + language = get_language(job.language) executable_filename = next(iter(job.executables.keys())) executable_digest = job.executables[executable_filename].digest @@ -225,7 +226,7 @@ def evaluate(self, job, file_cacher): os.chmod(fifo, 0o666) # First step: we start the first manager. - first_command = ["./%s" % executable_filename, "0", "/fifo/fifo"] + first_command = language.get_evaluation_commands(executable_filename, main="grader", args=["0", "/fifo/fifo"])[0] first_executables_to_get = {executable_filename: executable_digest} first_files_to_get = { TwoSteps2019.INPUT_FILENAME: job.input @@ -250,7 +251,7 @@ def evaluate(self, job, file_cacher): wait=False) # Second step: we start the second manager. - second_command = ["./%s" % executable_filename, "1", "/fifo/fifo"] + second_command = language.get_evaluation_commands(executable_filename, main="grader", args=["1", "/fifo/fifo"])[0] second_executables_to_get = {executable_filename: executable_digest} second_files_to_get = {} @@ -283,9 +284,7 @@ def evaluate(self, job, file_cacher): box_success = box_success_first and box_success_second evaluation_success = \ evaluation_success_first and evaluation_success_second - - if first_stats and second_stats: - stats = merge_execution_stats(first_stats, second_stats) + stats = merge_execution_stats(first_stats, second_stats) if second_stats is not None else first_stats outcome = None text = None