|
|
@ -16,7 +16,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')
|
|
|
|
STARTED='started')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -354,7 +355,6 @@ class Job(object):
|
|
|
|
assert self.id == _job_stack.pop()
|
|
|
|
assert self.id == _job_stack.pop()
|
|
|
|
return self._result
|
|
|
|
return self._result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_ttl(self, default_ttl=None):
|
|
|
|
def get_ttl(self, default_ttl=None):
|
|
|
|
"""Returns ttl for a job that determines how long a job and its result
|
|
|
|
"""Returns ttl for a job that determines how long a job and its result
|
|
|
|
will be persisted. In the future, this method will also be responsible
|
|
|
|
will be persisted. In the future, this method will also be responsible
|
|
|
@ -390,7 +390,6 @@ class Job(object):
|
|
|
|
connection = pipeline if pipeline is not None else self.connection
|
|
|
|
connection = pipeline if pipeline is not None else self.connection
|
|
|
|
connection.expire(self.key, ttl)
|
|
|
|
connection.expire(self.key, ttl)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
def __str__(self):
|
|
|
|
return '<Job %s: %s>' % (self.id, self.description)
|
|
|
|
return '<Job %s: %s>' % (self.id, self.description)
|
|
|
|
|
|
|
|
|
|
|
|