Skip to content

Commit

Permalink
Fix Dataproc cleanup race condition (#30154)
Browse files Browse the repository at this point in the history
  • Loading branch information
Abacn authored Jan 30, 2024
1 parent 5a9a27c commit b9fd39c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
github.event_name == 'push' ||
github.event_name == 'pull_request_target' ||
(github.event_name == 'schedule' && github.repository == 'apache/beam') ||
github.event_name == 'workflow_dispatch' ||
startsWith(github.event.comment.body, 'Run Job With Matrix')
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beam_CleanUpDataprocResources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ name: Cleanup Dataproc Resources

on:
schedule:
- cron: '0 */6 * * *'
- cron: '0 0 * * *'
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
Expand Down
4 changes: 2 additions & 2 deletions .test-infra/dataproc/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ function filterClusters(){

elapsedHours=$((($currentDate - $clusterStartTime)/3600))

#Most of the jobs commonly finish in less than one hour
if [[ $elapsedHours -ge 2 ]]; then
# teardown clusters >= 6 hr old
if [[ $elapsedHours -ge 6 ]]; then
for name in ${generatedResources[@]}; do
# Only resources generated by the groovy jobs set are queued for deletion
if [[ "$cluster" == *${name}* && ! ("$cluster" =~ nokill) ]]; then
Expand Down

0 comments on commit b9fd39c

Please sign in to comment.