6
我正在使用计算机集群运行很长时间的作业。有时,该过程会中断,我必须手动重新启动。当中断发生在一夜之间时,停机时间相当长。我想知道是否有办法在Julia中运行一个主管脚本来监视是否在另一个Julia实例中运行的作业。如果它被中断,它会重新启动进程,并在作业完成后终止。不幸的是,我不知道如何检查进程是否正在运行以及如何重新启动进程。这里是我的主要想法:如何自动重新启动Julia中的长时间作业
state = true
while state == true
#check every minute
sleep(60)
data = readcsv("outputfile.csv")
#read file to check if process is finished
if size(data,1) < N
#some function to check if the process is running
if isrunning() == true
#Do nothing.Keep running
else
#some function to spawn new instance of julia
#run the code
include("myscript.jl")
end
else
#Job finished, exit while loop
state = false
end
end