diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a1d98ce..0419302 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,7 @@ repos: hooks: - id: isort - repo: https://github.com/ambv/black - rev: 22.3.0 + rev: 23.3.0 hooks: - id: black language_version: python3 @@ -29,5 +29,6 @@ repos: rev: 5.0.4 hooks: - id: flake8 + args: ['--ignore=E501,C901'] additional_dependencies: [flake8-typing-imports==1.10.0] exclude: ^tests diff --git a/src/bgcflow/bgcflow.py b/src/bgcflow/bgcflow.py index eb72b0b..f9a2cfb 100644 --- a/src/bgcflow/bgcflow.py +++ b/src/bgcflow/bgcflow.py @@ -1,8 +1,6 @@ """Main module.""" -import json import multiprocessing import subprocess -import sys import time from pathlib import Path @@ -29,15 +27,18 @@ def snakemake_wrapper(**kwargs): touch = "" unlock = "" until = "" + profile = "" if kwargs["dryrun"]: dryrun = "--dryrun" if kwargs["touch"]: touch = "--touch" if kwargs["unlock"]: - touch = "--unlock" + unlock = "--unlock" if kwargs["until"] is not None: until = f"--until {kwargs['until']}" + if kwargs["profile"] is not None: + profile = f"--profile {kwargs['profile']}" if kwargs["monitor_off"]: pass @@ -132,7 +133,7 @@ def snakemake_wrapper(**kwargs): click.echo( f"\nDEBUG: Using {kwargs['cores']} out of {multiprocessing.cpu_count()} available cores\n" ) - snakemake_command = f"cd {kwargs['bgcflow_dir']} && snakemake --snakefile {snakefile} --use-conda --keep-going --rerun-incomplete --rerun-triggers mtime -c {kwargs['cores']} {dryrun} {touch} {until} {unlock} --wms-monitor {kwargs['wms_monitor']}" + snakemake_command = f"cd {kwargs['bgcflow_dir']} && snakemake --snakefile {snakefile} --use-conda --keep-going --rerun-incomplete --rerun-triggers mtime -c {kwargs['cores']} {dryrun} {touch} {until} {unlock} {profile} --wms-monitor {kwargs['wms_monitor']}" click.echo(f"Running Snakemake with command:\n{snakemake_command}") subprocess.call(snakemake_command, shell=True) diff --git a/src/bgcflow/cli.py b/src/bgcflow/cli.py index 8545543..f200f1b 100644 --- a/src/bgcflow/cli.py +++ b/src/bgcflow/cli.py @@ -92,6 +92,11 @@ def clone(**kwargs): default=None, help="Runs the pipeline until it reaches the specified rules or files.", ) +@click.option( + "--profile", + default=None, + help="Path to a directory containing snakemake profile.", +) @click.option( "-t", "--touch",