File tree 2 files changed +33
-7
lines changed 2 files changed +33
-7
lines changed Original file line number Diff line number Diff line change @@ -522,6 +522,7 @@ async def download_files(
522
522
Task to monitor the list of files in the transform output's bucket. Any new files
523
523
will be downloaded.
524
524
"""
525
+
525
526
files_seen = set ()
526
527
result_uris = []
527
528
download_tasks = []
@@ -557,15 +558,19 @@ async def get_signed_url(
557
558
if self .minio :
558
559
# if self.minio exists, self.current_status will too
559
560
if self .current_status .files_completed > len (files_seen ):
560
- files = await self .minio .list_bucket ()
561
+ files = await self .servicex .get_transformation_results (self .current_status .request_id )
562
+
561
563
for file in files :
562
- if file .filename not in files_seen :
564
+ if 'file-path' not in file :
565
+ continue
566
+
567
+ file_path = file ['file-path' ].replace ('/' , ':' )
568
+ if file_path not in files_seen :
563
569
if signed_urls_only :
564
570
download_tasks .append (
565
571
loop .create_task (
566
572
get_signed_url (
567
- self .minio ,
568
- file .filename ,
573
+ file_path ,
569
574
progress ,
570
575
download_progress ,
571
576
)
@@ -576,14 +581,14 @@ async def get_signed_url(
576
581
loop .create_task (
577
582
download_file (
578
583
self .minio ,
579
- file . filename ,
584
+ file_path ,
580
585
progress ,
581
586
download_progress ,
582
587
shorten_filename = self .configuration .shortened_downloaded_filename , # NOQA: E501
583
588
)
584
589
)
585
590
) # NOQA 501
586
- files_seen .add (file . filename )
591
+ files_seen .add (file_path )
587
592
588
593
# Once the transform is complete and all files are seen we can stop polling.
589
594
# Also, if we are just downloading or signing urls for a previous transform
Original file line number Diff line number Diff line change @@ -228,14 +228,35 @@ async def delete_transform(self, transform_id=None):
228
228
f"Failed to delete transform { transform_id } - { msg } "
229
229
)
230
230
231
+ async def get_transformation_results (self , request_id : str ):
232
+ headers = await self ._get_authorization ()
233
+ url = self .url + f'/servicex/internal/transformation/{ request_id } /results'
234
+
235
+ async with ClientSession () as session :
236
+ async with session .get (headers = headers , url = url ) as r :
237
+ if r .status == 403 :
238
+ raise AuthorizationError (
239
+ f"Not authorized to access serviceX at { self .url } "
240
+ )
241
+
242
+ if r .status == 404 :
243
+ raise ValueError (f"Request { request_id } not found" )
244
+
245
+ if r .status != 200 :
246
+ msg = await _extract_message (r )
247
+ raise RuntimeError (
248
+ f"Failed with message: { msg } "
249
+ )
250
+
251
+ return (await r .json ())['results' ]
252
+
231
253
async def cancel_transform (self , transform_id = None ):
232
254
headers = await self ._get_authorization ()
233
255
path_template = f"/servicex/transformation/{ transform_id } /cancel"
234
256
url = self .url + path_template .format (transform_id = transform_id )
235
257
236
258
async with ClientSession () as session :
237
259
async with session .get (headers = headers , url = url ) as r :
238
-
239
260
if r .status == 403 :
240
261
raise AuthorizationError (
241
262
f"Not authorized to access serviceX at { self .url } "
You can’t perform that action at this time.
0 commit comments