Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Is there a way to introduce a delay between the loops of a DO_WHILE loop or a sleep? I tried setting startDelay field for the loop task but that didnt work #1868

Closed
ritu-p opened this issue Sep 15, 2020 · 6 comments
Labels

Comments

@ritu-p
Copy link
Contributor

ritu-p commented Sep 15, 2020

No description provided.

@obezuk
Copy link

obezuk commented Sep 16, 2020

Is your startDelay on the DO_WHILE task or the loopOver task? I have it working with the startDelay being on the start of the loop's first task.

{
  "name": "Do While with Delay",
  "taskReferenceName": "Do While with Delay",
  "type": "DO_WHILE",
  "timeoutSeconds": 0,
  "pollTimeoutSeconds": 0,
  "loopCondition": "if ($.job['response']['body']['done'] == 1) { true; } else { false; }",
  "loopOver": [
    {
      "name": "Get Status",
      "taskReferenceName": "job",
      "startDelay": 5,
      "type": "HTTP",
      "inputParameters": {
        "http_request": {
          "uri": "http://example.com/getjob",
          "method": "GET"
        }
      }
    }
  ]
}

@ritu-p
Copy link
Contributor Author

ritu-p commented Sep 16, 2020

Hi @obezuk ,
I did add startDelay:300 (I hope it take in seconds) , but the 2 iterations starts as soon as the first iteration is completed.

{
"taskType": "EVENT",
"status": "COMPLETED",
"referenceTaskName": "test__2",
"retryCount": 0,
"seq": 1,
"correlationId": "cdf7a1ab-9f1f-4b03-8ebd-20f00353d0e9",
"pollCount": 0,
"taskDefName": "test",
"scheduledTime": 1600244710914,
"startTime": 1600244710923,
"endTime": 1600248337515, //Wednesday, September 16, 2020 9:25:37.515 AM
"updateTime": 1600244710927,
"startDelayInSeconds": 0,
"retried": false,
"executed": true,
"callbackFromWorker": true,
"responseTimeoutSeconds": 0,
"workflowInstanceId": "bf5686fa-0156-4853-ab1d-e787b7ba6271",
"workflowType": "check_status_workflow",
"taskId": "46143aff-e9f4-4e4d-9064-a3865c6cac40",
"callbackAfterSeconds": 0,
"workflowTask": {
"name": "check_backup_status",
"taskReferenceName": "test",
"inputParameters": {
"name": "test",
"task_id": "${CPEWF_TASK_ID}",
"parent_task_id": null,
"workflow_id": "${workflowid.workflowId}",
"correlation_id": "${workflow.correlationId}",
"job_id": "${workflow.input.jobid}",
"sink": "amqp_exchange",
"asyncComplete": true
},
"type": "EVENT",
"decisionCases": {},
"defaultCase": [],
"forkTasks": [],
"startDelay": 300,
"joinOn": [],
"optional": false,
"defaultExclusiveJoinTask": [],
"asyncComplete": true,
"loopOver": []
},
"rateLimitPerFrequency": 0,
"rateLimitFrequencyInSeconds": 0,
"workflowPriority": 0,
"iteration": 2,
"loopOverTask": true,
"queueWaitTime": 9,
"taskStatus": "COMPLETED",
"logs": []
},
{
"taskType": "EVENT",
"status": "COMPLETED",
"referenceTaskName": "test__3",
"retryCount": 0,
"seq": 1,
"correlationId": "cdf7a1ab-9f1f-4b03-8ebd-20f00353d0e9",
"pollCount": 0,
"taskDefName": "test",
"scheduledTime": 1600248337550,
"startTime": 1600248337557,//Wednesday, September 16, 2020 9:25:37.557 AM
"endTime": 1600248412443,
"updateTime": 1600248337563,
"startDelayInSeconds": 0,
"retried": false,
"executed": true,
"callbackFromWorker": true,
"responseTimeoutSeconds": 0,
"workflowInstanceId": "bf5686fa-0156-4853-ab1d-e787b7ba6271",
"workflowType": "check_status_workflow",
"taskId": "184123e8-5cd1-4f42-bb94-74f1155ea401",
"callbackAfterSeconds": 0,
"workflowTask": {
"name": "test",
"taskReferenceName": "test",
"inputParameters": {
"name": "test",
"task_id": "${CPEWF_TASK_ID}",
"parent_task_id": null,
"workflow_id": "${workflowid.workflowId}",
"correlation_id": "${workflow.correlationId}",
"job_id": "${workflow.input.jobid}",
"content": "${hana_file_based_backup_start.output.response_message}",
"asyncComplete": true
},
"type": "EVENT",
"decisionCases": {},
"defaultCase": [],
"forkTasks": [],
"startDelay": 300,
"joinOn": [],
"optional": false,
"defaultExclusiveJoinTask": [],
"asyncComplete": true,
"loopOver": []
},
"rateLimitPerFrequency": 0,
"rateLimitFrequencyInSeconds": 0,
"workflowPriority": 0,
"iteration": 3,
"loopOverTask": true,
"taskDefinition": {
"present": false
},
"queueWaitTime": 7,
"taskStatus": "COMPLETED",
"logs": []
},

@ritu-p
Copy link
Contributor Author

ritu-p commented Sep 17, 2020

Hi @obezuk found a difference in HTTPTask the below line is set in mapper
httpTask.setCallbackAfterSeconds(taskToSchedule.getStartDelay());

https://github.com/Netflix/conductor/blob/master/core/src/main/java/com/netflix/conductor/core/execution/mapper/HTTPTaskMapper.java

The above is not set in EVENT task which I am using

https://github.com/Netflix/conductor/blob/master/core/src/main/java/com/netflix/conductor/core/execution/mapper/EventTaskMapper.java

Do you think adding this line will fix the issue?

@kishorebanala
Copy link
Contributor

Hey @ritu-p ,

Do you think adding this line will fix the issue?

EVENT task is not an async system task, meaning it will not be added to queue.. and hence the start delay wouldn't work for EVENT task.

This may not be related to DO_WHILE, but should be improved though. Feel free to open another issue with a proposal for adding start delay to all non-async system task(s).

@github-actions
Copy link
Contributor

github-actions bot commented Apr 7, 2021

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.

@github-actions github-actions bot added the Stale label Apr 7, 2021
@github-actions
Copy link
Contributor

This issue was closed, because it has been stalled for 7 days with no activity.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants