MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / FailedJobsException

Class FailedJobsException

crates/pyhq/python/hyperqueue/client.py:24–51  ·  view source on GitHub ↗

This exception is triggered if a task fails.

Source from the content-addressed store, hash-verified

22
23
24class FailedJobsException(Exception):
25 """
26 This exception is triggered if a task fails.
27 """
28
29 def __init__(self, failed_tasks: TaskFailureMap, job_map: JobMap):
30 self.failed_tasks = failed_tasks
31 self.job_map = job_map
32
33 def task_label(self, job_id: JobId, task_id: TaskId) -> str:
34 return self.job_map[job_id].task_by_id(task_id).label
35
36 def __str__(self):
37 error = ""
38 for job_id, tasks in self.failed_tasks.items():
39 error += f"The following tasks of job `{job_id}` have failed:\n"
40 for task_id, ctx in itertools.islice(tasks.items(), MAX_PRINTED_TASKS):
41 task_label = self.task_label(job_id, task_id)
42 error += f"Task {task_label} (id={task_id}):\n{ctx.error}\n"
43 if ctx.cwd or ctx.stdout or ctx.stderr:
44 error += "You can find more information here:\n"
45 if ctx.cwd:
46 error += f"Working directory: {ctx.cwd}\n"
47 if ctx.stdout:
48 error += f"Stdout: {ctx.stdout}\n"
49 if ctx.stderr:
50 error += f"Stderr: {ctx.stderr}\n"
51 return f"{error}\n"
52
53
54class Client:

Callers 1

wait_for_jobsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected