Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
MarkFaw
Contributor
Contributor

Stopping reload task when successful

Good morning,

I created a triggering app with a reload task that runs every 15 mins between 9:00 - 16:00 from monday to friday.

The triggering app basically checks if the data is updated in a table in our database; there is a small logic to check if max(date) = today()-1.  

if the condition is met (max(date) = today()-1), then it exits scripts, and we have a set of dashboards reloads tasks that are depended on the success of the triggering app task.

else (if the data wasn't updated yet), there will be a forced error (select * from;) and this way the dashboards' tasks won't run since this trigger will be failed.

 

for example if the data was updated between 10:00 and 10:15, then the first 5 tasks (9 - 9:15 - 9:30 - 9:45 - 10:00) will be failed, whereas the remaining tasks (from 10:15 till 16:00) will be successful and the dashboards will keep on running every 15 mins.

 

is there a way to stop the triggering app task whenever it was successful for that day and make it run again the following day? so when the task is successful at 10:15, the dashboards will refresh, but the triggering task won't run again at 10:30, 10:45, etc. but will run again the following day starting 9:00.

 

Thank you,

Mark,

Labels (1)
1 Solution

Accepted Solutions
Or
MVP
MVP

You can Sleep for up to an hour using the Sleep statement in script, but for longer than an hour you can just loop the script statement as required. As far as I know, this shouldn't take any significant resources (since the app in question is likely to be small, holding it in memory shouldn't be an issue).

https://help.qlik.com/en-US/sense/May2023/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptRegularSt...

I would handle this by checking for an update and then sleeping for 15 minutes if no update was found before trying again. I would then only need to schedule this task once, and the trigger would only run once - when it stops sleeping and finishes the load based on the updated information.

View solution in original post

3 Replies
Or
MVP
MVP

I'm not aware of any way to schedule things in this manner - it seems kind of counter-intuitive for most purposes.

You could perhaps swap out the forced error statement for a Sleep statement that would simply keep the app within the load process until midnight, achieving essentially the same thing?

MarkFaw
Contributor
Contributor
Author

thank you for your response.

 

how to do so please? and wouldn't that use a lot of resources since the task will technically still be running?

 

also, i think i need to implement the sleep statement for the next reload after the successful one right? (which is at 10:30 in the example given).

 

thanks,

Or
MVP
MVP

You can Sleep for up to an hour using the Sleep statement in script, but for longer than an hour you can just loop the script statement as required. As far as I know, this shouldn't take any significant resources (since the app in question is likely to be small, holding it in memory shouldn't be an issue).

https://help.qlik.com/en-US/sense/May2023/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptRegularSt...

I would handle this by checking for an update and then sleeping for 15 minutes if no update was found before trying again. I would then only need to schedule this task once, and the trigger would only run once - when it stops sleeping and finishes the load based on the updated information.