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: 32 inserted, 1 deleted

@@ -61,4 +61,22
61 @submission = Submission.find(params[:id])
61 @submission = Submission.find(params[:id])
62 end
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'
64 end
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 +
82 + end
@@ -43,6 +43,14
43 Time.now.gmtime - GraderProcess.stalled_time])
43 Time.now.gmtime - GraderProcess.stalled_time])
44 end
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 def report_active(task=nil)
54 def report_active(task=nil)
47 self.active = true
55 self.active = true
48 if task!=nil
56 if task!=nil
@@ -15,6 +15,7
15 %tr{:class => c}
15 %tr{:class => c}
16 = render :partial => 'grader', :locals => {:grader => grader}
16 = render :partial => 'grader', :locals => {:grader => grader}
17 - if not grader.terminated
17 - if not grader.terminated
18 + - if GraderProcess.grader_control_enabled?
18 %td= link_to 'stop', {:action => 'stop', :id => grader}
19 %td= link_to 'stop', {:action => 'stop', :id => grader}
19 - else
20 - else
20 %td= link_to 'clear', {:action => 'clear', :id => grader}
21 %td= link_to 'clear', {:action => 'clear', :id => grader}
@@ -1,6 +1,6
1 - content_for :head do
1 - content_for :head do
2 = stylesheet_link_tag 'graders'
2 = stylesheet_link_tag 'graders'
3 - <meta http-equiv ="refresh" content="10"/>
3 + <meta http-equiv ="refresh" content="60"/>
4
4
5 %h1 Grader information
5 %h1 Grader information
6
6
@@ -73,6 +73,10
73
73
74 # Include your application configuration below
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 # These are where inputs and outputs of test requests are stored
80 # These are where inputs and outputs of test requests are stored
77 TEST_REQUEST_INPUT_FILE_DIR = RAILS_ROOT + '/data/test_request/input'
81 TEST_REQUEST_INPUT_FILE_DIR = RAILS_ROOT + '/data/test_request/input'
78 TEST_REQUEST_OUTPUT_FILE_DIR = RAILS_ROOT + '/data/test_request/output'
82 TEST_REQUEST_OUTPUT_FILE_DIR = RAILS_ROOT + '/data/test_request/output'
You need to be logged in to leave comments. Login now