lib/pallets/workflow.rb in pallets-0.2.0 vs lib/pallets/workflow.rb in pallets-0.3.0
- old
+ new
@@ -8,11 +8,14 @@
@id = nil
@context = context
end
def run
- backend.run_workflow(id, jobs_with_order)
+ raise WorkflowError, "#{self.class.name} has no tasks. Workflows "\
+ "must contain at least one task" if self.class.graph.empty?
+
+ backend.run_workflow(id, jobs_with_order, context)
id
end
def id
@id ||= begin
@@ -31,12 +34,12 @@
end
end
def job_hash
{
- 'workflow_id' => id,
- 'context' => context,
- 'created_at' => Time.now.to_f
+ 'workflow_id' => id,
+ 'workflow_class_name' => self.class.name,
+ 'created_at' => Time.now.to_f
}
end
def backend
Pallets.backend