Browse files

Revert "passing along the notion of an 'owner' from job to work unit."

This reverts commit 243ed53.
  • Loading branch information...
1 parent 243ed53 commit 0b1322002f80f8abb355b72ce56c4d4959e08124 @jashkenas jashkenas committed Feb 17, 2011
Showing with 9 additions and 13 deletions.
  1. +7 −8 lib/cloud_crowd/models/job.rb
  2. +2 −3 lib/cloud_crowd/models/work_unit.rb
  3. +0 −2 lib/cloud_crowd/schema.rb
View
15 lib/cloud_crowd/models/job.rb
@@ -21,14 +21,13 @@ class Job < ActiveRecord::Base
named_scope :older_than, lambda {|num| {:conditions => ['updated_at < ?', num.days.ago]} }
# Create a Job from an incoming JSON request, and add it to the queue.
- def self.create_from_request(data)
+ def self.create_from_request(h)
self.create(
- :inputs => data['inputs'].to_json,
- :action => data['action'],
- :owner => data['owner'],
- :options => (data['options'] || {}).to_json,
- :email => data['email'],
- :callback_url => data['callback_url']
+ :inputs => h['inputs'].to_json,
+ :action => h['action'],
+ :options => (h['options'] || {}).to_json,
+ :email => h['email'],
+ :callback_url => h['callback_url']
)
end
@@ -179,7 +178,7 @@ def gather_outputs_from_work_units
# away.
def queue_for_workers(input=nil)
input ||= JSON.parse(self.inputs)
- input.each {|i| WorkUnit.start(self, i) }
+ input.each {|i| WorkUnit.start(self, action, i, status) }
self
end
View
5 lib/cloud_crowd/models/work_unit.rb
@@ -105,10 +105,9 @@ def self.find_by_worker_name(name)
end
# Convenience method for starting a new WorkUnit.
- def self.start(job, input)
+ def self.start(job, action, input, status)
input = input.to_json unless input.is_a? String
- self.create(:job => job, :action => job.action, :owner => job.owner,
- :status => job.status, :input => input)
+ self.create(:job => job, :action => action, :input => input, :status => status)
end
# Mark this unit as having finished successfully.
View
2 lib/cloud_crowd/schema.rb
@@ -5,7 +5,6 @@
t.integer "status", :null => false
t.text "inputs", :null => false
t.string "action", :null => false
- t.string "owner"
t.text "options", :null => false
t.text "outputs"
t.float "time"
@@ -32,7 +31,6 @@
t.integer "job_id", :null => false
t.text "input", :null => false
t.string "action", :null => false
- t.string "owner"
t.integer "attempts", :default => 0, :null => false
t.integer "node_record_id"
t.integer "worker_pid"

0 comments on commit 0b13220

Please sign in to comment.