Skip to content

The priority directive should support lambdas #2994

@nh13

Description

@nh13

My use case is when I know ahead of time that some executions of a particular rule will take longer than others, on a multi-core machine. I want the "longer-running" rule to run first. I was thinking I could specify the priority of the rule via a wildcard, but I get:

RuleException in file /private/tmp/snakemake/Snakefile, line 14:
Priority values have to be numeric.

Here's the snakefile:

contigs = {
    "chr1": 1000,
    "chr2": 10000,
    "chr3": 100000,
    "chr4": 100,
}

rule all:
    input:
        [f"{c}.txt" for c in contigs]


rule txt:
    output:
        txt = "{c}.txt"
    priority: lambda wcs: contigs[wcs.c]
    shell:
        "touch {output.txt}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions