Update job_crud.py
This commit is contained in:
parent
7bb0851217
commit
7571b4519e
@ -55,15 +55,17 @@ def create_job(api_instance, job):
|
||||
api_response = api_instance.create_namespaced_job(
|
||||
body=job,
|
||||
namespace="default")
|
||||
# Need to wait for a second for the job status to update
|
||||
sleep(1)
|
||||
print("Job created. status='%s'" % str(get_job_status(api_instance)))
|
||||
|
||||
|
||||
def get_job_status(api_instance):
|
||||
api_response = api_instance.read_namespaced_job_status(
|
||||
name=JOB_NAME,
|
||||
namespace="default")
|
||||
job_completed = False
|
||||
while not job_completed:
|
||||
api_response = api_instance.read_namespaced_job_status(
|
||||
name=JOB_NAME,
|
||||
namespace="default")
|
||||
if api_response.status.succeeded is not None or api_response.status.failed is not None:
|
||||
job_completed = True
|
||||
return api_response.status
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user