runtraj.execution.kubernetes.job_summary#

runtraj.execution.kubernetes.job_summary(job)[source]#

Return what runtraj status shows of one Job, from kubectl get jobs -o json.

state is complete, failed, suspended or running, and reason is Kubernetes’ reason for a failed Job, such as FailedIndexes or DeadlineExceeded. tasks is the Job’s completions; done, failed and running count its tasks, and failed_tasks lists the ones that gave up as Kubernetes writes them (1,4-6).

Examples

>>> job = {
...     "metadata": {"name": "runtraj-towers-x7k2p"},
...     "spec": {"completions": 8},
...     "status": {"completedIndexes": "0-5", "failedIndexes": "7", "active": 1},
... }
>>> summary = job_summary(job)
>>> summary["state"], summary["done"], summary["failed_tasks"]
('running', 6, '7')
Return type:

dict[str, Any]

Parameters:

job (dict[str, Any])