Skip to content

Commit f45fd58

Browse files
authored
return helpful message when log export fails (#174)
1 parent c7f52e1 commit f45fd58

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

run.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os, sys
22
import boto3
3+
import botocore
34
import datetime
45
import json
56
import time
@@ -325,8 +326,11 @@ def downscaleSpotFleet(queue, spotFleetID, ec2, manual=False):
325326
ec2.modify_spot_fleet_request(ExcessCapacityTerminationPolicy='noTermination', SpotFleetRequestId=spotFleetID, TargetCapacity = nonvisible)
326327

327328
def export_logs(logs, loggroupId, starttime, bucketId):
328-
result = logs.create_export_task(taskName = loggroupId, logGroupName = loggroupId, fromTime = int(starttime), to = int(time.time()*1000), destination = bucketId, destinationPrefix = 'exportedlogs/'+loggroupId)
329-
329+
try:
330+
result = logs.create_export_task(taskName = loggroupId, logGroupName = loggroupId, fromTime = int(starttime), to = int(time.time()*1000), destination = bucketId, destinationPrefix = 'exportedlogs/'+loggroupId)
331+
except botocore.errorfactory.InvalidParameterException:
332+
print("Failed to export DCP logs to S3. Check your bucket permissions.")
333+
return
330334
logExportId = result['taskId']
331335

332336
while True:

0 commit comments

Comments
 (0)