Run executable in edge workflow in background

#1

I am wondering if there is a way to flag an executable to be run in the background as part of an edge workflow. I have tried variations of &, nohup, disown and all seem to still wait for the long running process to complete and return the result in the stdout result payload. I am sure this is great in some circumstances but I am concerned about the potential of the return to exceed the 30 sec max run time on the run exe.

#2

To use & or nohup, the process needs to be within a shell - and the workflow engine executes the command defined in the execute node directly as a child process. You can get the effect you want, however, by wrapping the execution within a shell - for example, the if you have the execute node execute the command bash -c "sleep 100 &", that sleep command will continue to run after the workflow finishes.

1 Like
#3

Thanks for your suggestion. I tried using the bash -c wrapper and although it did successfully disconnect me from stdout, it did still seem to stall the workflow until the wrapped command completed. Essentially what I am trying to is download a file (think wget) and don’t want the workflow to wait given the variability of the download time and potential to breech to maximum workflow execution time.

#4

We are going to go ahead and add an option on that node for ‘detaching’ from the executable, which should solve this problem. I’ll let you know when that makes it into a release of the edge agent!

#5

Thanks Michael - appreciate your help. Let me know if you want me to validate anything before your next edge agent release