Let’s say I have a workflow scheduled to run daily at 1 AM UTC. If, for some reason, our service, which is hosting the workers, is down during 1 AM UTC and comes back around 2 AM UTC, will the schedule get executed at 2 AM UTC?
Is there a way for me to control this behavior? For example, if the service comes back at 2 AM UTC, then I want to execute the schedule at 2 AM. If the service is down for 24 hours and comes back at 1 AM UTC the next day, then I do not want to execute two schedules back to back.
I have read the documentation for ScheduleBackFill, but it is unclear if it can be used to control the above.
Can you let me know how do I specify the catchup-window as mentioned in the above link for java? For example let’s say I want it to set it to 23 hours for the above example from the default 1 year.
Note that the catchup window only applies to creating the workflow, not to it starting running. I.e., if the Temporal server is up and working at 1 AM UTC, then the scheduled workflow will be created, regardless of whether your workers are running. It would just be stuck at the first workflow task until the workers come back, which could be 1 hour or 24 hours. If it did get to 24 hours, though, then the overlap policy would control whether the old one or the new one ran after that.
If you want to say something like, ignore this run if it’s been 23 hours since the workflow was created, then you could handle it in the schedule itself by checking the current time against the scheduled start time right at the beginning of the workflow. You could also set a workflow timeout of 23 hours.
If you want to say something like, ignore this run if it’s been 23 hours since the workflow was created, then you could handle it in the schedule itself by checking the current time against the scheduled start time right at the beginning of the workflow
This I guess I have to do by using Workflow.getInfo().getRunStartedTimestampMillis() and Workflow.currentTimeMillis() which @tihomir mentioned above.
You could also set a workflow timeout of 23 hours.
Can you let me know how do I specify the workflow timeout? I do not see anything in ScheduleOptions. I am using java SDK 1.22.2.
Can you let me know how do I specify the workflow timeout?
Think idea was to set run timeout in WorkflowOptions. Just note that if set your workers would not be able to react to it (when reached service just times out execution which is not reported to your workers).