Skip to content
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

Add {attempt} expansion to configuration #1231

Open
LiterallyUniqueLogin opened this issue Oct 21, 2021 · 2 comments
Open

Add {attempt} expansion to configuration #1231

LiterallyUniqueLogin opened this issue Oct 21, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@LiterallyUniqueLogin
Copy link

Is your feature request related to a problem? Please describe.
I only want to be emailed by SLURM when the job that I submit fails on its last retry.

Describe the solution you'd like
I want to be able to configure this in my profile's config.yaml:

restart-times: 1
cluster:
  sbatch:
     --account XXX
     --partition XXX
     $(if (({attempt} == 2)) ; then echo '--mail-type FAIL --mail-user me@email.com' ; fi)
     # ...

But trying to expand {attempt} throws a NameError.

Describe alternatives you've considered
I used the solution from this issue ( #742 ). I'm creating a new issue, since they're asking for this feature in cluster config, which is deprecated. I want this in profile configuration

What currently works: In my profile's config.yaml:

restart-times: 1
resources:
  - attempt=0 # this doesn't correspond to the retry attempt. That needs to be manually set in the snakefile
cluster:
  sbatch:
     --account XXX
     --partition XXX
     $(if (({resources.attempt} == 2)) ; then echo '--mail-type FAIL --mail-user me@email.com' ; fi)
     # ...

My snakefile:

rule test:
  output:
    'test.txt'
  resources:
    attempt = lambda wildcards, attempt: attempt
  run:
    assert False

This only emails me on the second attempt. But I have to insert the attempt resources into every rule for which I wish this to be true.

@LiterallyUniqueLogin LiterallyUniqueLogin added the enhancement New feature or request label Oct 21, 2021
@SichongP
Copy link
Contributor

SichongP commented Nov 8, 2021

Does setting default-resources work?

@LiterallyUniqueLogin
Copy link
Author

@SichongP The current solution with resources works but is hacky, I'm asking for a solution that doesn't involve using resources but can access 'attempts' directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants