Description:
add --only-error to grader script
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r240:700050c502ba - - 5 files changed: 17 inserted, 8 deleted
@@ -54,13 +54,14 | |||||
|
54 | queue: repeatedly check the task queue and grade any available tasks |
|
54 | queue: repeatedly check the task queue and grade any available tasks |
|
55 |
|
55 | ||
|
56 | prob: re-grade every user latest submission of the specific problem. |
|
56 | prob: re-grade every user latest submission of the specific problem. |
|
57 | the problem name must be specified by the next argument. |
|
57 | the problem name must be specified by the next argument. |
|
58 |
|
58 | ||
|
59 | additional options: |
|
59 | additional options: |
|
60 | - --all-sub re-grade every submissions instead of just the latest submission of each user. |
|
60 | + --all-sub re-grade every submissions instead of just the latest submission of each user. |
|
|
61 | + --only-error re-grade only submissions that are "error during grading" | ||
|
61 |
|
62 | ||
|
62 | sub: re-grader the specified submission. |
|
63 | sub: re-grader the specified submission. |
|
63 | The submission ID to be re-graded must be specified by the next argument. |
|
64 | The submission ID to be re-graded must be specified by the next argument. |
|
64 |
|
65 | ||
|
65 | options: |
|
66 | options: |
|
66 | --err-log log error to a file in the log dir |
|
67 | --err-log log error to a file in the log dir |
@@ -133,12 +134,13 | |||||
|
133 | if options[:report] and (not ['prob','contest','autonew'].include? options[:mode]) |
|
134 | if options[:report] and (not ['prob','contest','autonew'].include? options[:mode]) |
|
134 | puts "Report currently works only for 'prob' or 'contest' modes." |
|
135 | puts "Report currently works only for 'prob' or 'contest' modes." |
|
135 | exit(0) |
|
136 | exit(0) |
|
136 | end |
|
137 | end |
|
137 |
|
138 | ||
|
138 | options[:all_sub] = (ARGV.delete('--all-sub') != nil) |
|
139 | options[:all_sub] = (ARGV.delete('--all-sub') != nil) |
|
|
140 | + options[:only_err] = (ARGV.delete('--only-error') != nil) | ||
|
139 |
|
141 | ||
|
140 | options[:err_log] = (ARGV.delete('--err-log') != nil) |
|
142 | options[:err_log] = (ARGV.delete('--err-log') != nil) |
|
141 |
|
143 | ||
|
142 | return options |
|
144 | return options |
|
143 | end |
|
145 | end |
|
144 |
|
146 |
@@ -1,6 +1,7 | |||||
|
1 | #!/bin/bash |
|
1 | #!/bin/bash |
|
2 |
- count=`ps aux | grep " |
|
2 | + count=`ps aux | grep "algo_grader" | grep "grader grading queue" | wc -l` |
|
3 | if [ $count -lt 1 ]; then |
|
3 | if [ $count -lt 1 ]; then |
|
4 |
- cd /home/dae/ |
|
4 | + cd /home/dae/algo_grader/judge |
|
5 |
- /home/dae/.rvm/wrappers/ruby-2.3.0/ruby /home/dae/ |
|
5 | + /home/dae/.rvm/wrappers/ruby-2.3.0/ruby /home/dae/algo_grader/judge/scripts/grader grading queue > /home/dae/grading.log & |
|
6 | fi |
|
6 | fi |
|
|
7 | + |
@@ -22,26 +22,30 | |||||
|
22 | @grader_process.report_inactive(task) if @grader_process!=nil |
|
22 | @grader_process.report_inactive(task) if @grader_process!=nil |
|
23 | end |
|
23 | end |
|
24 | return task |
|
24 | return task |
|
25 | end |
|
25 | end |
|
26 |
|
26 | ||
|
27 | def grade_problem(problem, options={}) |
|
27 | def grade_problem(problem, options={}) |
|
|
28 | + user_index = 0 | ||
|
|
29 | + user_count = User.count | ||
|
28 | User.find_each do |u| |
|
30 | User.find_each do |u| |
|
29 | - puts "user: #{u.login}" |
|
31 | + puts "user: #{u.login} (#{user_index}/#{user_count})" |
|
|
32 | + user_index += 1 | ||
|
30 | if options[:user_conditions]!=nil |
|
33 | if options[:user_conditions]!=nil |
|
31 | con_proc = options[:user_conditions] |
|
34 | con_proc = options[:user_conditions] |
|
32 | next if not con_proc.call(u) |
|
35 | next if not con_proc.call(u) |
|
33 | end |
|
36 | end |
|
34 | if options[:all_sub] |
|
37 | if options[:all_sub] |
|
35 | Submission.where(user_id: u.id,problem_id: problem.id).find_each do |sub| |
|
38 | Submission.where(user_id: u.id,problem_id: problem.id).find_each do |sub| |
|
|
39 | + next if options[:only_err] and sub.grader_comment != 'error during grading' | ||
|
36 | @engine.grade(sub) |
|
40 | @engine.grade(sub) |
|
37 | end |
|
41 | end |
|
38 | else |
|
42 | else |
|
39 | last_sub = Submission.find_last_by_user_and_problem(u.id,problem.id) |
|
43 | last_sub = Submission.find_last_by_user_and_problem(u.id,problem.id) |
|
40 | if last_sub!=nil |
|
44 | if last_sub!=nil |
|
41 | - @engine.grade(last_sub) |
|
45 | + @engine.grade(last_sub) unless options[:only_err] and last_sub.grader_comment != 'error during grading' |
|
42 | end |
|
46 | end |
|
43 | end |
|
47 | end |
|
44 | end |
|
48 | end |
|
45 | end |
|
49 | end |
|
46 |
|
50 | ||
|
47 | def grade_submission(submission) |
|
51 | def grade_submission(submission) |
@@ -137,13 +137,15 | |||||
|
137 | elsif result[:comment].chomp =~ /^[\[\]P]+$/ |
|
137 | elsif result[:comment].chomp =~ /^[\[\]P]+$/ |
|
138 | submission.grader_comment = 'PASSED: ' + comment + '(inconsistent score)' |
|
138 | submission.grader_comment = 'PASSED: ' + comment + '(inconsistent score)' |
|
139 | else |
|
139 | else |
|
140 | #submission.grader_comment = 'FAILED: ' + comment |
|
140 | #submission.grader_comment = 'FAILED: ' + comment |
|
141 | submission.grader_comment = comment |
|
141 | submission.grader_comment = comment |
|
142 | end |
|
142 | end |
|
143 | - submission.compiler_message = result[:cmp_msg] or '' |
|
143 | + |
|
|
144 | + #very lazy trim the string | ||
|
|
145 | + submission.compiler_message = result[:cmp_msg][0..60000] or '' | ||
|
144 |
|
146 | ||
|
145 | if not @dry_run |
|
147 | if not @dry_run |
|
146 | submission.save |
|
148 | submission.save |
|
147 | end |
|
149 | end |
|
148 | end |
|
150 | end |
|
149 |
|
151 |
@@ -88,13 +88,13 | |||||
|
88 |
|
88 | ||
|
89 | # Run the program. |
|
89 | # Run the program. |
|
90 | #run_command = "/usr/bin/time -f \"#{time_output_format}\" 2>run_result #{problem_home}/script/box_new -a 2 -f -t #{time_limit} -m #{mem_limit} -i #{input_file_name} -o output.txt #{program_name}" |
|
90 | #run_command = "/usr/bin/time -f \"#{time_output_format}\" 2>run_result #{problem_home}/script/box_new -a 2 -f -t #{time_limit} -m #{mem_limit} -i #{input_file_name} -o output.txt #{program_name}" |
|
91 | # |
|
91 | # |
|
92 |
|
92 | ||
|
93 | JAVA_OPTION = "-s set_robust_list -s futex -s clone -s getppid -s clone -s wait4 -p /usr/bin/ -p ./" |
|
93 | JAVA_OPTION = "-s set_robust_list -s futex -s clone -s getppid -s clone -s wait4 -p /usr/bin/ -p ./" |
|
94 | - RUBY_OPTION = "-p /usr/lib64/ -p /usr/local/lib64/ -p /usr/local/lib/ -p /lib64/ -p /dev/urandom -p #{sandbox_dir}/#{program_name} -p #{sandbox_dir}/ -s set_robust_list -s sched_getaffinity -s clock_gettime -s sigaltstack -s pipe2 -s clone -s futex -s openat -s pipe" |
|
94 | + RUBY_OPTION = "-p /usr/lib64/ -p /usr/local/lib64/ -p /usr/local/lib/ -p /lib64/ -p /dev/urandom -p #{sandbox_dir}/#{program_name} -p #{sandbox_dir}/ -s set_robust_list -s sched_getaffinity -s clock_gettime -s sigaltstack -s pipe2 -s clone -s futex -s openat -s pipe -s getrandom" |
|
95 | PYTHON_OPTION = "-p /usr/lib64/ -p /usr/local/lib64/ -p /usr/local/lib/ -p /usr/bin/ -p /lib64/ -p /dev/urandom -p /usr/ -p #{sandbox_dir}/#{program_name} -p ./#{program_name} -p #{sandbox_dir}/#{source_name} -p /proc/sys/crypto/fips_enabled -p /proc/self/status -p /proc/mounts -p /var/lib/dpkg/status -s statfs -s set_robust_list -s openat -s sysinfo -s recvmsg -s connect -s socket -s sendto -s futex -s sigaltstack -s getrandom -E PYTHONNOUSERSITE=yes" |
|
95 | PYTHON_OPTION = "-p /usr/lib64/ -p /usr/local/lib64/ -p /usr/local/lib/ -p /usr/bin/ -p /lib64/ -p /dev/urandom -p /usr/ -p #{sandbox_dir}/#{program_name} -p ./#{program_name} -p #{sandbox_dir}/#{source_name} -p /proc/sys/crypto/fips_enabled -p /proc/self/status -p /proc/mounts -p /var/lib/dpkg/status -s statfs -s set_robust_list -s openat -s sysinfo -s recvmsg -s connect -s socket -s sendto -s futex -s sigaltstack -s getrandom -E PYTHONNOUSERSITE=yes" |
|
96 | PHP_OPTION = "-p /usr/lib64/ -p/lib64/ -p /usr/bin/ -p #{sandbox_dir}/#{program_name} -p ./#{program_name} -p /usr/share/ -s setfsuid -s setfsgid -s openat -s set_robust_list -s futex -s clone -s socket -s connect" |
|
96 | PHP_OPTION = "-p /usr/lib64/ -p/lib64/ -p /usr/bin/ -p #{sandbox_dir}/#{program_name} -p ./#{program_name} -p /usr/share/ -s setfsuid -s setfsgid -s openat -s set_robust_list -s futex -s clone -s socket -s connect" |
|
97 | HASKELL_OPTION = "-s set_robust_list -s clock_gettime -s sysinfo -s timer_create -s timer_settime -s futex -s timer_delete" |
|
97 | HASKELL_OPTION = "-s set_robust_list -s clock_gettime -s sysinfo -s timer_create -s timer_settime -s futex -s timer_delete" |
|
98 |
|
98 | ||
|
99 | case language |
|
99 | case language |
|
100 | when "java" |
|
100 | when "java" |
You need to be logged in to leave comments.
Login now