diff --git a/pyproject.toml b/pyproject.toml index ce5aa76..096923e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,6 +63,7 @@ dependencies = [ [project.optional-dependencies] # these are needed to run the data production runprod = [ + "pygments", "snakemake>=8.16", ] test = [ diff --git a/workflow/Snakefile b/workflow/Snakefile index a8fedad..d2a32cf 100644 --- a/workflow/Snakefile +++ b/workflow/Snakefile @@ -129,6 +129,31 @@ onstart: onsuccess: + from snakemake.report import auto_report + from snakemake_interface_report_plugins.settings import ReportSettingsBase + from snakemake_interface_report_plugins.registry import ReportPluginRegistry + import asyncio + + rep_dir = Path( + f"{log_path(config)}/report-{datetime.strftime(datetime.utcnow(), '%Y%m%dT%H%M%SZ')}" + ) + rep_dir.mkdir(parents=True, exist_ok=True) + # auto_report(workflow.persistence.dag, f"{rep_dir}/report.html") + for form in ["html"]: # , "pdf", "tex" + report_plugin = ReportPluginRegistry().get_plugin(form) + report_settings = report_plugin.settings_cls + report_settings.path = rep_dir / f"report.{form}" + asyncio.run( + auto_report(workflow.persistence.dag, report_plugin, report_settings) + ) + + with (rep_dir / "dag.txt").open("w") as f: + f.writelines(str(workflow.persistence.dag)) + + with (rep_dir / "rulegraph.txt").open("w") as f: + f.writelines(str(workflow.persistence.dag.rule_dot())) + + # remove .gen files files = glob.glob("*.gen") for file in files: if os.path.isfile(file):