prefect-client 3.3.6.dev1__py3-none-any.whl → 3.3.6.dev2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- prefect/_build_info.py +3 -3
- prefect/events/clients.py +1 -1
- prefect/futures.py +54 -21
- {prefect_client-3.3.6.dev1.dist-info → prefect_client-3.3.6.dev2.dist-info}/METADATA +1 -1
- {prefect_client-3.3.6.dev1.dist-info → prefect_client-3.3.6.dev2.dist-info}/RECORD +7 -7
- {prefect_client-3.3.6.dev1.dist-info → prefect_client-3.3.6.dev2.dist-info}/WHEEL +0 -0
- {prefect_client-3.3.6.dev1.dist-info → prefect_client-3.3.6.dev2.dist-info}/licenses/LICENSE +0 -0
prefect/_build_info.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Generated by versioningit
|
2
|
-
__version__ = "3.3.6.
|
3
|
-
__build_date__ = "2025-04-
|
4
|
-
__git_commit__ = "
|
2
|
+
__version__ = "3.3.6.dev2"
|
3
|
+
__build_date__ = "2025-04-22 08:08:25.558469+00:00"
|
4
|
+
__git_commit__ = "562b964535b46f586b9b12808462956ed2f90c5a"
|
5
5
|
__dirty__ = False
|
prefect/events/clients.py
CHANGED
prefect/futures.py
CHANGED
@@ -612,19 +612,44 @@ def resolve_futures_to_states(
|
|
612
612
|
|
613
613
|
Unsupported object types will be returned without modification.
|
614
614
|
"""
|
615
|
-
futures: set[PrefectFuture[R]] = set()
|
616
615
|
|
617
|
-
def
|
618
|
-
|
619
|
-
|
620
|
-
# Expressions inside quotes should not be traversed
|
621
|
-
if isinstance(context.get("annotation"), quote):
|
622
|
-
raise StopVisiting()
|
616
|
+
def _resolve_state(future: PrefectFuture[R]):
|
617
|
+
future.wait()
|
618
|
+
return future.state
|
623
619
|
|
624
|
-
|
625
|
-
|
620
|
+
return _resolve_futures(
|
621
|
+
expr,
|
622
|
+
resolve_fn=_resolve_state,
|
623
|
+
)
|
626
624
|
|
627
|
-
|
625
|
+
|
626
|
+
def resolve_futures_to_results(
|
627
|
+
expr: PrefectFuture[R] | Any,
|
628
|
+
) -> Any:
|
629
|
+
"""
|
630
|
+
Given a Python built-in collection, recursively find `PrefectFutures` and build a
|
631
|
+
new collection with the same structure with futures resolved to their final results.
|
632
|
+
Resolving futures to their final result may wait for execution to complete.
|
633
|
+
|
634
|
+
Unsupported object types will be returned without modification.
|
635
|
+
"""
|
636
|
+
|
637
|
+
def _resolve_result(future: PrefectFuture[R]) -> Any:
|
638
|
+
future.wait()
|
639
|
+
if future.state.is_completed():
|
640
|
+
return future.result()
|
641
|
+
else:
|
642
|
+
raise Exception("At least one result did not complete successfully")
|
643
|
+
|
644
|
+
return _resolve_futures(expr, resolve_fn=_resolve_result)
|
645
|
+
|
646
|
+
|
647
|
+
def _resolve_futures(
|
648
|
+
expr: PrefectFuture[R] | Any,
|
649
|
+
resolve_fn: Callable[[PrefectFuture[R]], Any],
|
650
|
+
) -> Any:
|
651
|
+
"""Helper function to resolve PrefectFutures in a collection."""
|
652
|
+
futures: set[PrefectFuture[R]] = set()
|
628
653
|
|
629
654
|
visit_collection(
|
630
655
|
expr,
|
@@ -633,31 +658,39 @@ def resolve_futures_to_states(
|
|
633
658
|
context={},
|
634
659
|
)
|
635
660
|
|
636
|
-
#
|
661
|
+
# If no futures were found, return the original expression
|
637
662
|
if not futures:
|
638
663
|
return expr
|
639
664
|
|
640
|
-
#
|
641
|
-
|
642
|
-
for future in futures:
|
643
|
-
future.wait()
|
644
|
-
states.append(future.state)
|
645
|
-
|
646
|
-
states_by_future = dict(zip(futures, states))
|
665
|
+
# Resolve each future using the provided resolve function
|
666
|
+
resolved_values = {future: resolve_fn(future) for future in futures}
|
647
667
|
|
648
|
-
def
|
668
|
+
def replace_futures(expr: Any, context: Any) -> Any:
|
649
669
|
# Expressions inside quotes should not be modified
|
650
670
|
if isinstance(context.get("annotation"), quote):
|
651
671
|
raise StopVisiting()
|
652
672
|
|
653
673
|
if isinstance(expr, PrefectFuture):
|
654
|
-
return
|
674
|
+
return resolved_values[expr]
|
655
675
|
else:
|
656
676
|
return expr
|
657
677
|
|
658
678
|
return visit_collection(
|
659
679
|
expr,
|
660
|
-
visit_fn=
|
680
|
+
visit_fn=replace_futures,
|
661
681
|
return_data=True,
|
662
682
|
context={},
|
663
683
|
)
|
684
|
+
|
685
|
+
|
686
|
+
def _collect_futures(
|
687
|
+
futures: set[PrefectFuture[R]], expr: Any | PrefectFuture[R], context: Any
|
688
|
+
) -> Any | PrefectFuture[R]:
|
689
|
+
# Expressions inside quotes should not be traversed
|
690
|
+
if isinstance(context.get("annotation"), quote):
|
691
|
+
raise StopVisiting()
|
692
|
+
|
693
|
+
if isinstance(expr, PrefectFuture):
|
694
|
+
futures.add(expr)
|
695
|
+
|
696
|
+
return expr
|
@@ -1,7 +1,7 @@
|
|
1
1
|
prefect/.prefectignore,sha256=awSprvKT0vI8a64mEOLrMxhxqcO-b0ERQeYpA2rNKVQ,390
|
2
2
|
prefect/__init__.py,sha256=iCdcC5ZmeewikCdnPEP6YBAjPNV5dvfxpYCTpw30Hkw,3685
|
3
3
|
prefect/__main__.py,sha256=WFjw3kaYJY6pOTA7WDOgqjsz8zUEUZHCcj3P5wyVa-g,66
|
4
|
-
prefect/_build_info.py,sha256=
|
4
|
+
prefect/_build_info.py,sha256=EDorkrJUYtVWxr5Aoxi9ooVoj5KtlRaQZ-bkFwmKNr4,185
|
5
5
|
prefect/_result_records.py,sha256=S6QmsODkehGVSzbMm6ig022PYbI6gNKz671p_8kBYx4,7789
|
6
6
|
prefect/_waiters.py,sha256=Ia2ITaXdHzevtyWIgJoOg95lrEXQqNEOquHvw3T33UQ,9026
|
7
7
|
prefect/agent.py,sha256=dPvG1jDGD5HSH7aM2utwtk6RaJ9qg13XjkA0lAIgQmY,287
|
@@ -15,7 +15,7 @@ prefect/filesystems.py,sha256=v5YqGB4uXf9Ew2VuB9VCSkawvYMMVvEtZf7w1VmAmr8,18036
|
|
15
15
|
prefect/flow_engine.py,sha256=hZpTYEtwTPMtwVoTCrfD93igN7rlKeG_0kyCvdU4aYE,58876
|
16
16
|
prefect/flow_runs.py,sha256=dbHcXsOq1UsNM7vyJV9gboCTylmdUwQ_-W4NQt4R4ds,17267
|
17
17
|
prefect/flows.py,sha256=8gWWoZB8S8j8Iwz0TTc5F-f_8sTFucGm53aaue5vUi4,114116
|
18
|
-
prefect/futures.py,sha256=
|
18
|
+
prefect/futures.py,sha256=F4eplqRcqw5-aMNKu6-lOFOWdDNr0RGrPso4C4G02bU,24248
|
19
19
|
prefect/main.py,sha256=8V-qLB4GjEVCkGRgGXeaIk-JIXY8Z9FozcNluj4Sm9E,2589
|
20
20
|
prefect/plugins.py,sha256=FPRLR2mWVBMuOnlzeiTD9krlHONZH2rtYLD753JQDNQ,2516
|
21
21
|
prefect/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -146,7 +146,7 @@ prefect/docker/__init__.py,sha256=z6wdc6UFfiBG2jb9Jk64uCWVM04JKVWeVyDWwuuon8M,52
|
|
146
146
|
prefect/docker/docker_image.py,sha256=bR_pEq5-FDxlwTj8CP_7nwZ_MiGK6KxIi8v7DRjy1Kg,3138
|
147
147
|
prefect/events/__init__.py,sha256=GtKl2bE--pJduTxelH2xy7SadlLJmmis8WR1EYixhuA,2094
|
148
148
|
prefect/events/actions.py,sha256=A7jS8bo4zWGnrt3QfSoQs0uYC1xfKXio3IfU0XtTb5s,9129
|
149
|
-
prefect/events/clients.py,sha256=
|
149
|
+
prefect/events/clients.py,sha256=c5ZTt-ZVslvDr6-OrbsWb_7XUocWptGyAuVAVtAzokY,27589
|
150
150
|
prefect/events/filters.py,sha256=2hVfzc3Rdgy0mBHDutWxT__LJY0zpVM8greWX3y6kjM,8233
|
151
151
|
prefect/events/related.py,sha256=CTeexYUmmA93V4gsR33GIFmw-SS-X_ouOpRg-oeq-BU,6672
|
152
152
|
prefect/events/utilities.py,sha256=ww34bTMENCNwcp6RhhgzG0KgXOvKGe0MKmBdSJ8NpZY,3043
|
@@ -317,7 +317,7 @@ prefect/workers/cloud.py,sha256=dPvG1jDGD5HSH7aM2utwtk6RaJ9qg13XjkA0lAIgQmY,287
|
|
317
317
|
prefect/workers/process.py,sha256=Yi5D0U5AQ51wHT86GdwtImXSefe0gJf3LGq4r4z9zwM,11090
|
318
318
|
prefect/workers/server.py,sha256=2pmVeJZiVbEK02SO6BEZaBIvHMsn6G8LzjW8BXyiTtk,1952
|
319
319
|
prefect/workers/utilities.py,sha256=VfPfAlGtTuDj0-Kb8WlMgAuOfgXCdrGAnKMapPSBrwc,2483
|
320
|
-
prefect_client-3.3.6.
|
321
|
-
prefect_client-3.3.6.
|
322
|
-
prefect_client-3.3.6.
|
323
|
-
prefect_client-3.3.6.
|
320
|
+
prefect_client-3.3.6.dev2.dist-info/METADATA,sha256=3OCxGaU3XixlWqbKkkhN9eW5vxz22tq5NWzfp19Ctgo,7471
|
321
|
+
prefect_client-3.3.6.dev2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
322
|
+
prefect_client-3.3.6.dev2.dist-info/licenses/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
|
323
|
+
prefect_client-3.3.6.dev2.dist-info/RECORD,,
|
File without changes
|
{prefect_client-3.3.6.dev1.dist-info → prefect_client-3.3.6.dev2.dist-info}/licenses/LICENSE
RENAMED
File without changes
|