Skip to content

Commit 7a9e1ea

Browse files
authored
Merge pull request #109 from legend-exp/report
add report
2 parents 96cab8f + 928c366 commit 7a9e1ea

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ dependencies = [
6363
[project.optional-dependencies]
6464
# these are needed to run the data production
6565
runprod = [
66+
"pygments",
6667
"snakemake>=8.16",
6768
]
6869
test = [

workflow/Snakefile

+25
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,31 @@ onstart:
129129

130130

131131
onsuccess:
132+
from snakemake.report import auto_report
133+
from snakemake_interface_report_plugins.settings import ReportSettingsBase
134+
from snakemake_interface_report_plugins.registry import ReportPluginRegistry
135+
import asyncio
136+
137+
rep_dir = Path(
138+
f"{log_path(config)}/report-{datetime.strftime(datetime.utcnow(), '%Y%m%dT%H%M%SZ')}"
139+
)
140+
rep_dir.mkdir(parents=True, exist_ok=True)
141+
# auto_report(workflow.persistence.dag, f"{rep_dir}/report.html")
142+
for form in ["html"]: # , "pdf", "tex"
143+
report_plugin = ReportPluginRegistry().get_plugin(form)
144+
report_settings = report_plugin.settings_cls
145+
report_settings.path = rep_dir / f"report.{form}"
146+
asyncio.run(
147+
auto_report(workflow.persistence.dag, report_plugin, report_settings)
148+
)
149+
150+
with (rep_dir / "dag.txt").open("w") as f:
151+
f.writelines(str(workflow.persistence.dag))
152+
153+
with (rep_dir / "rulegraph.txt").open("w") as f:
154+
f.writelines(str(workflow.persistence.dag.rule_dot()))
155+
156+
# remove .gen files
132157
files = glob.glob("*.gen")
133158
for file in files:
134159
if os.path.isfile(file):

0 commit comments

Comments
 (0)