diff --git a/rq/job.py b/rq/job.py index a417cc4..89ab015 100644 --- a/rq/job.py +++ b/rq/job.py @@ -13,7 +13,8 @@ def enum(name, *sequential, **named): values = dict(zip(sequential, range(len(sequential))), **named) return type(name, (), values) -Status = enum('Status', QUEUED='queued', FINISHED='finished', FAILED='failed') +Status = enum('Status', QUEUED='queued', FINISHED='finished', FAILED='failed', + STARTED='started') def unpickle(pickled_string): @@ -105,6 +106,10 @@ class Job(object): def is_failed(self): return self.status == Status.FAILED + @property + def is_started(self): + return self.status == Status.STARTED + @property def func(self): func_name = self.func_name diff --git a/rq/worker.py b/rq/worker.py index c936262..15849cb 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -320,6 +320,8 @@ class Worker(object): self.state = 'busy' job, queue = result + # Use the public setter here, to immediately update Redis + job.status = Status.STARTED self.log.info('%s: %s (%s)' % (green(queue.name), blue(job.description), job.id))