class Orvos::V1::JobsController < ApplicationController
+ accept_attribute_as_json :command_parameters, Hash
+ accept_attribute_as_json :resource_limits, Hash
+ accept_attribute_as_json :tasks_summary, Hash
end
include KindAndEtag
include CommonApiTemplate
serialize :command_parameters, Hash
+ serialize :resource_limits, Hash
serialize :tasks_summary, Hash
before_create :ensure_unique_submit_id
--- /dev/null
+class AddResourceLimitsToJobs < ActiveRecord::Migration
+ def change
+ add_column :jobs, :resource_limits, :text
+ end
+end
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130315213205) do
+ActiveRecord::Schema.define(:version => 20130318002138) do
create_table "api_client_authorizations", :force => true do |t|
t.string "api_token", :null => false
t.string "is_locked_by"
t.string "log"
t.text "tasks_summary"
+ t.text "resource_limits"
end
add_index "jobs", ["command"], :name => "index_jobs_on_command"
def refresh_todo
@todo = Job.
- where('started_at is ? and is_locked_by is ?', nil, nil).
+ where('started_at is ? and is_locked_by is ? and cancelled_at is ?',
+ nil, nil, nil).
order('priority desc, created_at')
end
cmd_args << "#{k}=#{v}"
end
cmd_args << "revision=#{job.command_version}"
+
+ begin
+ cmd_args << "stepspernode=#{job.resource_limits['max_tasks_per_node'].to_i}"
+ rescue
+ # OK if limit is not specified. OK to ignore if not integer.
+ end
+
+ $stderr.puts "dispatch: #{cmd_args.join ' '}"
+
begin
i, o, e, t = Open3.popen3(*cmd_args)
rescue