Skip to content

fix: skip account setting upon user request #224

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

Merged
merged 11 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/post_to_mastodon.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

# Extract version from PR tag passed as environment variable
if [ -z "${PR_TITLE}" ]; then
echo "Error: 'PR_TITLE' environment variable is not set."
if [ -z "${PR_TITLE}" ]; then # apparently unset, workflow broken?
>&2 echo "Error: 'PR_TITLE' environment variable is not set."
exit 1
fi

Expand Down
3 changes: 3 additions & 0 deletions docs/further.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ To specify them at the command line, define them as default resources:
$ snakemake --executor slurm --default-resources slurm_account=<your SLURM account> slurm_partition=<your SLURM partition>
```

The plugin does its best to _guess_ your account. That might not be possible. Particularly, when dealing with several SLURM accounts, users ought to set them per workflow.
Some clusters, however, have a pre-defined default per user and _do not_ allow users to set their account. The plugin will attept to always set an account. To override this behauvior, the `--slurm-no-account` flag can be used.

If individual rules require e.g. a different partition, you can override
the default per rule:

Expand Down
13 changes: 12 additions & 1 deletion snakemake_executor_plugin_slurm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ class ExecutorSettings(ExecutorSettingsBase):
"required": False,
},
)
no_account: bool = field(
default=False,
metadata={
"help": "Do not use any account for submission. "
"This flag has no effect, if not set.",
"env_var": False,
"required": False,
},
)


# Required:
Expand Down Expand Up @@ -213,7 +222,9 @@ def run_job(self, job: JobExecutorInterface):
f"--comment '{comment_str}'"
)

call += self.get_account_arg(job)
if not self.workflow.executor_settings.no_account:
call += self.get_account_arg(job)

call += self.get_partition_arg(job)

if self.workflow.executor_settings.requeue:
Expand Down