예제 #1
0
def _unformat_task_detail(uuid, td_data):
    td = logbook.TaskDetail(name=td_data['name'], uuid=uuid)
    td.state = td_data.get('state')
    td.results = td_data.get('results')
    td.failure = p_utils.failure_from_dict(td_data.get('failure'))
    td.meta = td_data.get('meta')
    td.version = td_data.get('version')
    return td
예제 #2
0
def _unformat_task_detail(uuid, td_data):
    td = logbook.TaskDetail(name=td_data['name'], uuid=uuid)
    td.state = td_data.get('state')
    td.results = td_data.get('results')
    td.failure = p_utils.failure_from_dict(td_data.get('failure'))
    td.meta = td_data.get('meta')
    td.version = td_data.get('version')
    return td
예제 #3
0
 def _parse_request(task, task_name, action, arguments, result=None,
                    failures=None, **kwargs):
     """Parse request before it can be processed. All `misc.Failure` objects
     that have been converted to dict on the remote side to be serializable
     are now converted back to objects.
     """
     action_args = dict(arguments=arguments, task_name=task_name)
     if result is not None:
         data_type, data = result
         if data_type == 'failure':
             action_args['result'] = pu.failure_from_dict(data)
         else:
             action_args['result'] = data
     if failures is not None:
         action_args['failures'] = {}
         for k, v in failures.items():
             action_args['failures'][k] = pu.failure_from_dict(v)
     return task, action, action_args
예제 #4
0
 def _process_response(self, task_uuid, response):
     """Process response from remote side."""
     try:
         task = self._remote_tasks[task_uuid]
     except KeyError:
         LOG.debug("Task with id='%s' not found." % task_uuid)
     else:
         state = response.pop('state')
         if state == pr.RUNNING:
             task.set_running()
         elif state == pr.PROGRESS:
             task.on_progress(**response)
         elif state == pr.FAILURE:
             response['result'] = pu.failure_from_dict(response['result'])
             task.set_result(**response)
             self._remove_remote_task(task)
         elif state == pr.SUCCESS:
             task.set_result(**response)
             self._remove_remote_task(task)
         else:
             LOG.warning("Unexpected response status: '%s'" % state)
예제 #5
0
 def _process_response(self, task_uuid, response):
     """Process response from remote side."""
     try:
         task = self._remote_tasks[task_uuid]
     except KeyError:
         LOG.debug("Task with id='%s' not found." % task_uuid)
     else:
         state = response.pop('state')
         if state == pr.RUNNING:
             task.set_running()
         elif state == pr.PROGRESS:
             task.on_progress(**response)
         elif state == pr.FAILURE:
             response['result'] = pu.failure_from_dict(
                 response['result'])
             task.set_result(**response)
             self._remove_remote_task(task)
         elif state == pr.SUCCESS:
             task.set_result(**response)
             self._remove_remote_task(task)
         else:
             LOG.warning("Unexpected response status: '%s'" % state)
예제 #6
0
파일: models.py 프로젝트: rl-0x0/taskflow
 def process_result_value(self, value, dialect):
     if value is None:
         return None
     return persistence_utils.failure_from_dict(jsonutils.loads(value))
예제 #7
0
파일: models.py 프로젝트: SEJeff/taskflow
 def process_result_value(self, value, dialect):
     if value is None:
         return None
     return persistence_utils.failure_from_dict(jsonutils.loads(value))