Replies: 3 comments 11 replies
-
I should note that while I referred to kslurm extensively, the problem is not caused by kslurm, and would occur anytime someone tried to run a local installation. In fact, without kslurm, the above steps would be even more complicated |
Beta Was this translation helpful? Give feedback.
-
re: the proposed solution -- I'm not sure why we can't just make most of the modifications to the jobscript shell script instead, ie add the logic there to load and activate the venv, then don't have to much around with changing the snakemake calls -- or maybe I'm missing something.. |
Beta Was this translation helpful? Give feedback.
-
I was just suggesting a hybrid of the two -- if say you're already using kslurm/kpy to manage your venvs, and now you want to run a job across nodes. You export, then you run. Right now the workflow would be more disruptive (ie make an entirely new venv on /scratch) |
Beta Was this translation helpful? Give feedback.
-
Ran into this issue yesterday, and if I infer correctly, others have been experiencing it too.
I was attempting to run snakedwi yesterday using the following protocol:
So far, so good. The trouble comes when I want to enable snakemake cluster integration to run the job on multiple clusters. The issue is that the entire snakemake app is installed into local scratch, which cannot be shared across jobs.
The quick, easy solution is to always install snakemake apps into a shared fs (e.g. shared
scratch
). This side steps the problem entirely. Unfortunately, you lose the efficiencies gained by the localscratch installation.The best way I can come up with currently to maintain the local install looks like the following sketch:
slurm-submit.py
(based of e.g.cc-slurm
or similar)slurm-submit.py
must:a. Check if the job is being run in a virtual env (e.g. via
$VIRTUAL_ENV
)b. Check if the virtual env is within localscratch (e.g. is
$VIRTUAL_ENV
relative to$SLURM_TMPDIR
)c. Check if the python executable being used is a part of that
$VIRTUAL_ENV
)d. Assume that, if all of the above are true, that kpy is being used for cluster virtual env management
e. Read the relevant virtual env files to deduce the name of the virtual env (this information would be dropped in the venv config file by kpy)
f. Generate the venv loading code.
a. The python path is fairly straightforward, just regex for the
/path/to/python -m
portion of the file and replace with$VIRTUAL_ENV/bin/python
.b. The snakefile path is a bit harder. Search for
--snakefile /path/to/Snakefile
, then, if it's relative to our current$VIRTUAL_ENV
, we make it relative to the new$VIRTUAL_ENV
. Otherwise, if it's relative to$SLURM_TMPDIR
, we error out, because we won't have access to it. Otherwise, we assume it's on shared fs.Obviously, step 2 could be made easier by directly specifying what kpy env to use. The best way I can think of would be to use a
--default-resource
provision in the call, which could then be picked up byslurm-submit.py
.Overall, the solution is fairly hacky, but I'm not sure it could be any more streamlined. Snakemake could potentially make the submit script template more granular, so that python path or snakefile path could be provided separately, but that would only eliminate a few substeps. Importantly, I can't see any world where this can be done without a purpose-built
slurm-submit.py
.So I guess the question is whether it's worth implementing the above plan, or just deciding that we don't support localscratch-installed apps.
Beta Was this translation helpful? Give feedback.
All reactions