Netflix / conductor

Conductor is a microservices orchestration engine.
Apache License 2.0
12.83k stars 2.34k forks source link

Unable to get current task id when a workflow is retried #1944

Open yamuna2511 opened 4 years ago

yamuna2511 commented 4 years ago

I am trying to pass task id of current HTTP task to the api in the request body using ${CPEWF_TASK_ID}. This works for the first task instance. If this task fails and retried manually, new task id gets generated but this ${CPEWF_TASK_ID} still contains first task id. Please help how to pass the latest task id

Workflow definition: { "createTime": 1594656285069, "name": "WF1", "description": "Workflow", "version": 17, "tasks": [ { "name": "task_1", "taskReferenceName": "task_1", "inputParameters": { "http_request": { "connectionTimeOut": "1172000000", "readTimeOut": "172000000", "uri": "url", "method": "POST", "headers": { "userId": "${workflow.input.userID}" }, "body": { "params":[
{ "key":"taskID", "value":"${CPEWF_TASK_ID}" }] } }, "asyncComplete": false }, "type": "HTTP", "startDelay": 0, "optional": false, "asyncComplete": true } ], "outputParameters": { "Output": "${task_1.output}" }, "failureWorkflow": "string", "schemaVersion": 2, "restartable": true, "workflowStatusListenerEnabled": true }

Workflow instance: { "createTime": 1604066774284, "updateTime": 1604066834925, "status": "RUNNING", "endTime": 1604066816282, "workflowId": "46892e0f-02aa-4cba-abb4-f2789dd956a3", "tasks": [ { "taskType": "HTTP", "status": "FAILED", "inputData": { "http_request": { "connectionTimeOut": "1172000000", "readTimeOut": "172000000", "uri": "url", "method": "POST", "headers": {
"userId": "USER1", }, "body": { "params": [
{ "key": "taskID", "value": "839714f1-a2a9-4bd5-bdf2-99c5cecb195c" } ] } }, "asyncComplete": true }, "referenceTaskName": "task_1", "retryCount": 0, "seq": 1, "pollCount": 1, "taskDefName": "task_1", "scheduledTime": 1604066774304, "startTime": 1604066774360, "endTime": 1604066816267, "updateTime": 1604066834928, "startDelayInSeconds": 0, "retried": true, "executed": true, "callbackFromWorker": true, "responseTimeoutSeconds": 0, "workflowInstanceId": "46892e0f-02aa-4cba-abb4-f2789dd956a3", "workflowType": "WF1", "taskId": "839714f1-a2a9-4bd5-bdf2-99c5cecb195c", "callbackAfterSeconds": 0, "workflowTask": { "name": "task_1", "taskReferenceName": "task_1", "inputParameters": { "http_request": { "connectionTimeOut": "1172000000", "readTimeOut": "172000000", "uri": "url", "method": "POST", "headers": { "userId": "${workflow.input.userID}" }, "body": { "params":[
{ "key":"taskID", "value":"${CPEWF_TASK_ID}" }] } }, "asyncComplete": true }, "type": "HTTP", "startDelay": 0, "optional": false, "asyncComplete": true }, "rateLimitPerFrequency": 0, "rateLimitFrequencyInSeconds": 0, "workflowPriority": 0, "iteration": 0, "iterationCount": 0, "taskStatus": "FAILED", "queueWaitTime": 56, "taskDefinition": { "present": false }, "loopOverTask": false }, { "taskType": "HTTP", "status": "IN_PROGRESS", "inputData": { "http_request": { "connectionTimeOut": "1172000000", "readTimeOut": "172000000", "uri": "url", "method": "POST", "headers": { "userId": "USER1" }, "body": { "params": [
{ "key": "taskID", "value": "839714f1-a2a9-4bd5-bdf2-99c5cecb195c" } ] } }, "asyncComplete": true }, "referenceTaskName": "task_1", "retryCount": 1, "seq": 2, "pollCount": 1, "taskDefName": "task_1", "scheduledTime": 1604066834937, "startTime": 1604066835236, "endTime": 0, "updateTime": 1604066835271, "startDelayInSeconds": 0, "retriedTaskId": "839714f1-a2a9-4bd5-bdf2-99c5cecb195c", "retried": false, "executed": false, "callbackFromWorker": true, "responseTimeoutSeconds": 0, "workflowInstanceId": "46892e0f-02aa-4cba-abb4-f2789dd956a3", "workflowType": "WF1", "taskId": "f6f6e36e-d37f-452e-bb53-aae98d57f457", "callbackAfterSeconds": 30, "workerId": "wdr41", "outputData": { "response": { "headers": {

                },
                "reasonPhrase": "Accepted",
                "body": {
                    "codes": [

                    ]
                },
                "statusCode": 202
            }
        },
        "workflowTask": {
            "name": "task_1",
            "taskReferenceName": "task_1",
            "inputParameters": {
                "http_request": {
                    "connectionTimeOut": "1172000000",
                    "readTimeOut": "172000000",
                    "uri": "url",
                    "method": "POST",
                    "headers": {
                        "userId": "${workflow.input.userID}"
                    },
                    "body": {
                        "params":[                          
                        {
                            "key":"taskID",
                            "value":"${CPEWF_TASK_ID}"
                        }]
                    }
                },
                "asyncComplete": true
            },
            "type": "HTTP",
            "startDelay": 0,
            "optional": false,
            "asyncComplete": true
        },
        "rateLimitPerFrequency": 0,
        "rateLimitFrequencyInSeconds": 0,
        "workflowPriority": 0,
        "iteration": 0,
        "iterationCount": 0,
        "taskStatus": "IN_PROGRESS",
        "queueWaitTime": -29701,
        "taskDefinition": {
            "present": false
        },
        "loopOverTask": false
    }
],
"input": {        
    "userID": "USER1"
},
"workflowType": "WF1",
"version": 17,
"schemaVersion": 2,
"failedReferenceTaskNames": [
    "task_1"
],
"workflowDefinition": {
    "createTime": 1594656285069,
    "name": "WF1",
    "description": "Workflow",
    "version": 17,
    "tasks": [
        {
            "name": "task_1",
            "taskReferenceName": "task_1",
            "inputParameters": {
                "http_request": {
                    "connectionTimeOut": "1172000000",
                    "readTimeOut": "172000000",
                    "uri": "url",
                    "method": "POST",
                    "headers": {                            
                        "userId": "${workflow.input.userID}"
                    },
                    "body": {
                        "params":[                          
                        {
                            "key":"taskID",
                            "value":"${CPEWF_TASK_ID}"
                        }]
                    }
                },
                "asyncComplete": true
            },
            "type": "HTTP",
            "startDelay": 0,
            "optional": false,
            "asyncComplete": true
        }
    ],
    "outputParameters": {
        "Output": "${task_1.output}"
    },
    "failureWorkflow": "string",
    "schemaVersion": 2,
    "restartable": true,
    "workflowStatusListenerEnabled": true
},
"priority": 0,
"workflowName": "WF1",
"workflowVersion": 17,
"startTime": 1604066774284

}

apanicker-nflx commented 3 years ago

@yamuna2511 This behavior does not look correct. I have marked this as a bug for now. We will try to reproduce this and push out a fix in a later release. Please feel free to submit a PR with the fix in the meantime.

github-actions[bot] commented 3 years ago

This issue is stale, because it has been open for 45 days with no activity. Remove the stale label or comment, or this will be closed in 7 days.