3535parser .add_argument ('--ignore_poly_for_cmr' , type = bool , default = None )
3636parser .add_argument ('--name' , type = str , default = 'output' )
3737parser .add_argument ('--no_geo' , action = 'store_true' , default = False )
38- parser .add_argument ('--output_path' , '-p' , type = str , default = "s3://sliderule/data/stage" )
38+ parser .add_argument ('--output_path' , '-p' , type = str , default = "s3://sliderule/data/stage" ) # "hosted" tells sliderule to host results in a bucket it owns
3939parser .add_argument ('--timeout' , '-t' , type = int , default = 600 ) # seconds
4040parser .add_argument ('--generate' , action = 'store_true' , default = False )
4141parser .add_argument ('--simulate_delay' , type = float , default = 1 )
6262aws_credential_file = os .path .join (home_directory , '.aws' , 'credentials' )
6363config = configparser .RawConfigParser ()
6464
65+ # Check for Hosted Option
66+ if args .output_path == "hosted" :
67+ credentials = None
68+ else :
69+ credentials = {}
70+
6571# Check Organization
6672organization = args .organization
6773desired_nodes = args .desired_nodes
100106 "as_geo" : not args .no_geo ,
101107 "open_on_complete" : False ,
102108 "region" : "us-west-2" ,
103- "credentials" : {}
109+ "credentials" : credentials
104110 }
105111}
106112
@@ -157,12 +163,13 @@ def update_credentials(worker_id):
157163 time .sleep (args .simulate_delay )
158164
159165 # Read AWS Credentials
160- config .read (aws_credential_file )
161- parms ["output" ]["credentials" ] = {
162- "aws_access_key_id" : config .get ('default' , 'aws_access_key_id' ),
163- "aws_secret_access_key" : config .get ('default' , 'aws_secret_access_key' ),
164- "aws_session_token" : config .get ('default' , 'aws_session_token' )
165- }
166+ if credentials != None :
167+ config .read (aws_credential_file )
168+ parms ["output" ]["credentials" ] = {
169+ "aws_access_key_id" : config .get ('default' , 'aws_access_key_id' ),
170+ "aws_secret_access_key" : config .get ('default' , 'aws_secret_access_key' ),
171+ "aws_session_token" : config .get ('default' , 'aws_session_token' )
172+ }
166173
167174 # Finish Request
168175 log .info (f'<{ worker_id } > finished update' )
@@ -175,8 +182,14 @@ def process_request(worker_id, count, resources):
175182 # Start Processing
176183 log .info (f'<{ worker_id } > processing { len (resources )} resources: { resources [0 ]} ...' )
177184
185+ # Set Output Path
186+ if credentials != None :
187+ parms ["output" ]["path" ] = f'{ args .output_path } /{ args .name } _{ count } .{ "parquet" if args .no_geo else "geoparquet" } '
188+ else :
189+ parms ["output" ]["path" ] = ""
190+ parms ["output" ]["asset" ] = "sliderule-stage"
191+
178192 # Make Request
179- parms ["output" ]["path" ] = f'{ args .output_path } /{ args .name } _{ count } .{ "parquet" if args .no_geo else "geoparquet" } '
180193 if args .generate :
181194 outfile = icesat2 .atl03sp (parms , resources = resources )
182195 else :
0 commit comments