snakemake / snakemake

This is the development home of the workflow management system Snakemake. For general information, see
https://snakemake.github.io
MIT License
2.25k stars 545 forks source link

onstart handler documentation #2923

Closed cefect closed 3 months ago

cefect commented 3 months ago

The only information I can find on this feature is:

Snakemake 3.6.0 adds an onstart handler, that will be executed before the workflow starts. Note that dry-runs do not trigger any of the handlers.

Is this meant to be included in rules as a directive? or a special function name at the head of the snakefile? Seems like a cool feature, but difficult to use without some more information or an example. Or maybe I'm missing something...

pdimens commented 3 months ago

Pretend it's sort of like an extra-special run directive at the top level:

#### START OF SNAKEFILE####
foo = config["inputs"]

onstart:
  thismany = len(foo)
  print(f"Starting now and theres a total of {thismany} files")

rule do_stuff:
  input: xxxx
  output: yyyy
  etc... 
cefect commented 3 months ago

Awww.. this makes sense. Thank you for the tip.