We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7bb0851 commit 7571b45Copy full SHA for 7571b45
1 file changed
examples/job_crud.py
@@ -55,15 +55,17 @@ def create_job(api_instance, job):
55
api_response = api_instance.create_namespaced_job(
56
body=job,
57
namespace="default")
58
- # Need to wait for a second for the job status to update
59
- sleep(1)
60
print("Job created. status='%s'" % str(get_job_status(api_instance)))
61
62
63
def get_job_status(api_instance):
64
- api_response = api_instance.read_namespaced_job_status(
65
- name=JOB_NAME,
66
- namespace="default")
+ job_completed = False
+ while not job_completed:
+ api_response = api_instance.read_namespaced_job_status(
+ name=JOB_NAME,
+ namespace="default")
67
+ if api_response.status.succeeded is not None or api_response.status.failed is not None:
68
+ job_completed = True
69
return api_response.status
70
71
0 commit comments