Permalink
Browse files

Merge pull request #137 from BuddhaOhneHals/master

Added new job status "Running"
  • Loading branch information...
2 parents c0df77f + 881b944 commit 221dd8a0045ceff2e08161f3aa348466c63de47d @nvie nvie committed Sep 7, 2012
Showing with 8 additions and 1 deletion.
  1. +6 −1 rq/job.py
  2. +2 −0 rq/worker.py
View
@@ -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 @@ def is_queued(self):
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
View
@@ -320,6 +320,8 @@ def work(self, burst=False): # noqa
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))

0 comments on commit 221dd8a

Please sign in to comment.