def _get_operation_postponed_body(exception): report = exception.call_report if isinstance(exception.call_report, AsyncResult): report = TaskResult.from_async_result(exception.call_report) serialized_call_report = report.serialize() for task in serialized_call_report['spawned_tasks']: href_obj = dispatch.task_result_href(task) task.update(href_obj) return json.dumps(serialized_call_report, default=json_util.default)
def _get_operation_postponed_body(exception): report = exception.call_report if isinstance(exception.call_report, AsyncResult): report = TaskResult.from_async_result(exception.call_report) serialized_call_report = report.serialize() for task in serialized_call_report['spawned_tasks']: href_obj = dispatch.task_result_href(task) task.update(href_obj) return json.dumps(serialized_call_report, default=json_util.default)
def task_serializer(task): """ Update the task representation in the database to match the model for the API :param task: The task from the database :type task: dict :return: the same task modified for use by the API :rtype: dict """ task = serial_dispatch.task_status(task) task.update(serial_dispatch.spawned_tasks(task)) task.update(serial_dispatch.task_result_href(task)) return task
def task_serializer(task): """ Update the task representation in the database to match the model for the API :param task: The task from the database :type task: dict :return: the same task modified for use by the API :rtype: dict """ task = serial_dispatch.task_status(task) task.update(serial_dispatch.spawned_tasks(task)) task.update(serial_dispatch.task_result_href(task)) return task
def _get_operation_postponed_body(exception): report = exception.call_report if isinstance(exception.call_report, AsyncResult): report = TaskResult.from_async_result(exception.call_report) serialized_call_report = report.serialize() for task in serialized_call_report['spawned_tasks']: href_obj = dispatch.task_result_href(task) task.update(href_obj) # Use the object's serializer if it is a Mongoengine Document. result = serialized_call_report.get('result') if hasattr(result, 'serializer'): serialized_call_report['result'] = result.serializer(result).data return json.dumps(serialized_call_report, default=json_util.default)
def _get_operation_postponed_body(exception): report = exception.call_report if isinstance(exception.call_report, AsyncResult): report = TaskResult.from_async_result(exception.call_report) serialized_call_report = report.serialize() if 'spawned_tasks' in serialized_call_report: for task in serialized_call_report['spawned_tasks']: href_obj = dispatch.task_result_href(task) task.update(href_obj) # Use the object's serializer if it is a Mongoengine Document. result = serialized_call_report.get('result') if hasattr(result, 'serializer'): serialized_call_report['result'] = result.serializer(result).data return json.dumps(serialized_call_report, default=json_util.default)