Example #1
0
 def _get_task_meta_for(self, task_id):
     """Get task metadata for a task by id."""
     session = self.ResultSession()
     try:
         task = session.query(Task).filter(Task.task_id == task_id).first()
         if task is None:
             task = Task(task_id)
             task.status = states.PENDING
             task.result = None
         return task.to_dict()
     finally:
         session.close()
Example #2
0
 def _get_task_meta_for(self, task_id):
     """Get task metadata for a task by id."""
     session = self.ResultSession()
     try:
         task = session.query(Task).filter(Task.task_id == task_id).first()
         if task is None:
             task = Task(task_id)
             task.status = states.PENDING
             task.result = None
         return task.to_dict()
     finally:
         session.close()
Example #3
0
 def _get_task_meta_for(self, task_id):
     """Get task metadata for a task by id."""
     session = self.ResultSession()
     try:
         task = session.query(Task).filter(Task.task_id == task_id).first()
         if not task:
             task = Task(task_id)
             session.add(task)
             session.flush()
             session.commit()
         return task.to_dict()
     finally:
         session.close()
Example #4
0
 def _get_task_meta_for(self, task_id):
     """Get task metadata for a task by id."""
     session = self.ResultSession()
     try:
         task = session.query(Task).filter(Task.task_id == task_id).first()
         if not task:
             task = Task(task_id)
             session.add(task)
             session.flush()
             session.commit()
         return task.to_dict()
     finally:
         session.close()
Example #5
0
 def _store_result(self, task_id, result, status, traceback=None):
     """Store return value and status of an executed task."""
     session = self.ResultSession()
     try:
         task = session.query(Task).filter(Task.task_id == task_id).first()
         if not task:
             task = Task(task_id)
             session.add(task)
             session.flush()
         task.result = result
         task.status = status
         task.traceback = traceback
         session.commit()
     finally:
         session.close()
     return result
Example #6
0
 def _store_result(self, task_id, result, status, traceback=None):
     """Store return value and status of an executed task."""
     session = self.ResultSession()
     try:
         task = session.query(Task).filter(Task.task_id == task_id).first()
         if not task:
             task = Task(task_id)
             session.add(task)
             session.flush()
         task.result = result
         task.status = status
         task.traceback = traceback
         session.commit()
     finally:
         session.close()
     return result
Example #7
0
 def test_Task__repr__(self):
     self.assertIn("foo", repr(Task("foo")))