Merge pull request #137 from BuddhaOhneHals/master

Added new job status "Running"
main
Vincent Driessen 12 years ago
commit 221dd8a004

@ -13,7 +13,8 @@ def enum(name, *sequential, **named):
values = dict(zip(sequential, range(len(sequential))), **named) values = dict(zip(sequential, range(len(sequential))), **named)
return type(name, (), values) 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): def unpickle(pickled_string):
@ -105,6 +106,10 @@ class Job(object):
def is_failed(self): def is_failed(self):
return self.status == Status.FAILED return self.status == Status.FAILED
@property
def is_started(self):
return self.status == Status.STARTED
@property @property
def func(self): def func(self):
func_name = self.func_name func_name = self.func_name

@ -320,6 +320,8 @@ class Worker(object):
self.state = 'busy' self.state = 'busy'
job, queue = result 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), self.log.info('%s: %s (%s)' % (green(queue.name),
blue(job.description), job.id)) blue(job.description), job.id))

Loading…
Cancel
Save