How to skip execution of a "Current Time" based event trigger if there is still a current execution running
Posted by on 24 July 2018 01:24 AM
There may be times when you would want a trigger to skip/abort execution if a previous execution of the same trigger is still running. Here's a sample scenario where this particular capability might come in handy:
Let's say you have a time-based trigger (a trigger that uses the 'Current Time' event type) set to run daily which sometimes transfers an exceptionally large number of files. Sometimes, the number of files gets so large that the trigger has to continue running the following day. Because the trigger is scheduled to run daily, it will have to run again the following day.
Unfortunately, that new execution will cause an overlap with the previous one that's already executing. In effect, two executions of the same trigger will be running simultaneously. This situation will cause a race condition that can lead to conflicts (e.g. when the two triggers compete for the same files) that will eventually cause one or both trigger executions to fail.
Obviously, you need a way to stop the second trigger execution if the same trigger is still running.
Note: While we already have the "Run trigger in single instance mode" feature in MFT Server v11, that option will only queue up the trigger for execution after the current execution is done. The issue we're talking about here calls for a solution to abandon/skip the execution altogether if a current one is still running.
The way to address this issue would be to create a dummy flag file and then modify the trigger's Trigger Condition to check for the existence of this file. You need to set the condition expression so that the trigger will only execute if the dummy flag file is not present. So, for example, if you want the trigger to execute at midnight, the condition will be something like this: