def check_current_job(self) -> Job: job = self.onefuzz.jobs.get(self.job.job_id) if job.state in JobState.shutting_down(): raise StoppedEarly("job unexpectedly stopped early") errors = [] for task in self.onefuzz.tasks.list(job_id=self.job.job_id, state=TaskState.shutting_down()): if task.error: errors.append("%s: %s" % (task.config.task.type, task.error)) else: errors.append("%s" % task.config.task.type) if errors: raise StoppedEarly("tasks stopped unexpectedly.\n%s" % "\n".join(errors)) return job
def get_running_tasks_checked(self) -> List[Task]: self.job = self.onefuzz.jobs.get(self.job.job_id) if self.job.state in JobState.shutting_down(): raise StoppedEarly("job unexpectedly stopped early") errors = [] tasks = [] for task in self.onefuzz.tasks.list(job_id=self.job.job_id): if task.state in TaskState.shutting_down(): if task.error: errors.append("%s: %s" % (task.config.task.type, task.error)) else: errors.append("%s" % task.config.task.type) tasks.append(task) if errors: raise StoppedEarly("tasks stopped unexpectedly.\n%s" % "\n".join(errors)) return tasks