File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -400,8 +400,7 @@ def _check_s3_base_dir(self):
400
400
except Exception as exc :
401
401
err_msg = 'Unable to access S3 bucket. Error:\n %s. Exiting...' \
402
402
% exc
403
- print err_msg
404
- sys .exit ()
403
+ raise Exception (err_msg )
405
404
# Bucket access was a success, set flag
406
405
s3_flag = True
407
406
# Otherwise it's just a normal datasink
@@ -599,7 +598,18 @@ def _list_outputs(self):
599
598
outdir = '.'
600
599
601
600
# Check if base directory reflects S3-bucket upload
602
- s3_flag = self ._check_s3_base_dir ()
601
+ try :
602
+ s3_flag = self ._check_s3_base_dir ()
603
+ # If encountering an exception during bucket access, set output
604
+ # base directory to a local folder
605
+ except Exception as exc :
606
+ local_out_exception = os .path .join (os .path .expanduser ('~' ),
607
+ 'data_output' )
608
+ iflogger .info ('Access to S3 failed! Storing outputs locally at: ' \
609
+ '%s\n Error: %s' % (local_out_exception , exc ))
610
+ self .inputs .base_directory = local_out_exception
611
+
612
+ # If not accessing S3, just set outdir to local absolute path
603
613
if not s3_flag :
604
614
outdir = os .path .abspath (outdir )
605
615
You can’t perform that action at this time.
0 commit comments