Description:
added first grader script calls from web (to stop grader) git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@433 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r202:75463b4f3803 - - 5 files changed: 33 inserted, 2 deleted

@@ -61,4 +61,22
61 61 @submission = Submission.find(params[:id])
62 62 end
63 63
64 + # various grader controls
65 +
66 + def stop
67 + grader_proc = GraderProcess.find(params[:id])
68 + stop_grader(grader_proc.pid)
69 + redirect_to :action => 'list'
70 + end
71 +
72 +
73 + protected
74 +
75 + def stop_grader(pid)
76 + if GraderProcess.grader_control_enabled?
77 + cmd = "#{GRADER_SCRIPT_DIR}/grader stop #{pid}"
78 + system(cmd)
79 + end
80 + end
81 +
64 82 end
@@ -43,6 +43,14
43 43 Time.now.gmtime - GraderProcess.stalled_time])
44 44 end
45 45
46 + def self.grader_control_enabled?
47 + if defined? GRADER_SCRIPT_DIR
48 + GRADER_SCRIPT_DIR != ''
49 + else
50 + false
51 + end
52 + end
53 +
46 54 def report_active(task=nil)
47 55 self.active = true
48 56 if task!=nil
@@ -15,7 +15,8
15 15 %tr{:class => c}
16 16 = render :partial => 'grader', :locals => {:grader => grader}
17 17 - if not grader.terminated
18 - %td= link_to 'stop', {:action => 'stop', :id => grader}
18 + - if GraderProcess.grader_control_enabled?
19 + %td= link_to 'stop', {:action => 'stop', :id => grader}
19 20 - else
20 21 %td= link_to 'clear', {:action => 'clear', :id => grader}
21 22 - else
@@ -1,6 +1,6
1 1 - content_for :head do
2 2 = stylesheet_link_tag 'graders'
3 - <meta http-equiv ="refresh" content="10"/>
3 + <meta http-equiv ="refresh" content="60"/>
4 4
5 5 %h1 Grader information
6 6
@@ -73,6 +73,10
73 73
74 74 # Include your application configuration below
75 75
76 + # If you want to manage graders through web interface, set the path to
77 + # script directory below
78 + GRADER_SCRIPT_DIR = ''
79 +
76 80 # These are where inputs and outputs of test requests are stored
77 81 TEST_REQUEST_INPUT_FILE_DIR = RAILS_ROOT + '/data/test_request/input'
78 82 TEST_REQUEST_OUTPUT_FILE_DIR = RAILS_ROOT + '/data/test_request/output'
You need to be logged in to leave comments. Login now