Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Guest
2020-11-11T14:53:05Z
I have a job where I call an external process and upon completion it writes a file to a directory. Within a loop I check every 5 minutes for that completion file to be written. When the file has been written I simply go to the next task.

If the file has not been written when the loop hits the max iterations I know something has gone wrong and cannot move to the next task without manual intervention.

Since there isn't a "On max iterations do this", the loop simply exits and the job stops, is there anyway I can capture this exit and send an email?
Sponsor
Forum information
Support
2020-11-11T16:33:46Z
Originally Posted by: Polar Bear 

I have a job where I call an external process and upon completion it writes a file to a directory. Within a loop I check every 5 minutes for that completion file to be written. When the file has been written I simply go to the next task.

If the file has not been written when the loop hits the max iterations I know something has gone wrong and cannot move to the next task without manual intervention.

Since there isn't a "On max iterations do this", the loop simply exits and the job stops, is there anyway I can capture this exit and send an email?



When the exe has finished, the file should be complete? It can't keep copying after the exe has been executed.

Please elaborate if i'm misunderstanding. Even if there was a check, there is no function that would see if the file is actually finished. For this you most likely have to go to the source an adjust the executable.
Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
Guest
2020-11-19T19:48:33Z
I went to far with my scenario, let me make it more generic.
I have a loop that cycles every 5 minutes with a maximum of 100 iterations.
If the loop hits the max iterations, by default the next task is executed.
I need to capture the fact the loop hit the max as I cannot have the next step execute, I need to stop the process and send a notification.

As there is not an option to use a condition on a loop, nor is there an option of "on max loop do this", I have come up with one kludge but I don't like it because of the requirement to enter the max loop twice. There is also a flaw where the loop criteria is actually met on the last iteration, I will still notify of max loop.

Create two user variables:
MaxLoop as Int32
LoopCounter as Int32
Task SetUserVariable - initialize MaxLoop, to the same value you used in the loop itself
Task SetUserVariable - initialize to 0
Start Loop
Task Calculate Variable - Increment LoopCounter by 1
End Loop
Task Calculate Variable - JobVariable(LoopRemainer_ = (MaxLoop minus LoopCounter )
On Success - If LoopRemainder = 0 then max count hit, send max count notification and stop job.
This is not always accurate though, in the case where the loop criterial is met on the last iteration.

Task
Scroll to Top