Skip to content

Commit 3471cfa

Browse files
committed
fix: restored previous function
1 parent b1603fc commit 3471cfa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

snakemake_executor_plugin_slurm/utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# utility functions for the SLURM executor plugin
22

3+
from collections import Counter
34
import math
45
import os
56
import shlex
@@ -8,6 +9,7 @@
89
from pathlib import Path
910
from typing import Union
1011

12+
from snakemake_interface_executor_plugins.dag import DAGExecutorInterface
1113
from 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+
7280
def round_half_up(n):
7381
return int(math.floor(n + 0.5))
7482

0 commit comments

Comments
 (0)