-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unterminated string literal syntax error parsing slurm_extra #18
Comments
Please try: |
Of course I tried that.
This is an example I have been mucking with to try to get the slurm plugin to run what was working Snakemake 7 and Yes, |
Oh, can you please try: |
The error changes, but still reporting that it's missing the closing quote:
Resources
|
this is no valid yaml-format either, try something like:
Additional rules are described with the same indentation level as |
With:
I get the original
|
Well, I created a minimal example to chase this. Seems to be a bug transporting the information to the SLURM job context. Minimal example:
Profile: $ cat profiles/config.yaml
set-resources:
test1:
slurm_partition: "smp"
test2:
slurm_partition: "smp" Call: Tries to hand to the jobstep a correct call, yet also the following (obtained by printf-debugging):
Which cannot be evaluated. I did not notice this at first, as default resources get transported fine (as far as I can see) and the workflow I was trying had sufficient defaults. Resources, however, fail to be set correctly in the jobstep context, due to the erroneous submission command line. This is hence a bug in snakemake-core. We are on it. |
Thank you! |
Hi Christian and Peter, recently I also encountered this issue when attempting to migrate my workflow to snakemake v8 and I do not think that this issue is only in snakemake-core, however I think it is a complicated interaction between the core and this module. I tried to pass
to my workflow. Please note that the syntax with From what I can see right now there are two potential sources of errors that arise when the resources get parsed:
Iam currently trying two fixes for these problems and can update you or provide a PR if desired and if my workflow executes properly:
call += f' --wrap="{re.sub(r"([\"])", r"\\\1", exec_job)}"' |
I think I'm running into the same problem trying to name jobs by their rules and output slurm logs to named files:
Different iterations on this either fail with the evaluate default resources value error or do replace the %x and %j but %x becomes the slurm assigned job name (some random alphanumeric string). How do I get the snakemake job names to come through here? This was working with snakemake 7. |
The only workaround I could find is to move |
Hmm that is not ideal. Do you know if there's an open issue/PR for this on snakemake core? |
There is a merge request in this thread adding a test case. I am not familiar with organisation of this project, but if it is test driven development, then maybe fix goes later in the same merge request. |
@Ulthran I think changing the job name generated by this plugin can not work at all due to
which specifies the job name explicitly and sets it to a random uuid4 that is generated once on the first initialization of the workflow / executor object. I also think that this is not a particularly good idea, and dont really know why it is needed, perhaps one of the original authors can shed some light on that. I would also much prefer to be able to set the |
### Description The PR is related to the[ issue described for the slurm submit executor](snakemake/snakemake-executor-plugin-slurm#18) plugin to not correctly hand over arguments. The test folder is named `test_slurm_resource_propagation meesters` and may not be complete, as it covers multiple related scenarios to provoke the error. Note, that the tests were carried out when using a cluster: - `$ snakemake --executor slurm -j2 --workflow-profile ./profiles/ --default-resources slurm_account=<account>` yields ``Error: WorkflowError: Failed to evaluate default resources value '<function eval_resource_expression.<locals>.callable at 0x7f5c19ed0e00>'.``` when the patition is defined at the rule level in a profile. (see the directory of the test case) - likewise `$ snakemake --executor slurm -j2 --workflow-profile ./profiles/ --default-resources slurm_account=<account> --set-resources slurm_extra="--nice=150"` yields ```ValueError: Invalid resource definition: entries have to be defined as RULE:RESOURCE=VALUE, with VALUE being a positive integer a quoted string, or a Python expression (e.g. min(max(2*input.size_mb, 1000), 8000)).``` These errors can both be triggered on the command line and in the config file, of course. ### QC * [x] The PR contains a test case for the changes or the changes are already covered by an existing test case. * [ ] The documentation (`docs/`) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake). --------- Co-authored-by: Johannes Koester <[email protected]> Co-authored-by: Johannes Köster <[email protected]>
This is fixed in v8.4.3 - as mentioned in the linked PR here above. However, another fix is forthcoming. Stay tuned. |
v8.4.4 is out. Alas, I cannot test it right now, for the lack of a cluster (maintenance). You might want to give it a try. |
I see the same error as before with Snakemake 8.4.4 and slurm executor plugin 0.3.0. Versions:
Error:
|
I could be missing something but I'm still not able to access the rule name to pass through to
EDIT: Don't set the
Once #35 is included in a release, this shouldn't be necessary anymore. |
Previously it was failing before submission to Slurm. Now an error appears when the job gets to a node. |
Ah, it took me to understand this |
@Ulthran A not very satisfactory workaround for the hard-coded job name might be to use job comments instead: Snakemake-Profiles/slurm#117 (comment) Edit: I hadn't seen your later post with a better hack. Thanks for sharing. |
I think I have an idea. PR is in preparation. |
[> Ulthran](#18 (comment)) @blaiseli I just edited that comment. Note that setting the |
@ALL please update Snakemake and this executor plugin to the newest releases and try again. |
I am still getting parsing errors trying to set --qos through slurm_extra. Was this update just related to the job name issues? I also couldn't get it to replace the job name (jobs are submitted as "%x" to Slurm). As a side note, what's the best way to install the plugin from the git repo (latest version on bioconda is 0.3.0)? I created a minimal setup.py, and that seems to work. Here's the snakemake packages I have in my test conda environment (installed dependencies, then snakemake-executor-plugin-slurm from the github repos with setup.py):
Package `snakemake-exeucutor-plugin-slurm' doesn't show up here, but snakemake only finds the plugin after I install from the repo (commit 3b6a359). Let me know if I'm testing something incorrectly. Thanks! |
Anyway, for me, Now, whether you install the software stack with conda/mamba/micromamba or poetry or write your own setup scripts - as long as everything is part of one environment, it should be fine. You can check whether all packages are under one My workflow profile for testing:
Notwithstanding different partition, accounts and the little fact that you are using a Please run your workflow with |
Submission still fails. I am testing following profile executor: slurm
default-resources:
slurm_partition: some-partition
tasks: 1
threads: 10
slurm_extra: "'--gres=gpu:1'" With following Snakemake packages [email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected] Slurm 23.11.4 Submission to Slurm fails after it reaches a node
Error in rule force_field:
message: SLURM-job '9731003' failed, SLURM status is: 'FAILED'For further error details see the cluster/cloud log and the log files of the involved rule(s).
Running with
Identical profile is fine with Snakemake 7. |
I was able to get this working with the latest Snakemake and slurm plugin:
Seems to schedule correctly. If I single-quote around the whole string, Slurm fails. Again, thank you. It looks like I'll be able to push my GPU workflows now. |
Hm, weird - I tried with my cluster and it works fine. Probably worth investigation further. Anyway, I am curious to learn about your workflow and hope you push it to the snakemake workflow catalogue. I just taught a course on a cluster with different logins for gpu-based work and cpu-based work. This is totally unusual and would break any combined workflow - hence an existing curated workflow, may probably convince those colleagues of mine to reconsider their setup. |
When parsing a
slurm_extra
resource, I getSyntaxError: unterminated string literal
.In my profile, I have
set-resources
with- test_rule:slurm_extra=--queue='gpu_dev'
. The error message says:The error message has imbalanced single-quotes. The first and last are part of the error-handling code, so it looks like it's trying to eval
--queue='gpu_dev
. I'm not sure where the quotes are being stripped, and trying to "trick" it by adding additional quotes to the end of theslurm_extra
parameter doesn't get around it.Snakemake: 8.1.0
snakemake-executor-plugin-slurm: 0.1.4
python: 3.12.1
Command and output:
Attached Snakemake and profile:
unterminated_issue.tar.gz
The text was updated successfully, but these errors were encountered: