I have a folder with a lot of .sh scripts. How can I use an already set up dask distributed cluster to run them in parallel?
Currently, I am doing the following:
import dask, distributed, os
# list with shell commands that I want to run
commands = ['./script1.sh', './script2.sh', './script3.sh']
# delayed function used to execute a command on a worker
run_func = dask.delayed(os.system)
# connect to cluster
c = distributed.Client('my_server:8786')
# submit job
futures = c.compute( [run_func(c) for c in commands])
# keep connection alive, do not exit python
import time
while True:
time.sleep(1)
This works, however for this scenario it would be ideal if the client could disconnect without causing the scheduler to cancel the job. I am looking for a way to compute my tasks that does not require an active client connection. How could this be done?