-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update test-repo to use grapevne-helper
- Loading branch information
1 parent
4b65cdf
commit 855aa31
Showing
27 changed files
with
300 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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
12 changes: 12 additions & 0 deletions
12
.../postbuild_tests/test-repo/workflows/MyNewProject/modules/MyNewModule2/config/config.yaml
This file contains 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 @@ | ||
"input_namespace": | ||
"payload_run$": "in" | ||
"output_namespace": "payload_run" | ||
"payload_run": | ||
"name": "payload_run" | ||
"type": "module" | ||
"snakefile": "/Users/jsb/repos/jsbrittain/GRAPEVNE/electron-app/postbuild_tests/test-repo/workflows/single_modules/sources/payload_run/workflow/Snakefile" | ||
"config": | ||
"input_namespace": "in" | ||
"output_namespace": "payload_run" | ||
"params": | ||
"filename": "data.csv" |
8 changes: 8 additions & 0 deletions
8
.../postbuild_tests/test-repo/workflows/MyNewProject/modules/MyNewModule2/workflow/Snakefile
This file contains 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,8 @@ | ||
configfile: "config/config.yaml" | ||
|
||
module payload_run: | ||
snakefile: | ||
config["payload_run"]["snakefile"] | ||
config: | ||
config["payload_run"]["config"] | ||
use rule * from payload_run exclude _test as payload_run_* |
4 changes: 4 additions & 0 deletions
4
electron-app/postbuild_tests/test-repo/workflows/single_modules/modules/copy_run/.test.sh
This file contains 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,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
rm -rf results/out | ||
snakemake --cores 1 --use-conda --configfile=config/.test.yaml _test |
4 changes: 4 additions & 0 deletions
4
...app/postbuild_tests/test-repo/workflows/single_modules/modules/copy_run/config/.test.yaml
This file contains 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,4 @@ | ||
input_namespace: in | ||
output_namespace: out | ||
params: | ||
filename: data.csv |
24 changes: 13 additions & 11 deletions
24
...pp/postbuild_tests/test-repo/workflows/single_modules/modules/copy_run/workflow/Snakefile
This file contains 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 |
---|---|---|
@@ -1,20 +1,22 @@ | ||
configfile: "config/config.yaml" | ||
from grapevne_helper import * | ||
import shutil | ||
|
||
params = config["params"] | ||
init(workflow) | ||
|
||
rule copy: | ||
input: | ||
expand( | ||
"results/{indir}/{filename}", | ||
indir=config["input_namespace"], | ||
filename=params["filename"], | ||
) | ||
input(params("filename")), | ||
output: | ||
expand( | ||
"results/{outdir}/{filename}", | ||
outdir=config["output_namespace"], | ||
filename=params["filename"], | ||
) | ||
output(params("filename")), | ||
run: | ||
shutil.copy(input[0], output[0]) | ||
|
||
rule _test: | ||
input: | ||
src=rules.copy.input[0], | ||
dst=rules.copy.output[0], | ||
run: | ||
# Verify that the file has been copied correctly | ||
with open(input.src) as src, open(input.dst) as dst: | ||
assert src.read() == dst.read() |
24 changes: 24 additions & 0 deletions
24
...ild_tests/test-repo/workflows/single_modules/modules/copy_run/workflow/grapevne_helper.py
This file contains 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,24 @@ | ||
import sys | ||
import logging | ||
|
||
try: | ||
from grapevne.helpers import * # noqa: F403 | ||
except ImportError: | ||
import ensurepip | ||
import subprocess | ||
|
||
ensurepip.bootstrap() | ||
subprocess.check_call( | ||
[sys.executable, "-m", "pip", "install", "--upgrade", "grapevne"] | ||
) | ||
try: | ||
from grapevne.helpers import * # noqa: F403 F401 | ||
except ImportError: | ||
logging.error("Failed to install grapevne. Exiting.") | ||
sys.exit(1) | ||
|
||
# Tidy-up namespace | ||
del sys, logging | ||
|
||
# Dynamically export all names imported from grapevne | ||
__all__ = [name for name in dir() if not name.startswith("_")] |
4 changes: 4 additions & 0 deletions
4
...pp/postbuild_tests/test-repo/workflows/single_modules/modules/copy_run_multiport/.test.sh
This file contains 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,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
rm -rf results/out | ||
snakemake --cores 1 --use-conda --configfile=config/.test.yaml _test |
7 changes: 7 additions & 0 deletions
7
...ild_tests/test-repo/workflows/single_modules/modules/copy_run_multiport/config/.test.yaml
This file contains 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,7 @@ | ||
input_namespace: | ||
in1: in1 | ||
in2: in2 | ||
in3: in3 | ||
output_namespace: out | ||
params: | ||
filename: data.csv |
File renamed without changes.
This file contains 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
24 changes: 24 additions & 0 deletions
24
...test-repo/workflows/single_modules/modules/copy_run_multiport/workflow/grapevne_helper.py
This file contains 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,24 @@ | ||
import sys | ||
import logging | ||
|
||
try: | ||
from grapevne.helpers import * # noqa: F403 | ||
except ImportError: | ||
import ensurepip | ||
import subprocess | ||
|
||
ensurepip.bootstrap() | ||
subprocess.check_call( | ||
[sys.executable, "-m", "pip", "install", "--upgrade", "grapevne"] | ||
) | ||
try: | ||
from grapevne.helpers import * # noqa: F403 F401 | ||
except ImportError: | ||
logging.error("Failed to install grapevne. Exiting.") | ||
sys.exit(1) | ||
|
||
# Tidy-up namespace | ||
del sys, logging | ||
|
||
# Dynamically export all names imported from grapevne | ||
__all__ = [name for name in dir() if not name.startswith("_")] |
4 changes: 4 additions & 0 deletions
4
electron-app/postbuild_tests/test-repo/workflows/single_modules/sources/conda/.test.sh
This file contains 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,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
rm -rf results/out | ||
snakemake --cores 1 --use-conda --configfile=config/.test.yaml _test |
4 changes: 4 additions & 0 deletions
4
...on-app/postbuild_tests/test-repo/workflows/single_modules/sources/conda/config/.test.yaml
This file contains 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,4 @@ | ||
input_namespace: in | ||
output_namespace: out | ||
params: | ||
filename: data.csv |
24 changes: 13 additions & 11 deletions
24
...n-app/postbuild_tests/test-repo/workflows/single_modules/sources/conda/workflow/Snakefile
This file contains 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 |
---|---|---|
@@ -1,23 +1,25 @@ | ||
configfile: "config/config.yaml" | ||
from grapevne_helper import * | ||
|
||
params = config["params"] | ||
init(workflow) | ||
|
||
rule copy: | ||
input: | ||
expand( | ||
srcdir("../results/{indir}/{filename}"), | ||
indir=config["input_namespace"], | ||
filename=params["filename"], | ||
) | ||
input(params("filename")), | ||
output: | ||
expand( | ||
"results/{outdir}/{filename}", | ||
outdir=config["output_namespace"], | ||
filename=params["filename"], | ||
) | ||
output(params("filename")), | ||
conda: | ||
"envs/conda.yaml" | ||
shell: | ||
""" | ||
cp {input} {output} | ||
""" | ||
|
||
rule _test: | ||
input: | ||
src=rules.copy.input[0], | ||
dst=rules.copy.output[0], | ||
run: | ||
# Verify that the file has been copied correctly | ||
with open(input.src) as src, open(input.dst) as dst: | ||
assert src.read() == dst.read() |
24 changes: 24 additions & 0 deletions
24
...tbuild_tests/test-repo/workflows/single_modules/sources/conda/workflow/grapevne_helper.py
This file contains 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,24 @@ | ||
import sys | ||
import logging | ||
|
||
try: | ||
from grapevne.helpers import * # noqa: F403 | ||
except ImportError: | ||
import ensurepip | ||
import subprocess | ||
|
||
ensurepip.bootstrap() | ||
subprocess.check_call( | ||
[sys.executable, "-m", "pip", "install", "--upgrade", "grapevne"] | ||
) | ||
try: | ||
from grapevne.helpers import * # noqa: F403 F401 | ||
except ImportError: | ||
logging.error("Failed to install grapevne. Exiting.") | ||
sys.exit(1) | ||
|
||
# Tidy-up namespace | ||
del sys, logging | ||
|
||
# Dynamically export all names imported from grapevne | ||
__all__ = [name for name in dir() if not name.startswith("_")] |
4 changes: 4 additions & 0 deletions
4
...n-app/postbuild_tests/test-repo/workflows/single_modules/sources/container_touch/.test.sh
This file contains 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,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
rm -rf results | ||
snakemake --cores 1 --use-conda --configfile=config/.test.yaml |
17 changes: 17 additions & 0 deletions
17
...tbuild_tests/test-repo/workflows/single_modules/sources/container_touch/config/.test.yaml
This file contains 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,17 @@ | ||
input_namespace: null | ||
output_namespace: utility_touch | ||
utility_touch: | ||
config: | ||
input_namespace: null | ||
output_namespace: utility_touch | ||
params: | ||
filename: data.csv | ||
name: (Utility) touch | ||
snakefile: | ||
args: | ||
- jsbrittain/snakeshack | ||
function: github | ||
kwargs: | ||
branch: main | ||
path: workflows/Utility/modules/touch/workflow/Snakefile | ||
type: module |
This file contains 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
4 changes: 4 additions & 0 deletions
4
electron-app/postbuild_tests/test-repo/workflows/single_modules/sources/payload_run/.test.sh
This file contains 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,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
rm -rf results/out | ||
snakemake --cores 1 --use-conda --configfile=config/.test.yaml _test |
4 changes: 4 additions & 0 deletions
4
.../postbuild_tests/test-repo/workflows/single_modules/sources/payload_run/config/.test.yaml
This file contains 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,4 @@ | ||
input_namespace: in | ||
output_namespace: out | ||
params: | ||
filename: data.csv |
20 changes: 13 additions & 7 deletions
20
...postbuild_tests/test-repo/workflows/single_modules/sources/payload_run/workflow/Snakefile
This file contains 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 |
---|---|---|
@@ -1,20 +1,26 @@ | ||
configfile: "config/config.yaml" | ||
|
||
from grapevne_helper import * | ||
import os | ||
import pathlib | ||
import shutil | ||
|
||
params = config["params"] | ||
init(workflow) | ||
|
||
rule copy: | ||
input: | ||
srcdir("../resources/file"), | ||
resource("file"), | ||
output: | ||
expand( | ||
"results/{outdir}/{filename}", | ||
outdir=config["output_namespace"], | ||
filename=params["filename"], | ||
) | ||
output(params("filename")), | ||
run: | ||
pathlib.Path(os.path.dirname(output[0])).mkdir(parents=True, exist_ok=True) | ||
shutil.copy(input[0], output[0]) | ||
|
||
rule _test: | ||
input: | ||
src=resource("file"), | ||
dst=output(params("filename")), | ||
run: | ||
# Verify that the file has been copied correctly | ||
with open(input.src) as src, open(input.dst) as dst: | ||
assert src.read() == dst.read() |
24 changes: 24 additions & 0 deletions
24
..._tests/test-repo/workflows/single_modules/sources/payload_run/workflow/grapevne_helper.py
This file contains 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,24 @@ | ||
import sys | ||
import logging | ||
|
||
try: | ||
from grapevne.helpers import * # noqa: F403 | ||
except ImportError: | ||
import ensurepip | ||
import subprocess | ||
|
||
ensurepip.bootstrap() | ||
subprocess.check_call( | ||
[sys.executable, "-m", "pip", "install", "--upgrade", "grapevne"] | ||
) | ||
try: | ||
from grapevne.helpers import * # noqa: F403 F401 | ||
except ImportError: | ||
logging.error("Failed to install grapevne. Exiting.") | ||
sys.exit(1) | ||
|
||
# Tidy-up namespace | ||
del sys, logging | ||
|
||
# Dynamically export all names imported from grapevne | ||
__all__ = [name for name in dir() if not name.startswith("_")] |
4 changes: 4 additions & 0 deletions
4
...ron-app/postbuild_tests/test-repo/workflows/single_modules/sources/payload_shell/.test.sh
This file contains 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,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
rm -rf results/out | ||
snakemake --cores 1 --use-conda --configfile=config/.test.yaml _test |
4 changes: 4 additions & 0 deletions
4
...ostbuild_tests/test-repo/workflows/single_modules/sources/payload_shell/config/.test.yaml
This file contains 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,4 @@ | ||
input_namespace: in | ||
output_namespace: out | ||
params: | ||
filename: data.csv |
Oops, something went wrong.