Skip to content

Commit 37076b0

Browse files
authored
Pushdown progress bar spec & fix tests (#569)
* Fix #567
1 parent a5fba09 commit 37076b0

File tree

2 files changed

+33
-8
lines changed

2 files changed

+33
-8
lines changed

servicex/dataset_group.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ async def as_signed_urls_async(
7474
display_progress, provided_progress, overall_progress=overall_progress
7575
) as progress:
7676
self.tasks = [
77-
d.as_signed_urls_async(provided_progress=progress, dataset_group=True)
77+
d.as_signed_urls_async(
78+
display_progress=display_progress,
79+
provided_progress=progress,
80+
dataset_group=True,
81+
)
7882
for d in self.datasets
7983
]
8084
return await asyncio.gather(
@@ -97,7 +101,10 @@ async def as_files_async(
97101
display_progress, provided_progress, overall_progress=overall_progress
98102
) as progress:
99103
self.tasks = [
100-
d.as_files_async(provided_progress=progress) for d in self.datasets
104+
d.as_files_async(
105+
display_progress=display_progress, provided_progress=progress
106+
)
107+
for d in self.datasets
101108
]
102109
return await asyncio.gather(
103110
*self.tasks, return_exceptions=return_exceptions

tests/test_databinder.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -914,31 +914,49 @@ def test_deliver_progress_options(transformed_result, codegen_list, with_event_l
914914
]
915915
}
916916
)
917+
918+
async def fake_submit(signed_urls_only, expandable_progress):
919+
expandable_progress.add_task("zip", start=False, total=None)
920+
return transformed_result
921+
917922
with (
918-
patch(
919-
"servicex.dataset_group.DatasetGroup.as_files",
920-
return_value=[transformed_result],
921-
),
922923
patch(
923924
"servicex.servicex_client.ServiceXClient.get_code_generators",
924925
return_value=codegen_list,
925926
),
927+
patch(
928+
"servicex.servicex_adapter.ServiceXAdapter._get_authorization",
929+
return_value={"Authorization": "Bearer aaa"},
930+
),
931+
patch(
932+
"servicex.query_core.Query.submit_and_download",
933+
side_effect=fake_submit,
934+
),
926935
):
927-
deliver(
936+
import servicex.query_core
937+
938+
rv = deliver(
928939
spec,
929940
config_path="tests/example_config.yaml",
930941
progress_bar=ProgressBarFormat.compact,
931942
)
932-
deliver(
943+
servicex.query_core.Query.submit_and_download.assert_called_once()
944+
assert rv is not None
945+
assert rv["sampleA"].valid()
946+
rv = deliver(
933947
spec,
934948
config_path="tests/example_config.yaml",
935949
progress_bar=ProgressBarFormat.none,
936950
)
951+
assert rv is not None
952+
assert rv["sampleA"].valid()
937953
deliver(
938954
spec,
939955
config_path="tests/example_config.yaml",
940956
progress_bar=ProgressBarFormat.expanded,
941957
)
958+
assert rv is not None
959+
assert rv["sampleA"].valid()
942960
with pytest.raises(ValueError):
943961
deliver(
944962
spec,

0 commit comments

Comments
 (0)