Skip to content

Commit 75d6ae4

Browse files
committed
Use new extension logger
1 parent 44f1e39 commit 75d6ae4

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ jobs:
2222
- name: Dump Logs
2323
shell: bash
2424
if: always()
25-
run: tail -n +1 logs/*
25+
run: tail -n +1 logs/* || true
2626

2727
- name: Dump Stats
2828
shell: bash
2929
if: always()
30-
run: cat stats/*
30+
run: cat stats/* || true

.tests/data/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Test data
2+
3+
## reads
4+
5+
From sunbeam/tests/data

.tests/e2e/test_full_run.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@
77

88

99
@pytest.fixture
10-
def setup():
11-
temp_dir = Path(tempfile.mkdtemp())
12-
10+
def setup(tmp_path):
1311
reads_fp = Path(".tests/data/reads/").resolve()
1412

15-
project_dir = temp_dir / "project/"
13+
project_dir = tmp_path / "project/"
1614

1715
sp.check_output(["sunbeam", "init", "--data_fp", reads_fp, project_dir])
1816

@@ -30,14 +28,14 @@ def setup():
3028
]
3129
)
3230

33-
yield temp_dir, project_dir
31+
yield tmp_path, project_dir
3432

35-
shutil.rmtree(temp_dir)
33+
shutil.rmtree(tmp_path)
3634

3735

3836
@pytest.fixture
3937
def run_sunbeam(setup):
40-
temp_dir, project_dir = setup
38+
tmp_path, project_dir = setup
4139
output_fp = project_dir / "sunbeam_output"
4240
log_fp = output_fp / "logs"
4341
stats_fp = project_dir / "stats"
@@ -50,7 +48,7 @@ def run_sunbeam(setup):
5048
project_dir,
5149
"all_template",
5250
"--directory",
53-
temp_dir,
51+
tmp_path,
5452
],
5553
capture_output=True,
5654
text=True,

sbx_template.smk

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ except NameError:
44
# For backwards compatibility with older versions of Sunbeam
55
SBX_TEMPLATE_VERSION = "0.0.0"
66

7+
try:
8+
logger = get_extension_logger("sbx_template")
9+
except NameError:
10+
# For backwards compatibility with older versions of Sunbeam
11+
import logging
12+
13+
logger = logging.getLogger("sunbeam.pipeline.extensions.sbx_template")
14+
15+
16+
logger.info("Doing some extension specific setup...")
17+
logger.info(f"Using sbx_template version {SBX_TEMPLATE_VERSION}.")
18+
logger.error("Don't worry, this isn't a real error.")
19+
720

821
localrules:
922
all_template,
@@ -31,7 +44,7 @@ rule example_rule:
3144
container:
3245
f"docker://sunbeamlabs/sbx_template:{SBX_TEMPLATE_VERSION}"
3346
shell:
34-
"cat {params.opts} {input} >> {output} 2> {log}"
47+
"(cat {params.opts} {input} > {output}) > {log} 2>&1"
3548

3649

3750
rule example_with_script:

0 commit comments

Comments
 (0)