Is there an action to check if a task is currently running on the server? I'd like to skip calling a task to run if it's already running so it does not error out. Basically looking for an option here that says don't fail if task is running.
While it's probably too late, but I just figured out a workaround:
In the task, set (remember) a Shared Memory key at the start of the task and delete it (forget) at the end of the task.
In the workflow that triggers the task, check if that Shared Memory key is set, and if yes - skip triggering the task.
Alternatively, enable multiple simultaneous instances of the task (parallel execution), and in the start of the task check if the Shared Memory key is set. If yes - exit, otherwise set the key and keep running. Delete the key at the end. In this scenario, the logic is shifted from the calling workflow, to the called task.
I took your idea and added a Repeat action so that it will just put the model on hold until the process finishes running and deletes the shared memory then proceeds. Thanks for the idea.
If your intent was to delay execution, not to skip it (as I assumed initially), then it can be done even simpler:
Wrap the "Server command" action that runs the task with the "Exclusive access" action. Put "Start exclusive access" before the command, and "Finish exclusive access" right after it. That's it. No need to use Shared Memory or Repeat. Make sure to use the same resource name in the Start and Finish actions (before and after) so that the finish can be related to the start.
When the action starts exclusive access, then any other workflow that tries to start exclusive access with the same resource name will wait until the first workflow finishes access (releases the resource).
The only downside compared with the "SharedMemory + Repeat" combination is that "Exclusive access" only works for workflows running on the same computer, while using Shared Memory + Repeat allows managing access by workflows on different computers as long as they work with the same Server repository.
Thanks, I learned a new action today. My initial intent was to just skip if it was running, but there are certain cases where I needed it to wait and then run. I'll probably keep the sharedmemory as models are being run across multiple machines. But the exclusive access will be helpful in other spots for me.