Skip to content

Commit d0c34ce

Browse files
authored
Update run.py
1 parent 115370a commit d0c34ce

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

run.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,13 @@ def startCluster():
386386
print('Use: run.py startCluster configFile')
387387
sys.exit()
388388

389+
time = datetime.datetime.now().replace(microsecond=0)
389390
#Step 1: set up the configuration files
390391
s3client = boto3.client('s3')
391392
ecsConfigFile=generateECSconfig(ECS_CLUSTER,APP_NAME,AWS_BUCKET,s3client)
392393
spotfleetConfig=loadConfig(sys.argv[2])
393-
spotfleetConfig['ValidFrom']=datetime.datetime.now().replace(microsecond=0)
394-
spotfleetConfig['ValidUntil']=(datetime.datetime.now()+datetime.timedelta(days=365)).replace(microsecond=0)
394+
spotfleetConfig['ValidFrom']=time
395+
spotfleetConfig['ValidUntil']=(time+datetime.timedelta(days=365)).replace(microsecond=0)
395396
spotfleetConfig['TargetCapacity']= CLUSTER_MACHINES
396397
spotfleetConfig['SpotPrice'] = '%.2f' %MACHINE_PRICE
397398
DOCKER_BASE_SIZE = int(round(float(EBS_VOL_SIZE)/int(TASKS_PER_MACHINE))) - 2
@@ -441,7 +442,7 @@ def startCluster():
441442
status = ec2client.describe_spot_fleet_instances(SpotFleetRequestId=requestInfo['SpotFleetRequestId'])
442443
while len(status['ActiveInstances']) < CLUSTER_MACHINES:
443444
# First check to make sure there's not a problem
444-
errorcheck = ec2client.describe_spot_fleet_request_history(SpotFleetRequestId=requestInfo['SpotFleetRequestId'], EventType='error', StartTime=datetime.datetime.today().replace(microsecond=0))
445+
errorcheck = ec2client.describe_spot_fleet_request_history(SpotFleetRequestId=requestInfo['SpotFleetRequestId'], EventType='error', StartTime=time)
445446
if len(errorcheck['HistoryRecords']) != 0:
446447
print('Your spot fleet request is causing an error and is now being cancelled. Please check your configuration and try again')
447448
for eacherror in errorcheck['HistoryRecords']:

0 commit comments

Comments
 (0)