def from_task_id(cls,task_id): if client.sismember(cls.resq_tasks,task_id): queue = client.get(cls.resq_queue%task_id) params = client.get(cls.resq_params%task_id) task_name = client.get(cls.resq_name%task_id) obj = cls(queue,params,task_name,task_id) return obj else: return None
def find(cls, worker_id): if cls.exists(worker_id): queues = client.get(cls.resq_worker_queues%worker_id) worker = cls(queues,worker_id) return worker else: return None
def _get_started(self): datestring = client.get(self.resq_start%self) return datestring
def _get_end(self): datestring = client.get(self.resq_end % self) return datestring
def get(self): val = client.get(self.name) if val: return int(val) return 0
def state(self): stats = client.get(self.resq_worker%self.worker_id) if stats: return stats return None
def _get_started(self): datestring = client.get(self.resq_worker_start % self.worker_id) return datestring
def job(self): data = client.get(self.resq_worker_task%self.worker_id) if data: return json.loads(data) return {}