def post(self) -> None: try: payload = [t.to_dict() for t in self.tasks] session.post(f'{self.endpoint_uri()}/run/{self.run_name}/tasks', json=payload).raise_for_status() except HTTPError: self.logger.debug('HttpError', exc_info=True) raise ValueError('Failed to create tasks in the task store.')
def post(self) -> 'Run': try: resp = session.post(f'{self.endpoint_uri()}/run', json=self.to_dict()) return Run.from_dict(resp.json()) except HTTPError: self.logger.debug('HttpError', exc_info=True) raise ValueError('Failed to create run in the task store.') except (json.JSONDecodeError, TypeError): self.logger.debug('JsonError', exc_info=True) raise ValueError('Failed to deserialize the response content.')
def restart_run(run_id: str): config = A01Config() resp = session.post(f'{config.endpoint_uri}/run/{run_id}/restart') resp.raise_for_status()