-
Notifications
You must be signed in to change notification settings - Fork 54
feat: remote stage in #468
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
Open
cmeesters
wants to merge
27
commits into
main
Choose a base branch
from
feat/remote_stage_in
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
ef477d0
proposed fix for https://github.com/snakemake/snakemake-executor-plug…
8d033ce
Merge branch 'main' of github.com:snakemake/snakemake-executor-plugin…
cmeesters ed1e50d
Merge branch 'main' of github.com:snakemake/snakemake-executor-plugin…
cmeesters 677c66c
Merge branch 'main' of github.com:snakemake/snakemake-executor-plugin…
cmeesters f95510c
Merge branch 'main' of github.com:snakemake/snakemake-executor-plugin…
cmeesters 4bcb0af
Merge branch 'main' of github.com:snakemake/snakemake-executor-plugin…
cmeesters 1770a76
Merge branch 'main' of github.com:snakemake/snakemake-executor-plugin…
cmeesters ba6f127
Merge branch 'main' of github.com:snakemake/snakemake-executor-plugin…
cmeesters 847e264
feat: added flag for node local stage-in directory
cmeesters 7d15c33
feat: escaping optional env vars existing only on remote nodes
cmeesters cc6b6c5
fix: formatting
cmeesters 1bf35b2
fix: black-stable formatting?
cmeesters 69d62af
feat: added test files
cmeesters 181e9a6
test: added debug info to the ci.yml
cmeesters 698d0d0
fix: formatting
cmeesters 6cb2b6d
docs: added doc section on auto stage-in
cmeesters ad51e21
fix: formatting
cmeesters 0336581
feat: allowing to disable auto stage-in and added a warning for big f…
cmeesters be09f33
fix: formatting
cmeesters 037495e
fix: formatting
cmeesters 6f533e1
fix: adjusted testcase threshold to 4GB as is the current code standard
cmeesters 99e3c69
Update .github/workflows/ci.yml
cmeesters c5c76e3
Merge branch 'feat/remote_stage_in' of github.com:snakemake/snakemake…
cmeesters 024803e
fix: potetial issue with checking file size
cmeesters 6869eb5
fix: gnarf - syntax error by ommitted line fixed
cmeesters 145d545
fix: requiring one python target version for black
cmeesters 411d053
fix: formatting
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
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 @@ | ||
| from snakemake_executor_plugin_slurm.utils import encode_deferred_envvars | ||
|
|
||
|
|
||
| def test_encode_deferred_envvars_rewrites_simple_env_vars(): | ||
| assert ( | ||
| encode_deferred_envvars("/localscratch/$SLURM_JOB_ID") | ||
| == "/localscratch/__ENV_SLURM_JOB_ID__" | ||
| ) | ||
| assert ( | ||
| encode_deferred_envvars("/localscratch/${SLURM_JOB_ID}/run") | ||
| == "/localscratch/__ENV_SLURM_JOB_ID__/run" | ||
| ) | ||
|
|
||
|
|
||
| def test_encode_deferred_envvars_leaves_literal_text_alone(): | ||
| assert encode_deferred_envvars("/localscratch/job-1") == "/localscratch/job-1" | ||
| assert ( | ||
| encode_deferred_envvars(r"/localscratch/\$SLURM_JOB_ID") | ||
| == r"/localscratch/\$SLURM_JOB_ID" | ||
| ) |
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,123 @@ | ||
| from pathlib import Path | ||
| from typing import Optional | ||
|
|
||
| import snakemake.common.tests | ||
| import snakemake.settings.types as settings | ||
| from snakemake import api | ||
| from snakemake.settings.types import ConfigSettings | ||
| from snakemake_interface_executor_plugins.settings import ExecutorSettingsBase | ||
|
|
||
| from snakemake_executor_plugin_slurm import ExecutorSettings | ||
|
|
||
|
|
||
| class LocalStageinTestcasesBase(snakemake.common.tests.TestWorkflowsLocalStorageBase): | ||
| """Resolve stage-in testcases from this plugin's tests/testcases directory.""" | ||
|
|
||
| def get_config_settings(self) -> Optional[ConfigSettings]: | ||
| return None | ||
|
|
||
| def run_workflow(self, test_name, tmp_path, deployment_method=frozenset()): | ||
| test_path = Path(__file__).parent / "testcases" / test_name | ||
| if not test_path.exists(): | ||
| return super().run_workflow(test_name, tmp_path, deployment_method) | ||
|
|
||
| if self.omit_tmp: | ||
| tmp_path = test_path | ||
| else: | ||
| tmp_path = Path(tmp_path) / test_name | ||
| self._copy_test_files(test_path, tmp_path) | ||
|
|
||
| resource_settings = self.get_resource_settings() | ||
|
|
||
| if self._common_settings().local_exec: | ||
| resource_settings.cores = 3 | ||
| resource_settings.nodes = None | ||
| else: | ||
| resource_settings.cores = 1 | ||
| resource_settings.nodes = 3 | ||
|
|
||
| with api.SnakemakeApi( | ||
| settings.OutputSettings( | ||
| verbose=True, | ||
| show_failed_logs=True, | ||
| ), | ||
| ) as snakemake_api: | ||
| workflow_api = snakemake_api.workflow( | ||
| config_settings=self.get_config_settings(), | ||
| resource_settings=resource_settings, | ||
| storage_settings=settings.StorageSettings( | ||
| default_storage_provider=self.get_default_storage_provider(), | ||
| default_storage_prefix=self.get_default_storage_prefix(), | ||
| shared_fs_usage=( | ||
| settings.SharedFSUsage.all() | ||
| if self.get_assume_shared_fs() | ||
| else frozenset() | ||
| ), | ||
| ), | ||
| deployment_settings=self.get_deployment_settings(deployment_method), | ||
| storage_provider_settings=self.get_default_storage_provider_settings(), | ||
| workdir=Path(tmp_path), | ||
| snakefile=tmp_path / "Snakefile", | ||
| ) | ||
|
|
||
| dag_api = workflow_api.dag() | ||
| dag_api.execute_workflow( | ||
| executor=self.get_executor(), | ||
| executor_settings=self.get_executor_settings(), | ||
| execution_settings=settings.ExecutionSettings( | ||
| latency_wait=self.latency_wait, | ||
| ), | ||
| remote_execution_settings=self.get_remote_execution_settings(), | ||
| ) | ||
|
|
||
|
|
||
| class TestStageInSbcast(LocalStageinTestcasesBase): | ||
| """Integration test for sbcast stage-in with a small synthetic input.""" | ||
|
|
||
| __test__ = True | ||
|
|
||
| def get_executor(self) -> str: | ||
| return "slurm" | ||
|
|
||
| def get_executor_settings(self) -> Optional[ExecutorSettingsBase]: | ||
| return ExecutorSettings( | ||
| init_seconds_before_status_checks=2, | ||
| node_local_prefix="/tmp/snakemake-stagein", | ||
| ) | ||
|
|
||
| def test_stagein_sbcast(self, tmp_path): | ||
| self.run_workflow("stagein_sbcast", tmp_path) | ||
|
|
||
| run_dir = Path(tmp_path) / "stagein_sbcast" | ||
| count_file = run_dir / "counted" / "count.txt" | ||
| sbcast_log = run_dir / "log" / "sbcast.log" | ||
|
|
||
| assert count_file.exists() | ||
| assert sbcast_log.exists() | ||
| assert count_file.read_text().strip().startswith("3 ") | ||
|
|
||
|
|
||
| class TestStageInSSH(LocalStageinTestcasesBase): | ||
| """Optional integration test for SSH stage-in with a sparse large input.""" | ||
|
|
||
| __test__ = True | ||
|
|
||
| def get_executor(self) -> str: | ||
| return "slurm" | ||
|
|
||
| def get_executor_settings(self) -> Optional[ExecutorSettingsBase]: | ||
| return ExecutorSettings( | ||
| init_seconds_before_status_checks=2, | ||
| node_local_prefix="/tmp/snakemake-stagein", | ||
| ) | ||
|
|
||
| def test_stagein_ssh(self, tmp_path): | ||
| self.run_workflow("stagein_ssh", tmp_path) | ||
|
|
||
| run_dir = Path(tmp_path) / "stagein_ssh" | ||
| size_file = run_dir / "measured" / "size.txt" | ||
| ssh_log = run_dir / "log" / "ssh.log" | ||
|
|
||
| assert size_file.exists() | ||
| assert ssh_log.exists() | ||
| assert "data/big" in size_file.read_text() |
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,25 @@ | ||
| inputflags: | ||
| access.sequential | ||
|
|
||
|
|
||
| rule all: | ||
| input: | ||
| "counted/count.txt" | ||
|
|
||
|
|
||
| rule make_words: | ||
| output: | ||
| "data/words" | ||
| shell: | ||
| "printf 'alpha\nbeta\ngamma\n' > {output}" | ||
|
|
||
|
|
||
| rule use_sbcast: | ||
| input: | ||
| access.random("data/words") | ||
| output: | ||
| "counted/count.txt" | ||
| log: | ||
| "log/sbcast.log" | ||
| shell: | ||
| "wc -l {input} > {output}" |
Oops, something went wrong.
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.