Skip to content

Commit a783e75

Browse files
authored
Fix tpu cleanup (Lightning-AI#3056)
* Only try to delete jobs if there are any to delete. * Reorder jobs. * Remove cleanup from the jobs that run on every commit.
1 parent 54d78fb commit a783e75

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

.circleci/config.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ references:
9090
# Match jobs whose age matches patterns like '1h' or '1d', i.e. any job
9191
# that has been around longer than 1hr. First print all columns for
9292
# matches, then execute the delete.
93-
kubectl get job | awk 'match($4,/[0-9]+[dh]/) {print $0}'
94-
kubectl delete job $(kubectl get job | awk 'match($4,/[0-9]+[dh]/) {print $1}')
93+
jobs_to_delete=$(kubectl get job | awk 'match($4,/[0-9]+[dh]/) {print $0}')
94+
echo $jobs_to_delete
95+
if [ ${#jobs_to_delete} -gt 1 ];
96+
then kubectl delete job $(kubectl get job | awk 'match($4,/[0-9]+[dh]/) {print $1}');
97+
fi
9598
9699
jobs:
97100

0 commit comments

Comments
 (0)