@@ -40,7 +40,7 @@ def move_t1_to_freesurfer(t1_file):
40
40
stderr = subprocess .STDOUT )
41
41
42
42
43
- def upload_to_s3 (output_files , bucket , prefix , site , session , subject ):
43
+ def upload_to_s3 (output_files , outdir , bucket , prefix , site , session , subject ):
44
44
"""Upload output files to S3, using key format specified by input params
45
45
46
46
Parameters
@@ -50,6 +50,9 @@ def upload_to_s3(output_files, bucket, prefix, site, session, subject):
50
50
relative paths that are appropriate to fill in after the 'preAFQ'
51
51
directory.
52
52
53
+ outdir : string
54
+ a path to the root of the data
55
+
53
56
bucket : string
54
57
Output S3 bucket
55
58
@@ -80,7 +83,7 @@ def filename2s3key(filename):
80
83
])
81
84
82
85
for file in output_files :
83
- with open (file , 'rb' ) as fp :
86
+ with open (op . abspath ( op . join ( outdir , file )) , 'rb' ) as fp :
84
87
s3 .put_object (
85
88
Bucket = bucket ,
86
89
Body = fp ,
@@ -91,7 +94,7 @@ def filename2s3key(filename):
91
94
92
95
93
96
def pre_afq_individual (input_s3_keys , s3_prefix , out_bucket ,
94
- in_bucket = 'fcp-indi' , workdir = '.' ):
97
+ in_bucket = 'fcp-indi' , workdir = op . abspath ( '.' ) ):
95
98
input_files = fetch .download_register (
96
99
subject_keys = input_s3_keys ,
97
100
bucket = in_bucket ,
@@ -122,6 +125,7 @@ def pre_afq_individual(input_s3_keys, s3_prefix, out_bucket,
122
125
out_files .append (rel_path .replace (out_dir + '/' , '' , 1 ))
123
126
124
127
s3_output = upload_to_s3 (output_files = out_files ,
128
+ outdir = out_dir ,
125
129
bucket = out_bucket ,
126
130
prefix = s3_prefix ,
127
131
site = input_s3_keys .site ,
0 commit comments