Show More
Commit Description:
better all sub progres report
Commit Description:
better all sub progres report
File last commit:
Show/Diff file:
Action:
lib/runner.rb | 74 lines | 2.3 KiB | text/x-ruby | RubyLexer |
jittat
[grader] [MERGED] Merged new-arch-branch changes 74:105 into the trunk...
r23 #
# A runner drives the engine into various tasks.
- add isolate...
r256 #
jittat
[grader] [MERGED] Merged new-arch-branch changes 74:105 into the trunk...
r23
module Grader
class Runner
def initialize(engine, grader_process=nil)
@engine = engine
@grader_process = grader_process
end
def grade_oldest_task
task = Task.get_inqueue_and_change_status(Task::STATUS_GRADING)
if task!=nil
@grader_process.report_active(task) if @grader_process!=nil
- add isolate...
r256
jittat
[grader] [MERGED] Merged new-arch-branch changes 74:105 into the trunk...
r23 submission = Submission.find(task.submission_id)
@engine.grade(submission)
task.status_complete!
jittat
[grader] better status report...
r59 @grader_process.report_inactive(task) if @grader_process!=nil
jittat
[grader] [MERGED] Merged new-arch-branch changes 74:105 into the trunk...
r23 end
return task
end
- new install script...
r254 # grade a specified problem for the latest submission of each user
# optionally, on all submission when options[:all_sub] is set
# optionally, only submission that has error (use when the problem itself has some problem)
Jittat Fakcharoenphol
added contest mode
r93 def grade_problem(problem, options={})
better all sub progres report
r271 if options[:all_sub]
subs = problem.submissions
else
max_sql = problem.submissions.group('user_id')
.select('user_id','max(submissions.id) as max_sub_id').to_sql
subs = problem.submissions.joins("INNER JOIN (#{max_sql}) max_tbl " +
"ON submissions.user_id = max_tbl.user_id " +
" AND submissions.id = max_tbl.max_sub_id")
end
count = subs.count
subs.each.with_index do |sub,idx|
puts "progres: #{idx+1}/#{count} sub: ##{sub.id} user: #{sub.user&.login}"
Jittat Fakcharoenphol
added contest mode
r93 if options[:user_conditions]!=nil
con_proc = options[:user_conditions]
next if not con_proc.call(u)
end
better all sub progres report
r271 next if options[:only_err] and sub.grader_comment != 'error during grading'
@engine.grade(sub)
jittat
[grader] [MERGED] Merged new-arch-branch changes 74:105 into the trunk...
r23 end
better all sub progres report
r271
jittat
[grader] [MERGED] Merged new-arch-branch changes 74:105 into the trunk...
r23 end
jittat
[grader] +grade submission...
r61 def grade_submission(submission)
- add isolate...
r256 puts "RUNNER: grade submission: #{submission.id} by #{submission.try(:user).try(:full_name)}"
jittat
[grader] +grade submission...
r61 @engine.grade(submission)
end
jittat
[grader] [MERGED] Merged new-arch-branch changes 74:105 into the trunk...
r23 def grade_oldest_test_request
test_request = TestRequest.get_inqueue_and_change_status(Task::STATUS_GRADING)
if test_request!=nil
@grader_process.report_active(test_request) if @grader_process!=nil
- add isolate...
r256
jittat
[grader] [MERGED] Merged new-arch-branch changes 74:105 into the trunk...
r23 @engine.grade(test_request)
test_request.status_complete!
jittat
[grader] better status report...
r59 @grader_process.report_inactive(test_request) if @grader_process!=nil
jittat
[grader] [MERGED] Merged new-arch-branch changes 74:105 into the trunk...
r23 end
return test_request
end
end
end