cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Enable or disable a task

nsohal
Employee
Employee

Contributed by @nsohal


This pipeline pattern enables or disables an existing task by using the SnapLogic Read and Update Snaps.

36%20PM

Configuration

  • The path to the task is passed to the SnapLogic Read Snap as a pipeline parameter.
  • The Mapper Snap uses the Boolean expression to enable or disable task.
    22%20PM

Source: SnapLogic Read
Target: SnapLogic Task
Snaps used: SnapLogic Read, Mapper, SnapLogic Update

Downloads

enable or disable task.slp (4.1 KB)

2 REPLIES 2

nsmith
New Contributor III

This is very helpful. Iโ€™m trying to build a โ€œJob Schedulingโ€ system that will enable and disable tasks when they are ready to run based on another systemโ€™s scheduling.

I have it โ€œretryโ€ each task 5 times, so that if the pipeline fails it will auto retryโ€ฆ but if it succeeds, then it will disable its own task and shouldnโ€™t run again. Unfortunately even after the task has been disabled, the pipeline will run a second time โ€“ so it appears that scheduling is added to a queue, and if itโ€™s within 1-2 minutes of runningโ€ฆ disabling a task doesnโ€™t remove it from the queue.

Does anyone have any ideas? I thought about using the Task Execute, but thatโ€™s being deprecated (documentation says so). I donโ€™t want to use the pipeline execute because I donโ€™t want them all related, because Iโ€™ll have 1 master scheduler pipeline related to every single execution.

EDIT: Maybe itโ€™s that Iโ€™ve got the retry interval set to 3 minutes? Iโ€™m dropping it to 5 and will see if that fixes it.

nsmith
New Contributor III

Yeah it looks like thereโ€™s some type of pipeline run queueโ€ฆ so if you disable a task at the end of its own pipeline, thereโ€™s still a chance it runs again because itโ€™s already in the queueโ€ฆ โ˜น๏ธ

FIX: I added a task reader snap and a filter for โ€œ$parameters.enabled == trueโ€ at the start of the pipelineโ€ฆ so if the task has been disabled it will stop execution.