In below example, if shell script shell_script.sh
sends a job to cluster, is it possible to have snakemake aware of that cluster job's completion? That is, first, file a
should be created by shell_script.sh
which sends its own job to the cluster, and then once this cluster job is completed, file b
should be created.
For simplicity, let's assume that snakemake is run locally meaning that the only cluster job originating is from shell_script.sh
and not by snakemake .
localrules: that_job
rule all:
input:
"output_from_shell_script.txt",
"file_after_cluster_job.txt"
rule that_job:
output:
a = "output_from_shell_script.txt",
b = "file_after_cluster_job.txt"
shell:
"""
shell_script.sh {output.a}
touch {output.b}
"""
PS - At the moment, I am using sleep
command to give it a waiting time before the job is "completed". But this is an awful workaround as this could give rise to several problems.