Skip to content

Commit

Permalink
fix: fetch job status before check
Browse files Browse the repository at this point in the history
  • Loading branch information
akhileshh authored and supersergiy committed Jul 29, 2023
1 parent 98a699d commit 5a7e6ad
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion zetta_utils/cloud_management/resource_allocation/k8s/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,17 @@ def wait_for_job_completion(

_wait_for_job_start(job, namespace, batch_v1_api)

job = batch_v1_api.read_namespaced_job_status(
name=job.metadata.name,
namespace=namespace,
)
while job.status.succeeded == 0:
time.sleep(5)
job = batch_v1_api.read_namespaced_job_status(
name=job.metadata.name,
namespace=namespace,
)
logger.info(f"Waiting for `{job.metadata.name}` to complete.")
time.sleep(5)
logger.info(f"`{job.metadata.name}` job completed.")


Expand Down

0 comments on commit 5a7e6ad

Please sign in to comment.