-
Notifications
You must be signed in to change notification settings - Fork 633
feat: optionally auto-group jobs via temp files in case of remote execution #3378
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 all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
da20e7a
adding nodelocal
DrYak 8b749fc
nodelocal in usergroup
DrYak 53790cf
Fix resources in sub-job
DrYak 0c37066
nodelocal test
DrYak cf44ef0
track creation of local storage
DrYak 8b9fad8
comments and code clarity, inspired by coderabitai
DrYak 168e620
doc nodelocal
DrYak 5496af9
doc: clarity
DrYak 3f7132d
feat: new semantic "group_jobs"
DrYak 54d56b8
Update docs/snakefiles/rules.rst
johanneskoester 1c6e694
Update rules.rst
johanneskoester 2baf2cd
Merge branch 'main' into feature_localtemp
johanneskoester 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
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,36 @@ | ||
| rule all: | ||
| input: | ||
| "results/result.txt", | ||
|
|
||
|
|
||
| rule create_nodelocal_temp: | ||
| output: | ||
| temp("scratch/temp.txt", group_jobs=True), | ||
| shell: | ||
| """ | ||
| sleep 4 | ||
| echo "test" > "{output}" | ||
| """ | ||
|
|
||
|
|
||
| rule create_nodelocal_persist: | ||
| output: | ||
| flag("scratch/persist.txt", "nodelocal"), | ||
| shell: | ||
| """ | ||
| sleep 4 | ||
| echo "test" > "{output}" | ||
| """ | ||
|
|
||
|
|
||
| rule consume_nodelocal: | ||
| input: | ||
| tmp="scratch/temp.txt", | ||
| persist="scratch/persist.txt", | ||
| output: | ||
| "results/result.txt", | ||
| shell: | ||
| """ | ||
| ls "{input.tmp}" > "{output}" | ||
| ls "{input.persist}" >> "{output}" | ||
| """ |
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 @@ | ||
| local |
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 @@ | ||
| test |
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,2 @@ | ||
| scratch/temp.txt | ||
| scratch/persist.txt |
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,12 @@ | ||
| #!/bin/sh | ||
|
|
||
| # Simulates node-local storage (a.k.a. "local scratch"): | ||
| # - files and paths only accessible within a single compute node | ||
| # - NOT accessible on other nodes nor on the login node | ||
|
|
||
| mkdir -p scratch local | ||
|
|
||
| # Unshare the mount namespace: | ||
| # - mounts within qsub_stage2 NOT shared with other processes | ||
| # - outer process will keep seeing "scratch" unaffected | ||
| unshare --mount --map-root-user ./qsub_stage2 "$@" |
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,20 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Simulates node-local storage (a.k.a. "local scratch"): | ||
| # - files and paths only accessible within a single compute node | ||
| # - NOT accessible on other nodes nor on the login node | ||
| # | ||
| # Make the mount namespace private and bind 'local' to appear as 'scratch' within the namespace | ||
| mount --make-rprivate --bind local scratch | ||
| # Create a marker file to verify the binding is limited | ||
| # - current script ^will see it into "scratch/" too | ||
| # - outer calling processes will only see it in "local/", will never see content appearing in "scratch/" | ||
| echo "local" > scratch/local | ||
|
|
||
| # normal qsub like other cluster-simulated tests | ||
|
|
||
| echo `date` >> qsub.log | ||
| tail -n1 $1 >> qsub.log | ||
| # simulate printing of job id by a random number | ||
| echo $RANDOM | ||
| sh $1 | ||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add error handling for mount command.
The mount command might fail due to insufficient permissions or if directories don't exist, but the script continues regardless of the outcome.
📝 Committable suggestion