Beispiel #1
0
 def load_all_tasks(self):
     keys = self.client.keys(self.key_pattern % '*')
     if not keys:
         return {}
     task_raws = self.client.mget(keys)
     tasks = {}
     for task_raw in task_raws:
         task_json = eval(task_raw)
         task = TaskBuilder.from_json(task_json)
         if not task:
             continue
         tasks[task.id] = task
     return tasks
Beispiel #2
0
 def get_task(self, task_id):
     task_raw = self.client.get(self.key_pattern % task_id)
     if not task_raw:
         return None
     task_json = eval(task_raw)
     return TaskBuilder.from_json(task_json)