-
Notifications
You must be signed in to change notification settings - Fork 29
feat: added new 'qos' resource #241
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
Changes from 27 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
95304e5
feat: added new 'qos' resource
cmeesters be90c19
Merge branch 'main' into feat/add-qos-flag
cmeesters 64aa03e
fix: typo
cmeesters 8743a3a
Merge branch 'feat/add-qos-flag' of github.com:snakemake/snakemake-ex…
cmeesters 55716c6
feat: new tests for the 'constraint' and 'qos' resources
cmeesters 7522792
fix: linting of tests.py
cmeesters 0c74d04
fix: trying workflow fix with pytest upgrade
cmeesters 4ec357f
fix: revoking last commit - did not help
cmeesters 9f2a8a6
fix: attempt by reordering tests
cmeesters 1aca875
fix: syntax fix
cmeesters 404f38b
fix: trying fix fixture
cmeesters 9abdadd
fix: trying fix fixture - now with io streams - another try
cmeesters 076eb7b
fix: revoked last two commits
cmeesters 22d70de
fix: unused import
cmeesters 34dff5d
fix: trying updated pytest
cmeesters b5e951a
fix: forcing different stream
cmeesters 7257642
fix: syntax
cmeesters 34990d9
trial: outcommenting offending function
cmeesters 226f3c6
fix: trying different mock setup
cmeesters 24d2e2d
fix: added missing fixture
cmeesters cb1d178
fix: trying process mock
cmeesters 08e702b
fix: everywhere - a mock popen
cmeesters 06a27c9
refactor: moved submit string creation into own file to facilitate te…
cmeesters e481380
Merge branch 'main' into feat/add-qos-flag
cmeesters b3cc9f8
fix: blacked
cmeesters ecba9c4
fix: blacked
cmeesters d69631c
Merge branch 'feat/add-qos-flag' of github.com:snakemake/snakemake-ex…
cmeesters da5a727
fix: removed doubled check for clusters
cmeesters 553eaf7
Update snakemake_executor_plugin_slurm/submit_string.py
cmeesters ead02f7
Merge branch 'feat/add-qos-flag' of github.com:snakemake/snakemake-ex…
cmeesters ac1c562
Update snakemake_executor_plugin_slurm/submit_string.py
cmeesters f198593
Update snakemake_executor_plugin_slurm/submit_string.py
cmeesters fab9390
Merge branch 'feat/add-qos-flag' of github.com:snakemake/snakemake-ex…
cmeesters b0a6661
refactor: now, using SimpleNamespace to enable attribute-style access…
cmeesters File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from snakemake_executor_plugin_slurm_jobstep import get_cpu_setting | ||
|
||
|
||
def get_submit_command(job, params): | ||
""" | ||
Return the submit command for the job. | ||
""" | ||
call = ( | ||
f"sbatch " | ||
f"--parsable " | ||
f"--job-name {params['run_uuid']} " | ||
f"--output \"{params['slurm_logfile']}\" " | ||
f"--export=ALL " | ||
f"--comment \"{params['comment_str']}\"" | ||
) | ||
|
||
# check whether an account is set | ||
if params.get("account"): | ||
call += f" {params['account']} " | ||
# check whether a partition is set | ||
if params.get("partition"): | ||
call += f" {params['partition']}" | ||
cmeesters marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if job.resources.get("clusters"): | ||
call += f" --clusters {job.resources.clusters}" | ||
|
||
if job.resources.get("runtime"): | ||
call += f" -t {job.resources.runtime}" | ||
|
||
if job.resources.get("clusters"): | ||
call += f" --clusters {job.resources.clusters}" | ||
|
||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if job.resources.get("constraint") or isinstance( | ||
job.resources.get("constraint"), str | ||
): | ||
call += f" -C '{job.resources.get('constraint')}'" | ||
cmeesters marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if job.resources.get("qos") or isinstance(job.resources.get("qos"), str): | ||
call += f" --qos='{job.resources.get('qos')}'" | ||
cmeesters marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if job.resources.get("mem_mb_per_cpu"): | ||
call += f" --mem-per-cpu {job.resources.mem_mb_per_cpu}" | ||
elif job.resources.get("mem_mb"): | ||
call += f" --mem {job.resources.mem_mb}" | ||
|
||
if job.resources.get("nodes", False): | ||
call += f" --nodes={job.resources.get('nodes', 1)}" | ||
|
||
# fixes #40 - set ntasks regardless of mpi, because | ||
# SLURM v22.05 will require it for all jobs | ||
gpu_job = job.resources.get("gpu") or "gpu" in job.resources.get("gres", "") | ||
if gpu_job: | ||
call += f" --ntasks-per-gpu={job.resources.get('tasks', 1)}" | ||
else: | ||
call += f" --ntasks={job.resources.get('tasks', 1)}" | ||
|
||
# we need to set cpus-per-task OR cpus-per-gpu, the function | ||
# will return a string with the corresponding value | ||
call += f" {get_cpu_setting(job, gpu_job)}" | ||
if job.resources.get("slurm_extra"): | ||
call += f" {job.resources.slurm_extra}" | ||
|
||
# ensure that workdir is set correctly | ||
# use short argument as this is the same in all slurm versions | ||
# (see https://github.com/snakemake/snakemake/issues/2014) | ||
call += f" -D '{params['workdir']}'" | ||
cmeesters marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
return call |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.