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:
merge default
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r188:0b607f9b89c1 - - 12 files changed: 14 inserted, 400 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"
@@ -1,24 +1,24
1 1 # This file is auto-generated from the current state of the database. Instead of editing this file,
2 2 # please use the migrations feature of Active Record to incrementally modify your database, and
3 3 # then regenerate this schema definition.
4 4 #
5 5 # Note that this schema.rb definition is the authoritative source for your database schema. If you need
6 6 # to create the application database on another system, you should be using db:schema:load, not running
7 7 # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
8 8 # you'll amass, the slower it'll run and the greater likelihood for issues).
9 9 #
10 10 # It's strongly recommended to check this file into your version control system.
11 11
12 - ActiveRecord::Schema.define(:version => 20090429014554) do
12 + ActiveRecord::Schema.define(:version => 20090426131044) do
13 13
14 14 create_table "announcements", :force => true do |t|
15 15 t.string "author"
16 16 t.text "body"
17 17 t.boolean "published"
18 18 t.datetime "created_at"
19 19 t.datetime "updated_at"
20 20 t.boolean "frontpage", :default => false
21 21 t.boolean "contest_only", :default => false
22 22 end
23 23
24 24 create_table "configurations", :force => true do |t|
@@ -33,35 +33,24
33 33 t.string "name"
34 34 t.datetime "created_at"
35 35 t.datetime "updated_at"
36 36 end
37 37
38 38 create_table "descriptions", :force => true do |t|
39 39 t.text "body"
40 40 t.boolean "markdowned"
41 41 t.datetime "created_at"
42 42 t.datetime "updated_at"
43 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 45 create_table "grader_processes", :force => true do |t|
57 46 t.string "host", :limit => 20
58 47 t.integer "pid"
59 48 t.string "mode"
60 49 t.boolean "active"
61 50 t.datetime "created_at"
62 51 t.datetime "updated_at"
63 52 t.integer "task_id"
64 53 t.string "task_type"
65 54 t.boolean "terminated"
66 55 end
67 56
@@ -19,25 +19,25
19 19 end
20 20 end
21 21
22 22 def config
23 23 Grader::Configuration.get_instance
24 24 end
25 25
26 26 def log_file_name
27 27 if !File.exists?(config.log_dir)
28 28 raise "Log directory does not exist: #{config.log_dir}"
29 29 end
30 30 config.log_dir +
31 - "/#{GRADER_ENV}.#{Process.pid}"
31 + "/#{GRADER_ENV}_#{config.grader_mode}.#{Process.pid}"
32 32 end
33 33
34 34 def log(str)
35 35 if config.talkative
36 36 puts str
37 37 end
38 38 if config.logging
39 39 fp = File.open(log_file_name,"a")
40 40 fp.puts("GRADER: #{Time.new.strftime("%H:%M")} #{str}")
41 41 fp.close
42 42 end
43 43 end
@@ -93,25 +93,25
93 93
94 94 protected
95 95
96 96 def talk(str)
97 97 if @config.talkative
98 98 puts str
99 99 end
100 100 end
101 101
102 102 def call_judge(problem_home,language,grading_dir,fname)
103 103 ENV['PROBLEM_HOME'] = problem_home
104 104
105 - talk "Grading in #{grading_dir}"
105 + talk grading_dir
106 106 Dir.chdir grading_dir
107 107 cmd = "#{problem_home}/script/judge #{language} #{fname}"
108 108 talk "CMD: #{cmd}"
109 109 system(cmd)
110 110 end
111 111
112 112 def get_std_script_dir
113 113 GRADER_ROOT + '/std-script'
114 114 end
115 115
116 116 def copy_script(problem_home)
117 117 script_dir = "#{problem_home}/script"
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