示例#1
0
def taskflow_finished_handler(sender, username, **kwargs):
    try:
        taskflow = sender
        send_task_flow_message(taskflow, TASK_FINISHED)
    except Exception as e:
        logger.error(
            'taskflow_finished_handler[taskflow_id=%s] send message error: %s'
            % (taskflow.id, e))
    return
示例#2
0
def send_taskflow_message(taskflow, msg_type, atom_node_name=''):
    try:
        send_task_flow_message(taskflow, msg_type, atom_node_name)
    except Exception as e:
        logger.error(
            'send_task_flow_message[taskflow_id=%s] send message error: %s' %
            (taskflow.id, e))
    else:
        logger.info('send_taskflow_message[taskflow_id=%s] task finished' %
                    taskflow.id)
示例#3
0
def taskflow_node_failed_handler(sender, pipeline_id, pipeline_activity_id,
                                 **kwargs):
    try:
        taskflow = TaskFlowInstance.objects.get(
            pipeline_instance__instance_id=pipeline_id)
    except TaskFlowInstance.DoesNotExist:
        logger.error(
            u"pipeline finished handler get taskflow error, pipeline_instance_id=%s"
            % pipeline_id)
        return

    try:
        activity_name = taskflow.get_act_web_info(pipeline_activity_id)['name']
        send_task_flow_message(taskflow, ATOM_FAILED, activity_name)
    except Exception as e:
        logger.error(
            'taskflow_node_failed_handler[taskflow_id=%s] send message error: %s'
            % (taskflow.id, e))
    return