mockslurm.mock_sbatch.parse_dependency¶
- mockslurm.mock_sbatch.parse_dependency(job_dependency: str) Tuple[bool, List[Dict[str, List[int]]]] [source]¶
Parse a job’s dependency specification string in sbatch format
- Parameters:
job_dependency (str) – sbatch job’s dependency string. Examples: afterok:20:21,afterany:23
- Returns:
Tuple 1st element is whether all dependencies must be satisfied for a job to start (True, “,” in slurm str), or if a single dependency is enough (False, “?” in slurm str). When a single dependency is present: True. The list values are dictionaries with a single key been the dependency type (“afterok”, “afterany”, etc.) and the values been the job IDs for these dependency
- Return type:
Tuple[bool, List[Dict[str, List[int]]]]
Example
>>> parse_dependency("afterok:20:21?afterany:23") (True, [{"afterok": [20, 21]}, {"afterany": [23]}])