in src/add_job_schedule.py [0:0]
def submit_job_config():
if is_submit_param_valid(binFileName, thingListFile, devIniFile):
timestamp = datetime.datetime.utcnow().strftime("%Y%m%d-%H%M%S")
config.read(devIniFile)
jobId = 'jobId_' + timestamp
streamId = 'streamId_' + timestamp
binName = 'binFile_' + jobId + '_' + binFileName
binFileKey = 'release/' + binName
devFileName = 'devFile_' + jobId + '_' + devIniFile
devFileKey = 'release/' + devFileName
thingListFileName = 'thingListFile_' + jobId + '_' + thingListFile
thingListFileKey = 'release/' + thingListFileName
config['DEFAULT']['thingList'] = thingListFileName
config['DEFAULT']['jobId'] = jobId
config['DEFAULT']['streamId'] = streamId
config['DEFAULT']['binName'] = binName
with open(devFileName, 'w') as configfile:
config.write(configfile)
s3_interface.upload_file_to_s3(devFileName, bucket, devFileKey)
s3_interface.upload_file_to_s3(binFileName, bucket, binFileKey)
s3_interface.upload_file_to_s3(thingListFile, bucket, thingListFileKey)
jobStatus = 'PendingDeployment'
dynamodb.put_item(
TableName=tableName,
Item={
'jobId': {'S': jobId},
'bucketId': {'S': bucket},
'binFileKey': {'S': binFileKey},
'thingListFileKey': {'S': thingListFileKey},
'devFileKey': {'S': devFileKey},
'jobStatus': {'S': jobStatus},
'timestamp': {'S': timestamp}
})
else:
raise Exception('submit config and param sanity check failed')