Show More
Commit Description:
handle the case when problem id or submission id is null. Grader will simply skip such request. Add more report on console (for command line grading)...
Commit Description:
handle the case when problem id or submission id is null. Grader will simply skip such request. Add more report on console (for command line grading) (mercurial grafted from d233105d3965c5368c9b33125f390e39b25f910e)
File last commit:
Show/Diff file:
Action:
lib/runner.rb | 62 lines | 1.6 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.
#
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
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
Jittat Fakcharoenphol
added contest mode
r93 def grade_problem(problem, options={})
jittat
[grader] [MERGED] Merged new-arch-branch changes 74:105 into the trunk...
r23 users = User.find(:all)
users.each do |u|
puts "user: #{u.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
jittat
fixed grading wrong submission when 2 submissions created at the same time...
r68 last_sub = Submission.find_last_by_user_and_problem(u.id,problem.id)
jittat
[grader] [MERGED] Merged new-arch-branch changes 74:105 into the trunk...
r23 if last_sub!=nil
@engine.grade(last_sub)
end
end
end
jittat
[grader] +grade submission...
r61 def grade_submission(submission)
puts "Submission: #{submission.id} by #{submission.user.full_name}"
@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
@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