File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
snakemake_executor_plugin_slurm Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 11# utility functions for the SLURM executor plugin
22
3+ from collections import Counter
34import math
45import os
56import shlex
89from pathlib import Path
910from typing import Union
1011
12+ from snakemake_interface_executor_plugins .dag import DAGExecutorInterface
1113from snakemake_interface_executor_plugins .jobs import (
1214 JobExecutorInterface ,
1315)
@@ -69,6 +71,12 @@ def get_job_wildcards(job: JobExecutorInterface) -> str:
6971 return wildcard_str
7072
7173
74+ def pending_jobs_for_rule (dag : DAGExecutorInterface , rule_name : str ) -> int :
75+ """Count pending jobs for a given rule in the DAG."""
76+ counts = Counter (job .rule .name for job in dag .needrun_jobs ())
77+ return counts .get (rule_name , 0 )
78+
79+
7280def round_half_up (n ):
7381 return int (math .floor (n + 0.5 ))
7482
You can’t perform that action at this time.
0 commit comments