Skip to content

Commit

Permalink
fix: check for None; for when job is being created
Browse files Browse the repository at this point in the history
  • Loading branch information
akhileshh authored and nkemnitz committed Oct 19, 2023
1 parent 6fc169f commit 5ad1ccb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions zetta_utils/cloud_management/resource_allocation/k8s/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,15 @@ def wait_for_job_completion(
name=job.metadata.name,
namespace=namespace,
)
while job.status.succeeded == 0:
not_done = job.status.succeeded == 0 or job.status.succeeded is None
while not_done:
logger.info(f"Waiting for `{job.metadata.name}` to complete.")
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.")
not_done = job.status.succeeded == 0 or job.status.succeeded is None
logger.info(f"`{job.metadata.name}` job completed.")


Expand Down

0 comments on commit 5ad1ccb

Please sign in to comment.