-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #143 from spacetelescope/hotfix/v0.4.26
Hotfix/v0.4.26
- Loading branch information
Showing
5 changed files
with
85 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#! /usr/bin/python3 | ||
|
||
# the deploy_ami_rotate.sh script calls this script, | ||
# and stops ami rotation before calling terraform | ||
# if this script exits non-zero | ||
|
||
import os | ||
import json | ||
import sys | ||
|
||
statuses = ['RUNNING','SUBMITTED','PENDING','RUNNABLE','STARTING'] | ||
|
||
# clean up before running | ||
cmd = 'rm ./*.json' | ||
os.system(cmd) | ||
|
||
# dump the jobQueues to json | ||
cmd = "awsudo $ADMIN_ARN aws batch describe-job-queues > queues.json" | ||
os.system(cmd) | ||
|
||
with open('./queues.json', 'r') as f: | ||
queues = json.load(f) | ||
|
||
for queue in queues['jobQueues']: | ||
name = queue['jobQueueName'] | ||
for status in statuses: | ||
cmd = f"awsudo $ADMIN_ARN aws batch list-jobs --job-queue {name} --job-status {status} > {name}_{status}.json" | ||
os.system(cmd) | ||
with open(f"{name}_{status}.json", 'r') as f: | ||
jobs = json.load(f) | ||
if len(jobs['jobSummaryList']) > 0: | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters