Skip to content

Commit 52930f9

Browse files
committed
always fetch dataset from s3
1 parent 88507ef commit 52930f9

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

server/jpsurv.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -769,22 +769,19 @@ def getQueuedDataset():
769769
extractPath = path.join(app.config['folders']['output_dir'], id)
770770
file = path.join(extractPath, filename)
771771

772-
if path.isfile(file):
772+
try:
773+
bucket = S3Bucket(app.config['s3']['bucket'], app.logger)
774+
bucket.downloadFile(key, zipSave)
775+
776+
with ZipFile(zipSave) as archive:
777+
archive.extractall(extractPath)
778+
773779
return send_file(file, as_attachment=True)
774-
else:
775-
try:
776-
bucket = S3Bucket(app.config['s3']['bucket'], app.logger)
777-
bucket.downloadFile(key, zipSave)
778-
779-
with ZipFile(zipSave) as archive:
780-
archive.extractall(extractPath)
781-
782-
return send_file(file, as_attachment=True)
783-
except Exception as err:
784-
message = "Download from S3 failed!\n" + str(err)
785-
app.logger.error(message)
786-
app.logger.exception(err)
787-
return app.response_class(json.dumps(message), 500, mimetype='application/json')
780+
except Exception as err:
781+
message = "Download from S3 failed!\n" + str(err)
782+
app.logger.error(message)
783+
app.logger.exception(err)
784+
return app.response_class(json.dumps(message), 500, mimetype='application/json')
788785

789786

790787
@app.route('/api/recalculateBatch', methods=['POST'])

0 commit comments

Comments
 (0)