Skip to content

Commit

Permalink
fix(snakemake): update to v7.32.4 to make Python 3.11 clients compatible
Browse files Browse the repository at this point in the history
Update Snakemake version to v7.32.4 (latest one before v8 refactoring),
to support newer features and resolve problems for clients using Python 3.11.

- `reana_commons/config.py`: update default Snakemake environment image.
- `reana_commons/snakemake.py`: modify `first_rule` directive to
  `default_target` directive to adhere to the changes made in
  snakemake/snakemake!638ec1a.
- `setup.py`: adjust Snakemake version in the dependencies.

Closes: reanahub/reana-client#655,
reanahub/reana-workflow-engine-snakemake#31.
  • Loading branch information
giuseppe-steduto committed Jan 10, 2024
1 parent 687f2f4 commit 673d95f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion reana_commons/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def default_workspace():
REANA_WORKFLOW_ENGINES = ["yadage", "cwl", "serial", "snakemake"]
"""Available workflow engines."""

REANA_DEFAULT_SNAKEMAKE_ENV_IMAGE = "docker.io/snakemake/snakemake:v6.8.0"
REANA_DEFAULT_SNAKEMAKE_ENV_IMAGE = "docker.io/snakemake/snakemake:v7.32.4"
"""Snakemake default job environment image."""

REANA_JOB_CONTROLLER_CONNECTION_CHECK_SLEEP = float(
Expand Down
8 changes: 5 additions & 3 deletions reana_commons/snakemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _create_snakemake_dag(
if workdir:
workflow.workdir(workdir)

workflow.include(snakefile=snakefile, overwrite_first_rule=True)
workflow.include(snakefile=snakefile, overwrite_default_target=True)
workflow.check()

# code copied and adapted from `snakemake.workflow.Workflow.execute()`
Expand Down Expand Up @@ -122,7 +122,9 @@ def files(items):

if not kwargs.get("targets"):
targets = (
[workflow.first_rule] if workflow.first_rule is not None else list()
[workflow.default_target]
if workflow.default_target is not None
else list()
)

prioritytargets = kwargs.get("prioritytargets", [])
Expand Down Expand Up @@ -157,7 +159,7 @@ def files(items):
omitrules=omitrules,
)

workflow.persistence = Persistence(dag=dag)
workflow._persistence = Persistence(dag=dag)
dag.init()
dag.update_checkpoint_dependencies()
dag.check_dynamic()
Expand Down
6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@
"yadage": ["adage~=0.10.1", "yadage~=0.20.1", "yadage-schemas~=0.10.6"],
"cwl": ["cwltool==3.1.20210628163208"],
"snakemake": [
"snakemake==6.8.0 ; python_version<'3.12'",
"snakemake==7.9.0 ; python_version>='3.12'",
"snakemake==7.32.4",
"tabulate<0.9",
],
"snakemake_reports": [
"snakemake[reports]==6.8.0 ; python_version<'3.12'",
"snakemake[reports]==7.9.0 ; python_version>='3.12'",
"snakemake==7.32.4",
"pygraphviz<1.8",
"tabulate<0.9", # tabulate 0.9 crashes snakemake, more info: https://github.com/snakemake/snakemake/issues/1899
],
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def dummy_snakefile():
"results/foo.txt",
"results/bar.txt",
"results/baz.txt"
default_target: True
rule foo:
input:
Expand Down
4 changes: 0 additions & 4 deletions tests/test_snakemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@

def test_snakemake_load(tmpdir, dummy_snakefile):
"""Test that Snakemake metadata is loaded properly."""
if sys.version_info.major == 3 and sys.version_info.minor in (11, 12):
pytest.xfail(
"Snakemake features of reana-client are not supported on Python 3.11"
)
workdir = tmpdir.mkdir("sub")
# write Snakefile
p = workdir.join("Snakefile")
Expand Down

0 comments on commit 673d95f

Please sign in to comment.