Description:
copy working trunk (r383, before major changes to combine judge and to support grader message queue) to trunk
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@396 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
r188:0b607f9b89c1 - - 12 files changed: 15 inserted, 401 deleted
@@ -0,0 +1,10 | |||||
|
|
1 | + # Rails app directory | ||
|
|
2 | + RAILS_ROOT = "/home/jittat/web_grader" | ||
|
|
3 | + | ||
|
|
4 | + GRADER_ROOT = "/home/jittat/grader/scripts" | ||
|
|
5 | + | ||
|
|
6 | + # This load all required codes | ||
|
|
7 | + require File.join(File.dirname(__FILE__),'../lib/boot') | ||
|
|
8 | + | ||
|
|
9 | + # load the required environment file | ||
|
|
10 | + require File.dirname(__FILE__) + "/env_#{GRADER_ENV}.rb" |
@@ -6,13 +6,13 | |||||
|
6 | # to create the application database on another system, you should be using db:schema:load, not running |
|
6 | # to create the application database on another system, you should be using db:schema:load, not running |
|
7 | # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations |
|
7 | # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations |
|
8 | # you'll amass, the slower it'll run and the greater likelihood for issues). |
|
8 | # you'll amass, the slower it'll run and the greater likelihood for issues). |
|
9 | # |
|
9 | # |
|
10 | # It's strongly recommended to check this file into your version control system. |
|
10 | # It's strongly recommended to check this file into your version control system. |
|
11 |
|
11 | ||
|
12 |
- ActiveRecord::Schema.define(:version => 2009042 |
|
12 | + ActiveRecord::Schema.define(:version => 20090426131044) do |
|
13 |
|
13 | ||
|
14 | create_table "announcements", :force => true do |t| |
|
14 | create_table "announcements", :force => true do |t| |
|
15 | t.string "author" |
|
15 | t.string "author" |
|
16 | t.text "body" |
|
16 | t.text "body" |
|
17 | t.boolean "published" |
|
17 | t.boolean "published" |
|
18 | t.datetime "created_at" |
|
18 | t.datetime "created_at" |
@@ -39,23 +39,12 | |||||
|
39 | t.text "body" |
|
39 | t.text "body" |
|
40 | t.boolean "markdowned" |
|
40 | t.boolean "markdowned" |
|
41 | t.datetime "created_at" |
|
41 | t.datetime "created_at" |
|
42 | t.datetime "updated_at" |
|
42 | t.datetime "updated_at" |
|
43 | end |
|
43 | end |
|
44 |
|
44 | ||
|
45 | - create_table "grader_messages", :force => true do |t| |
|
||
|
46 | - t.integer "grader_process_id" |
|
||
|
47 | - t.integer "command" |
|
||
|
48 | - t.string "options" |
|
||
|
49 | - t.integer "target_id" |
|
||
|
50 | - t.boolean "taken" |
|
||
|
51 | - t.integer "taken_grader_process_id" |
|
||
|
52 | - t.datetime "created_at" |
|
||
|
53 | - t.datetime "updated_at" |
|
||
|
54 | - end |
|
||
|
55 | - |
|
||
|
56 | create_table "grader_processes", :force => true do |t| |
|
45 | create_table "grader_processes", :force => true do |t| |
|
57 | t.string "host", :limit => 20 |
|
46 | t.string "host", :limit => 20 |
|
58 | t.integer "pid" |
|
47 | t.integer "pid" |
|
59 | t.string "mode" |
|
48 | t.string "mode" |
|
60 | t.boolean "active" |
|
49 | t.boolean "active" |
|
61 | t.datetime "created_at" |
|
50 | t.datetime "created_at" |
@@ -25,13 +25,13 | |||||
|
25 |
|
25 | ||
|
26 | def log_file_name |
|
26 | def log_file_name |
|
27 | if !File.exists?(config.log_dir) |
|
27 | if !File.exists?(config.log_dir) |
|
28 | raise "Log directory does not exist: #{config.log_dir}" |
|
28 | raise "Log directory does not exist: #{config.log_dir}" |
|
29 | end |
|
29 | end |
|
30 | config.log_dir + |
|
30 | config.log_dir + |
|
31 | - "/#{GRADER_ENV}.#{Process.pid}" |
|
31 | + "/#{GRADER_ENV}_#{config.grader_mode}.#{Process.pid}" |
|
32 | end |
|
32 | end |
|
33 |
|
33 | ||
|
34 | def log(str) |
|
34 | def log(str) |
|
35 | if config.talkative |
|
35 | if config.talkative |
|
36 | puts str |
|
36 | puts str |
|
37 | end |
|
37 | end |
@@ -68,13 +68,13 | |||||
|
68 | dinit = DirInit::Manager.new(problem_home) |
|
68 | dinit = DirInit::Manager.new(problem_home) |
|
69 |
|
69 | ||
|
70 | dinit.setup do |
|
70 | dinit.setup do |
|
71 | copy_log = copy_script(problem_home) |
|
71 | copy_log = copy_script(problem_home) |
|
72 | save_copy_log(problem_home,copy_log) |
|
72 | save_copy_log(problem_home,copy_log) |
|
73 | end |
|
73 | end |
|
74 | - |
|
74 | + |
|
75 | call_judge(problem_home,language,grading_dir,source_name) |
|
75 | call_judge(problem_home,language,grading_dir,source_name) |
|
76 |
|
76 | ||
|
77 | @reporter.report(submission,"#{grading_dir}/test-result") |
|
77 | @reporter.report(submission,"#{grading_dir}/test-result") |
|
78 |
|
78 | ||
|
79 | dinit.teardown do |
|
79 | dinit.teardown do |
|
80 | copy_log = load_copy_log(problem_home) |
|
80 | copy_log = load_copy_log(problem_home) |
@@ -99,13 +99,13 | |||||
|
99 | end |
|
99 | end |
|
100 | end |
|
100 | end |
|
101 |
|
101 | ||
|
102 | def call_judge(problem_home,language,grading_dir,fname) |
|
102 | def call_judge(problem_home,language,grading_dir,fname) |
|
103 | ENV['PROBLEM_HOME'] = problem_home |
|
103 | ENV['PROBLEM_HOME'] = problem_home |
|
104 |
|
104 | ||
|
105 |
- talk |
|
105 | + talk grading_dir |
|
106 | Dir.chdir grading_dir |
|
106 | Dir.chdir grading_dir |
|
107 | cmd = "#{problem_home}/script/judge #{language} #{fname}" |
|
107 | cmd = "#{problem_home}/script/judge #{language} #{fname}" |
|
108 | talk "CMD: #{cmd}" |
|
108 | talk "CMD: #{cmd}" |
|
109 | system(cmd) |
|
109 | system(cmd) |
|
110 | end |
|
110 | end |
|
111 |
|
111 |
deleted file |
deleted file |
deleted file |
deleted file |
deleted file |
deleted file |
deleted file |
You need to be logged in to leave comments.
Login now