Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Commit

Permalink
Exit with non-zero code when job failed or being canceled (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
functicons authored Apr 9, 2020
1 parent 3f4001a commit cef9f6c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions controllers/flinkcluster_submit_job_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,17 @@ function wait_for_job() {
while true; do
echo -e "\nWaiting for job to finish..."
list_jobs
if list_jobs | grep -e "(FINISHED)" -e "(FAILED)" -e "(CANCELED)"; then
echo -e "\nJob has terminated, exiting..."
break
if list_jobs | grep "(FINISHED)"; then
echo -e "\nJob has completed successfully, exiting 0"
return 0
fi
if list_jobs | grep "(FAILED)"; then
echo -e "\nJob failed, exiting 1"
return 1
fi
if list_jobs | grep "(CANCELED)"; then
echo -e "\nJob has been cancelled, exiting 2"
return 2
fi
sleep 30
done
Expand Down

1 comment on commit cef9f6c

@Mrart
Copy link
Contributor

@Mrart Mrart commented on cef9f6c Apr 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I test it , when it canceled the job. The job status is convert to "failed". Is seem something wrong?

Please sign in to comment.