示例#1
0
def _log_job_status(client: JobSubmissionClient, job_id: str):
    status = client.get_job_status(job_id)
    if status.status == JobStatus.SUCCEEDED:
        _log_big_success_msg(f"Job '{job_id}' succeeded")
    elif status.status == JobStatus.STOPPED:
        cli_logger.warning(f"Job '{job_id}' was stopped")
    elif status.status == JobStatus.FAILED:
        _log_big_error_msg(f"Job '{job_id}' failed")
        if status.message is not None:
            cli_logger.print(f"Status message: {status.message}")
    else:
        # Catch-all.
        cli_logger.print(f"Status for job '{job_id}': {status.status}")
        if status.message is not None:
            cli_logger.print(f"Status message: {status.message}")
示例#2
0
def _check_job_stopped(client: JobSubmissionClient, job_id: str) -> bool:
    status = client.get_job_status(job_id)
    return status.status == JobStatus.STOPPED
示例#3
0
def _check_job_succeeded(client: JobSubmissionClient, job_id: str) -> bool:
    status = client.get_job_status(job_id)
    if status == JobStatus.FAILED:
        stdout, stderr = client.get_job_logs(job_id)
        raise RuntimeError(f"Job failed\nstdout:\n{stdout}\nstderr:\n{stderr}")
    return status == JobStatus.SUCCEEDED
示例#4
0
def _check_job_failed(client: JobSubmissionClient, job_id: str) -> bool:
    status = client.get_job_status(job_id)
    return status.status == JobStatus.FAILED