in run.py [0:0]
def save_result(s3_bucket_name, product_id, is_anomaly, reinspection_needed):
output_filename = str(product_id) + ".csv"
with open('/tmp/' + output_filename, 'w', newline='') as csvfile:
fieldnames = ['ProductId', 'IsAnomaly', 'ReinspectionNeeded', 'CapturedDate']
csvwriter = csv.DictWriter(csvfile, fieldnames=fieldnames)
now = datetime.datetime.now()
csvwriter.writeheader()
csvwriter.writerow({'ProductId': product_id, \
'IsAnomaly': is_anomaly, \
'ReinspectionNeeded': reinspection_needed, \
'CapturedDate' : now})
with open("/tmp/" + output_filename, "rb") as f:
s3.upload_fileobj(f, s3_bucket_name, 'result/' + output_filename)