iqbal-lab-org / pling

Plasmid analysis using rearrangement distances
MIT License
25 stars 1 forks source link

No easy way to unlock the current dir #51

Closed leoisl closed 4 months ago

leoisl commented 6 months ago

To snakemake --unlock a dir, which we need when the pipeline is preemptively killed, we need to provide a valid Snakefile, but all Snakefiles in pling fails if we call them directly with --unlock without a configfile, e.g.:

$ snakemake -s pling/batching/Snakefile --unlock
KeyError in file /hps/nobackup/iqbal/leandro/leah/roundhound_fix_158/pipelines/evaluate_no_spike_ins/pling_2/pling/batching/Snakefile, line 3:
'output_dir'
  File "/hps/nobackup/iqbal/leandro/leah/roundhound_fix_158/pipelines/evaluate_no_spike_ins/pling_2/pling/batching/Snakefile", line 3, in <module>

We have similar error messages if we use the other Snakefiles pling defines.

It does work however if you provide a configfile that was previously created with pling:

$ snakemake -s pling/batching/Snakefile --configfile pling_out/tmp_files/config.yaml --unlock
Unlocking working directory.

This requires a bit of snakemake and pling internal files knowledge from the user though, this configfile is not always available, and pipelines are frequently preemptively killed. I am not sure how you want to solve this issue. It could be just a note in the README, or we could add a --unlock parameter to run_pling.py to automatically handle this, or another approach, etc... But I think is worth providing a solution to this

babayagaofficial commented 4 months ago

Another possibility is to add the --nolock argument to all the snakemake runs. The argument tells snakemake not to lock the working directory, hence the directory locked error won't come up if you run after having killed a pipeline. I think not locking the working directory is only an issue if there are two snakemake workflows producing the same output files running at the same time. So the question is, to what extent do we want to rely on users not doing that.

iqbal-lab commented 4 months ago

I think it's OK to tell users not to run two at the same time in the same working dir. Is true if many tools

babayagaofficial commented 4 months ago

okay then, I've fixed this issue by adding --nolock!