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

Method wait_for_jobs

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

Returns True if all tasks were successfully finished

(self, jobs: Sequence[SubmittedJob], raise_on_error=True)

Source from the content-addressed store, hash-verified

87 return SubmittedJob(job=job, id=job_id)
88
89 def wait_for_jobs(self, jobs: Sequence[SubmittedJob], raise_on_error=True) -> bool:
90 """Returns True if all tasks were successfully finished"""
91
92 job_ids = tuple(job.id for job in jobs)
93 job_ids_str = ",".join(str(id) for id in job_ids)
94 if len(jobs) > 1:
95 job_ids_str = "{" + job_ids_str + "}"
96 logging.info(f"Waiting for {pluralize('job', len(jobs))} {job_ids_str} to finish")
97
98 callback = create_progress_callback()
99
100 failed_jobs = self.connection.wait_for_jobs(job_ids, callback)
101 if failed_jobs and raise_on_error:
102 failed_tasks = self.connection.get_failed_tasks(failed_jobs)
103 job_map = {job.id: job.job for job in jobs}
104 raise FailedJobsException(failed_tasks, job_map)
105 return len(failed_jobs) == 0
106
107 def get_failed_tasks(self, job: SubmittedJob) -> Dict[TaskId, FailedTaskContext]:
108 result = self.connection.get_failed_tasks([job.id])

Callers 11

test_default_workdirFunction · 0.45
test_default_envFunction · 0.45
test_wait_for_jobFunction · 0.45
test_get_failed_tasksFunction · 0.45
test_task_prioritiesFunction · 0.45
test_cluster_add_workerFunction · 0.45
executeMethod · 0.45

Calls 5

create_progress_callbackFunction · 0.85
FailedJobsExceptionClass · 0.85
infoMethod · 0.80
pluralizeFunction · 0.50
get_failed_tasksMethod · 0.45

Tested by 10

test_default_workdirFunction · 0.36
test_default_envFunction · 0.36
test_wait_for_jobFunction · 0.36
test_get_failed_tasksFunction · 0.36
test_task_prioritiesFunction · 0.36
test_cluster_add_workerFunction · 0.36