Description:
[grader] better status report
git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@255 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r59:4713602cf208 - - 1 file changed: 6 inserted, 3 deleted
@@ -10,48 +10,51 | |||
|
10 | 10 | @engine = engine |
|
11 | 11 | @grader_process = grader_process |
|
12 | 12 | end |
|
13 | 13 | |
|
14 | 14 | def grade_oldest_task |
|
15 | 15 | task = Task.get_inqueue_and_change_status(Task::STATUS_GRADING) |
|
16 | 16 | if task!=nil |
|
17 | 17 | @grader_process.report_active(task) if @grader_process!=nil |
|
18 | 18 | |
|
19 | 19 | submission = Submission.find(task.submission_id) |
|
20 | 20 | @engine.grade(submission) |
|
21 | 21 | task.status_complete! |
|
22 | + @grader_process.report_inactive(task) if @grader_process!=nil | |
|
23 | + else | |
|
24 | + @grader_process.report_inactive if @grader_process!=nil | |
|
22 | 25 | end |
|
23 | - # @grader_process.report_inactive if @grader_process!=nil | |
|
24 | 26 | return task |
|
25 | 27 | end |
|
26 | 28 | |
|
27 | 29 | def grade_problem(problem) |
|
28 | 30 | users = User.find(:all) |
|
29 | 31 | users.each do |u| |
|
30 | 32 | puts "user: #{u.login}" |
|
31 | 33 | last_sub = Submission.find(:first, |
|
32 | 34 | :conditions => "user_id = #{u.id} and " + |
|
33 | 35 | "problem_id = #{problem.id}", |
|
34 | 36 | :order => 'submitted_at DESC') |
|
35 | 37 | if last_sub!=nil |
|
36 | 38 | @engine.grade(last_sub) |
|
37 | 39 | end |
|
38 | 40 | end |
|
39 | 41 | end |
|
40 | 42 | |
|
41 | 43 | def grade_oldest_test_request |
|
42 | 44 | test_request = TestRequest.get_inqueue_and_change_status(Task::STATUS_GRADING) |
|
43 | 45 | if test_request!=nil |
|
44 | 46 | @grader_process.report_active(test_request) if @grader_process!=nil |
|
45 | 47 | |
|
46 | 48 | @engine.grade(test_request) |
|
47 | 49 | test_request.status_complete! |
|
50 | + @grader_process.report_inactive(test_request) if @grader_process!=nil | |
|
51 | + else | |
|
52 | + @grader_process.report_inactive if @grader_process!=nil | |
|
48 | 53 | end |
|
49 | - | |
|
50 | - # @grader_process.report_inactive if @grader_process!=nil | |
|
51 | 54 | return test_request |
|
52 | 55 | end |
|
53 | 56 | |
|
54 | 57 | end |
|
55 | 58 | |
|
56 | 59 | end |
|
57 | 60 |
You need to be logged in to leave comments.
Login now