Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Community,
We have several QlikView tasks at our end. The tasks fails due to some network or connectivity issues and we have to restart them manually every time.
I am trying to use the option No. of Tries = 2 but the task is getting started immediately without any delay. I created a pause task and it ran after 2 retries.
I need a solution where if the task fails, it should wait for 1 min and then to retry the same failed task. Upon success it should go to the subsequent tasks.
@krishnajamylavarapu16 At the beginning of the load script you could put a sleep(100000) to wait 1 minute before getting into the real script in combination with "number of tries" ?
Does the reload fail in the script because it cant connect to data sources?
If you put in the sleep in the script there are still no guarantee that there are connectivity at that point either.
You could put number of retires to a higher number unless the connectivity issues are long.
If this is an issue that occurs often, the only real solution would be to actually fix the network issues.
I'm not sure if the last successful execution-time will be needed in this case and if if it would be helpful to use for it variables because if the execution breaks with a script-error no changed variable-value would be saved. Of course you may bypass this with the ERRORMODE but this may lead to other disadvantages.
IMO better and more practicably is to store such information within files and to read them again if needed. I use such logic to set various parameter for another batches or Excel files, for example:
t: load 'run' as RUN AutoGenerate 0; store t into t.txt (txt);
Any information which is helpful for your task might be stored in a similar way.
Whereby in your case I would rather tend to logics like the following:
for i = 1 to 10
if filesize('path\file') > 0 then
… your statements …;
exit for;
else
sleep 10000 * $(i)
end if
next
to check if the network is there or not.
- Marcus
Since I had the same problem, I built my own "Task Watcher" as a Windows service that uses the QMS API to restart failed tasks after a defined period of time.
I've been using the program reliably for 7 years.
The current version is based on .NET 4.8 and works for QlikView 12.10 or higher. Installation and configuration are easy (admin rights are required).
Let me know if you are interested.
@krishnajamylavarapu16 At the beginning of the load script you could put a sleep(100000) to wait 1 minute before getting into the real script in combination with "number of tries" ?
I have read in some posts in the community which have stated that using sleep function blocks a QV engine. We may have other tasks which are running at the same time. Then there will no more number of failures.
Do we have any option to use Sleep function based on a variable value. The variable should have the Last reload date time and if the current reload and last reload date time is > 1 day, the sleep should not execute and if not sleep should execute.
You could have some variables so that it could check when it was last run, so if say it was last run over an hour ago it skips the sleep.
I have read in some posts in the community which have stated that using sleep function blocks a QV engine. We may have other tasks which are running at the same time. Then there will no more number of failures. We don't want this.
AFAIK sleep paused only the current task and not any parallel tasks. By multiplen sleep-statements in parallel running tasks it may have an impact in regard which tasks might be queued but this depends mainly on the number of available cores and the appropriate qmc-settings and should be rather negligibly because parallel running tasks will compete to the available resources and too many of them will force the OS to jump between the handles of those tasks each time with some latency costs - so it might take longer as running them more serial.
Beside this you may make the sleep more dynamic by choosing shorter times within some loops which may iterate 10 times and adding each time a few second more to the sleep or something similar. Thinkable is also to integrate various checks - connection successful, file exists, data are current and so on - within such a loop- and/or-if-logic maybe also with ERRORMODE.
- Marcus
Thanks for your inputs Marcus.
Could you please help me with the code to be used as per Lucas comment - 'You could have some variables so that it could check when it was last run, so if say it was last run over an hour ago it skips the sleep.'
Does the reload fail in the script because it cant connect to data sources?
If you put in the sleep in the script there are still no guarantee that there are connectivity at that point either.
You could put number of retires to a higher number unless the connectivity issues are long.
If this is an issue that occurs often, the only real solution would be to actually fix the network issues.
I'm not sure if the last successful execution-time will be needed in this case and if if it would be helpful to use for it variables because if the execution breaks with a script-error no changed variable-value would be saved. Of course you may bypass this with the ERRORMODE but this may lead to other disadvantages.
IMO better and more practicably is to store such information within files and to read them again if needed. I use such logic to set various parameter for another batches or Excel files, for example:
t: load 'run' as RUN AutoGenerate 0; store t into t.txt (txt);
Any information which is helpful for your task might be stored in a similar way.
Whereby in your case I would rather tend to logics like the following:
for i = 1 to 10
if filesize('path\file') > 0 then
… your statements …;
exit for;
else
sleep 10000 * $(i)
end if
next
to check if the network is there or not.
- Marcus
Do you have the problem only with one task or do you need a general solution for most of the tasks?