Skip to content

Commit

Permalink
Revert "passing along the notion of an 'owner' from job to work unit."
Browse files Browse the repository at this point in the history
This reverts commit 243ed53.
  • Loading branch information
jashkenas committed Feb 17, 2011
1 parent 243ed53 commit 0b13220
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
15 changes: 7 additions & 8 deletions lib/cloud_crowd/models/job.rb
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions lib/cloud_crowd/models/work_unit.rb
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions lib/cloud_crowd/schema.rb
Expand Up @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit 0b13220

Please sign in to comment.