referencing rulename from within directives

Create issue
Issue #877 new
Floris Barthel created an issue

Hi!

I am not sure if this is a feature request or a question, but since I was not able to find this feature in the documentation I will post it here.

I am finding that within the rule definition I am having to re-type the rule name very often, for example:

rule dosomething:
    output:
        "dosomething/{XXXX}"
    params:
        mem = CLUSTER_CONFIG["dosomething"]["mem"]
    threads:
        CLUSTER_CONFIG["dosomething"]["ppn"]
    log:
        "logs/dosomething/XXXX.log"
    benchmark:
        "benchmarks/dosomething/XXXX.txt"
    message:
        "Running dosomething"
    run:
        "java XXXX -Xmx{params.mem}g --threads {threads} XXXX"

Is there a way to reference the current jobname from within these directives? Especially in the params.mem and threads directives above I am reusing these exact directives in each of 50+ jobs and having to retype the rule name in each of them is a bit of a hassle.

Comments (5)

  1. Christian Arnold

    It would be very nice indeed to allow a generic for the rule name, like {rule} which is allowed in the cluster config. I often have the same issue.

  2. Christian Arnold

    I wanted to ping this and ask if this could be supported (or maybe it already works but it sort of undocumented, given that {rule} can be already used in the cluster config for example). I am writing a new complex pipeline and it would be great to avoid writing the rule name all the time.

  3. Per Unneberg

    I also think this feature would be really neat. For completeness sake, the thread/param callables should also be passed the rule name, so that for instance the param callable signature would be callable(wildcards[, input, output, threads, resources, rule]). This would allow fine-tuning parameters based on rule context, for instance.

  4. Joseph Cottam

    I would also like to see this. I have found myself reaching for {rule} in file paths for logs and outputs on several occasions and missed it when I couldn't use it.

  5. Log in to comment