Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use conditions to make sure failed jobs is after all retries #56

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions uptime_service_validation/coordinator/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,19 @@ def setUpValidatorPods(time_intervals, logging, worker_image, worker_tag):
for job_name in list(jobs):
try:
job_status = api_batch.read_namespaced_job_status(job_name, namespace)
if job_status.status.succeeded:
logging.info(f"Job {job_name} succeeded.")
jobs.remove(job_name)
elif job_status.status.failed:
logging.error(f"Job {job_name} failed.")
jobs.remove(job_name)
conditions = job_status.status.conditions
if conditions:
for condition in conditions:
if condition.type == "Failed" and condition.status == "True":
logging.error(f"Job {job_name} failed: {condition.message}")
jobs.remove(job_name)
logging.fatal("Exiting due to job failure.")
exit(1)
elif (
condition.type == "Complete" and condition.status == "True"
):
logging.info(f"Job {job_name} succeeded.")
jobs.remove(job_name)
except Exception as e:
logging.error(f"Error reading job status for {job_name}: {e}")

Expand Down
Loading