Skip to content

Commit b4e1396

Browse files
authored
Reload the monitor info before shutting down (#70)
1 parent 3e4f633 commit b4e1396

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

run.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,6 @@ def monitor():
274274
monitorapp=monitorInfo["MONITOR_APP_NAME"]
275275
fleetId=monitorInfo["MONITOR_FLEET_ID"]
276276
queueId=monitorInfo["MONITOR_QUEUE_NAME"]
277-
bucketId=monitorInfo["MONITOR_BUCKET_NAME"]
278-
loggroupId=monitorInfo["MONITOR_LOG_GROUP_NAME"]
279-
starttime=monitorInfo["MONITOR_START_TIME"]
280277

281278
# Step 1: Create job and count messages periodically
282279
queue = JobQueue(name=queueId)
@@ -289,6 +286,17 @@ def monitor():
289286
time.sleep(MONITOR_TIME)
290287

291288
# Step 2: When no messages are pending, stop service
289+
290+
# Reload the monitor info, because for long jobs new fleets may have been started, etc
291+
monitorInfo = loadConfig(sys.argv[2])
292+
monitorcluster=monitorInfo["MONITOR_ECS_CLUSTER"]
293+
monitorapp=monitorInfo["MONITOR_APP_NAME"]
294+
fleetId=monitorInfo["MONITOR_FLEET_ID"]
295+
queueId=monitorInfo["MONITOR_QUEUE_NAME"]
296+
bucketId=monitorInfo["MONITOR_BUCKET_NAME"]
297+
loggroupId=monitorInfo["MONITOR_LOG_GROUP_NAME"]
298+
starttime=monitorInfo["MONITOR_START_TIME"]
299+
292300
cmd = 'aws ecs update-service --cluster ' + monitorcluster + \
293301
' --service ' + monitorapp + 'Service' + \
294302
' --desired-count 0'

0 commit comments

Comments
 (0)