Fix tpu cleanup (#3056)

* Only try to delete jobs if there are any to delete.

* Reorder jobs.

* Remove cleanup from the jobs that run on every commit.
This commit is contained in:
zcain117 2020-08-24 02:04:20 -07:00 committed by GitHub
parent 54d78fbbd4
commit a783e75dc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -90,8 +90,11 @@ references:
# Match jobs whose age matches patterns like '1h' or '1d', i.e. any job
# that has been around longer than 1hr. First print all columns for
# matches, then execute the delete.
kubectl get job | awk 'match($4,/[0-9]+[dh]/) {print $0}'
kubectl delete job $(kubectl get job | awk 'match($4,/[0-9]+[dh]/) {print $1}')
jobs_to_delete=$(kubectl get job | awk 'match($4,/[0-9]+[dh]/) {print $0}')
echo $jobs_to_delete
if [ ${#jobs_to_delete} -gt 1 ];
then kubectl delete job $(kubectl get job | awk 'match($4,/[0-9]+[dh]/) {print $1}');
fi
jobs: