mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-05 08:40:29 -04:00
Remove csv after process job is finished.
Fixed new tests.
This commit is contained in:
@@ -1,7 +1,16 @@
|
||||
from boto3 import resource
|
||||
|
||||
|
||||
def get_job_from_s3(bucket_name, job_id):
|
||||
def get_s3_job_object(bucket_name, job_id):
|
||||
s3 = resource('s3')
|
||||
key = s3.Object(bucket_name, '{}.csv'.format(job_id))
|
||||
return key.get()['Body'].read().decode('utf-8')
|
||||
return s3.Object(bucket_name, '{}.csv'.format(job_id))
|
||||
|
||||
|
||||
def get_job_from_s3(bucket_name, job_id):
|
||||
obj = get_s3_job_object(bucket_name, job_id)
|
||||
return obj.get()['Body'].read().decode('utf-8')
|
||||
|
||||
|
||||
def remove_job_from_s3(bucket_name, job_id):
|
||||
obj = get_s3_job_object(bucket_name, job_id)
|
||||
return obj.delete()
|
||||
|
||||
Reference in New Issue
Block a user