lib/gush/workflow.rb in gush-0.1.2 vs lib/gush/workflow.rb in gush-0.2.0
- old
+ new
@@ -68,12 +68,16 @@
def finished?
jobs.all?(&:finished?)
end
+ def started?
+ @stopped == false
+ end
+
def running?
- !stopped? && jobs.any? {|j| j.enqueued? || j.running? }
+ !finished?
end
def failed?
jobs.any?(&:failed?)
end
@@ -120,11 +124,11 @@
when finished?
:finished
when stopped?
:stopped
else
- :pending
+ :running
end
end
def started_at
first_job ? first_job.started_at : nil
@@ -172,9 +176,9 @@
def first_job
jobs.min_by{ |n| n.started_at || Time.now.to_i }
end
def last_job
- jobs.max_by{ |n| n.finished_at || 0 } if jobs.all?(&:finished?)
+ jobs.max_by{ |n| n.finished_at || 0 } if finished?
end
end
end