# HG changeset patch # User jittat # Date 2008-05-11 13:26:20 # Node ID 3dcc15f24294757ec788a37d4ddad57f36a6df1b # Parent 3eee9b559221784a46e46a39037e393a5f992be8 [grader] +grade submission git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@264 6386c4cd-e34a-4fa8-8920-d93eb39b512e diff --git a/grader b/grader --- a/grader +++ b/grader @@ -179,6 +179,29 @@ end end +when "sub" + engine = Grader::Engine.new + runner = Grader::Runner.new(engine, grader_proc) + + grader_proc.report_active if grader_proc!=nil + + ARGV.shift + ARGV.shift + + ARGV.each do |sub_id| + puts "Grading #{sub_id}" + begin + submission = Submission.find(sub_id.to_i) + rescue ActiveRecord::RecordNotFound + puts "Record not found" + submission = nil + end + + if submission!=nil + runner.grade_submission(submission) + end + end + else display_manual exit(0) diff --git a/lib/runner.rb b/lib/runner.rb --- a/lib/runner.rb +++ b/lib/runner.rb @@ -38,6 +38,11 @@ end end + def grade_submission(submission) + puts "Submission: #{submission.id} by #{submission.user.full_name}" + @engine.grade(submission) + end + def grade_oldest_test_request test_request = TestRequest.get_inqueue_and_change_status(Task::STATUS_GRADING) if test_request!=nil diff --git a/std-script/judge b/std-script/judge --- a/std-script/judge +++ b/std-script/judge @@ -103,6 +103,10 @@ # Doing the testing. (1..(problem.num_tests)).each do |test_num| + + $stdout.print "[#{test_num}]" + $stdout.flush + log "Test number: #{test_num}" execute("cp #{test_result_dir}/a.out #{sandbox_dir}", "Cannot copy the compiled program into #{sandbox_dir}") begin @@ -117,6 +121,8 @@ execute("rm -Rf #{sandbox_dir}/*", "Cannot clear #{sandbox_dir}") end +$stdout.print "[done]\n" + # Grade log log "Grading..."