mockslurm.mock_squeue.parse_squeue_format

mockslurm.mock_squeue.parse_squeue_format(squeue_format_str: str) Tuple[str, List[Callable]][source]

Convert squeue format argument (-o format) to a python format string and list of function filling the values of the format string for each job DB row.

Parameters:

squeue_format_str (str) – Squeue format string, eg “%.18i %.9P %.8j %.8u %.2t %.10M %.6D %R”.

Warning

Does not support squeue’s “%all” formatting string.

Returns:

python format string, and a list of callable that should be used to fill the values in the formatted string with a job DB row and job_index.

Return type:

Tuple[str, List[Callable]]

Examples

>>> format_str, fields_filler_fcts = parse_squeue_format("%.18i %.9P %.8j %.8u %.2t %.10M %.6D %R")
>>> squeue_output = format_str.format(*[fct(job_DB_row, row_idx) for fct in fields_filler_fcts])