prefect-client 2.18.1__py3-none-any.whl → 2.18.3__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/automations.py +162 -0
- prefect/client/orchestration.py +29 -11
- prefect/client/schemas/objects.py +11 -8
- prefect/engine.py +17 -1
- prefect/events/cli/automations.py +157 -34
- prefect/events/clients.py +3 -2
- prefect/events/filters.py +1 -1
- prefect/events/schemas/automations.py +2 -2
- prefect/events/schemas/deployment_triggers.py +1 -1
- prefect/events/schemas/events.py +11 -4
- prefect/events/schemas/labelling.py +1 -1
- prefect/flows.py +14 -11
- prefect/input/run_input.py +3 -1
- prefect/new_flow_engine.py +244 -57
- prefect/new_task_engine.py +159 -45
- prefect/server/api/collections_data/views/aggregate-worker-metadata.json +1 -1
- prefect/settings.py +21 -0
- prefect/tasks.py +134 -24
- prefect/utilities/asyncutils.py +16 -12
- prefect/workers/process.py +2 -1
- {prefect_client-2.18.1.dist-info → prefect_client-2.18.3.dist-info}/METADATA +1 -1
- {prefect_client-2.18.1.dist-info → prefect_client-2.18.3.dist-info}/RECORD +25 -24
- {prefect_client-2.18.1.dist-info → prefect_client-2.18.3.dist-info}/LICENSE +0 -0
- {prefect_client-2.18.1.dist-info → prefect_client-2.18.3.dist-info}/WHEEL +0 -0
- {prefect_client-2.18.1.dist-info → prefect_client-2.18.3.dist-info}/top_level.txt +0 -0
prefect/utilities/asyncutils.py
CHANGED
@@ -9,6 +9,7 @@ import threading
|
|
9
9
|
import warnings
|
10
10
|
from concurrent.futures import ThreadPoolExecutor
|
11
11
|
from contextlib import asynccontextmanager
|
12
|
+
from contextvars import copy_context
|
12
13
|
from functools import partial, wraps
|
13
14
|
from threading import Thread
|
14
15
|
from typing import (
|
@@ -22,6 +23,7 @@ from typing import (
|
|
22
23
|
Type,
|
23
24
|
TypeVar,
|
24
25
|
Union,
|
26
|
+
cast,
|
25
27
|
)
|
26
28
|
from uuid import UUID, uuid4
|
27
29
|
|
@@ -82,11 +84,10 @@ def is_async_gen_fn(func):
|
|
82
84
|
|
83
85
|
def run_sync(coroutine: Coroutine[Any, Any, T]) -> T:
|
84
86
|
"""
|
85
|
-
Runs a coroutine from a synchronous context
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
notebooks where the event loop runs on the main thread.
|
87
|
+
Runs a coroutine from a synchronous context. A thread will be spawned
|
88
|
+
to run the event loop if necessary, which allows coroutines to run in
|
89
|
+
environments like Jupyter notebooks where the event loop runs on the main
|
90
|
+
thread.
|
90
91
|
|
91
92
|
Args:
|
92
93
|
coroutine: The coroutine to run.
|
@@ -103,16 +104,19 @@ def run_sync(coroutine: Coroutine[Any, Any, T]) -> T:
|
|
103
104
|
run_sync(my_async_function(1))
|
104
105
|
```
|
105
106
|
"""
|
107
|
+
# ensure context variables are properly copied to the async frame
|
108
|
+
context = copy_context()
|
106
109
|
try:
|
107
110
|
loop = asyncio.get_running_loop()
|
108
|
-
if loop.is_running():
|
109
|
-
with ThreadPoolExecutor() as executor:
|
110
|
-
future = executor.submit(asyncio.run, coroutine)
|
111
|
-
return future.result()
|
112
|
-
else:
|
113
|
-
return asyncio.run(coroutine)
|
114
111
|
except RuntimeError:
|
115
|
-
|
112
|
+
loop = None
|
113
|
+
|
114
|
+
if loop and loop.is_running():
|
115
|
+
with ThreadPoolExecutor() as executor:
|
116
|
+
future = executor.submit(context.run, asyncio.run, coroutine)
|
117
|
+
return cast(T, future.result())
|
118
|
+
else:
|
119
|
+
return context.run(asyncio.run, coroutine)
|
116
120
|
|
117
121
|
|
118
122
|
async def run_sync_in_worker_thread(
|
prefect/workers/process.py
CHANGED
@@ -13,6 +13,7 @@ to poll for flow runs.
|
|
13
13
|
For more information about work pools and workers,
|
14
14
|
checkout out the [Prefect docs](/concepts/work-pools/).
|
15
15
|
"""
|
16
|
+
|
16
17
|
import asyncio
|
17
18
|
import contextlib
|
18
19
|
import os
|
@@ -142,7 +143,7 @@ class ProcessWorker(BaseWorker):
|
|
142
143
|
"Execute flow runs as subprocesses on a worker. Works well for local execution"
|
143
144
|
" when first getting started."
|
144
145
|
)
|
145
|
-
_display_name = "
|
146
|
+
_display_name = "Process"
|
146
147
|
_documentation_url = (
|
147
148
|
"https://docs.prefect.io/latest/api-ref/prefect/workers/process/"
|
148
149
|
)
|
@@ -3,27 +3,28 @@ prefect/__init__.py,sha256=iZ9157-WJF7ImPrnwbSeteWyEXPprzphTacfxLLsUVI,4990
|
|
3
3
|
prefect/_version.py,sha256=I9JsXwt7BjAAbMEZgtmE3a6dJ2jqV-wqWto9D6msb3k,24597
|
4
4
|
prefect/agent.py,sha256=HaGT0yh3fciluYpO99dVHo_LHq7N2cYLuWNrEV_kPV8,27789
|
5
5
|
prefect/artifacts.py,sha256=mreaBE4qMoXkjc9YI-5cAxoye7ixraHB_zr8GTK9xPU,8694
|
6
|
+
prefect/automations.py,sha256=rjVtQblBlKhD_q24bG6zbxJeb_XQJnodMlhr565aZJY,4853
|
6
7
|
prefect/context.py,sha256=BMT8VbI5OmQPFll6I5BlP5lZYn8IoxFsuRjjkqu7wK4,18144
|
7
|
-
prefect/engine.py,sha256=
|
8
|
+
prefect/engine.py,sha256=iDzMZRwB_avmftGVxCJwO4ezW-faLpaoTxeGLWNXqKY,90406
|
8
9
|
prefect/exceptions.py,sha256=Fyl-GXvF9OuKHtsyn5EhWg81pkU1UG3DFHsI1JzhOQE,10851
|
9
10
|
prefect/filesystems.py,sha256=XniPSdBAqywj43X7GyfuWJQIbz07QJ5Y3cVNLhIF3lQ,35260
|
10
11
|
prefect/flow_runs.py,sha256=mFHLavZk1yZ62H3UazuNDBZWAF7AqKttA4rMcHgsVSw,3119
|
11
|
-
prefect/flows.py,sha256=
|
12
|
+
prefect/flows.py,sha256=eAn4sGqGHG8afpjMIDOwY1xl5CciioYIYB5v8fsrwc0,71253
|
12
13
|
prefect/futures.py,sha256=RaWfYIXtH7RsWxQ5QWTTlAzwtVV8XWpXaZT_hLq35vQ,12590
|
13
14
|
prefect/manifests.py,sha256=sTM7j8Us5d49zaydYKWsKb7zJ96v1ChkLkLeR0GFYD8,683
|
14
|
-
prefect/new_flow_engine.py,sha256=
|
15
|
-
prefect/new_task_engine.py,sha256=
|
15
|
+
prefect/new_flow_engine.py,sha256=OyKq0ngvQMWajCESfUsTu15mARv3zoM7sC6kP2uBm-w,17649
|
16
|
+
prefect/new_task_engine.py,sha256=orLK-RPeJleJ5ID5zKRk-g0TQFtxT_qSTCvOK775pKU,17458
|
16
17
|
prefect/plugins.py,sha256=0C-D3-dKi06JZ44XEGmLjCiAkefbE_lKX-g3urzdbQ4,4163
|
17
18
|
prefect/profiles.toml,sha256=Fs8hD_BdWHZgAijgk8pK_Zx-Pm-YFixqDIfEP6fM-qU,38
|
18
19
|
prefect/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
20
|
prefect/results.py,sha256=JXuySIfJb9weg49A2YsI3ZxoPoAAYcXn7ajui_8vMbE,25502
|
20
21
|
prefect/serializers.py,sha256=MsMTPgo6APq-pN1pcLD9COdVFnBS9E3WaMuaKgpeJdQ,8821
|
21
|
-
prefect/settings.py,sha256=
|
22
|
+
prefect/settings.py,sha256=vgeRI40_VNqt8BoIdgAnMKloWHpqzBmB4WKaI0Q6LZE,74410
|
22
23
|
prefect/states.py,sha256=B38zIXnqc8cmw3GPxmMQ4thX6pXb6UtG4PoTZ5thGQs,21036
|
23
24
|
prefect/task_engine.py,sha256=_2I7XLwoT_nNhpzTMa_52aQKjsDoaW6WpzwIHYEWZS0,2598
|
24
25
|
prefect/task_runners.py,sha256=HXUg5UqhZRN2QNBqMdGE1lKhwFhT8TaRN75ScgLbnw8,11012
|
25
26
|
prefect/task_server.py,sha256=3f6rDIOXmhhF_MDHGk5owaU9lyLHsR-zgCp6pIHEUyo,11075
|
26
|
-
prefect/tasks.py,sha256=
|
27
|
+
prefect/tasks.py,sha256=QYx4WrvdlSpxGgRZdrcxkX6RUHovSc1NoRqGup1s8q4,55077
|
27
28
|
prefect/variables.py,sha256=4r5gVGpAZxLWHj5JoNZJTuktX1-u3ENzVp3t4M6FDgs,3815
|
28
29
|
prefect/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
30
|
prefect/_internal/_logging.py,sha256=HvNHY-8P469o5u4LYEDBTem69XZEt1QUeUaLToijpak,810
|
@@ -163,13 +164,13 @@ prefect/client/base.py,sha256=DFW2HWPLneBCesQDAiQfbu5KZQeVsc5DVwLGduMEeUE,15460
|
|
163
164
|
prefect/client/cloud.py,sha256=97wWyWefq4Ngjs06HefD04obVGp6gms1PPt2D_vPYMs,4072
|
164
165
|
prefect/client/collections.py,sha256=I9EgbTg4Fn57gn8vwP_WdDmgnATbx9gfkm2jjhCORjw,1037
|
165
166
|
prefect/client/constants.py,sha256=Z_GG8KF70vbbXxpJuqW5pLnwzujTVeHbcYYRikNmGH0,29
|
166
|
-
prefect/client/orchestration.py,sha256=
|
167
|
+
prefect/client/orchestration.py,sha256=f0wLgC8g82coHbtFhta776BKHmPebtdjDsf4Zgk760Q,124402
|
167
168
|
prefect/client/subscriptions.py,sha256=3kqPH3F-CwyrR5wygCpJMjRjM_gcQjd54Qjih6FcLlA,3372
|
168
169
|
prefect/client/utilities.py,sha256=VcqwaqSmfOMqtNd0YbGodpdvw7nl20VJPhZc6NG-AtA,3067
|
169
170
|
prefect/client/schemas/__init__.py,sha256=KlyqFV-hMulMkNstBn_0ijoHoIwJZaBj6B1r07UmgvE,607
|
170
171
|
prefect/client/schemas/actions.py,sha256=TXutc-QZiuCuAMk4h3TZx-hDSBx38PXjr-Atplasi8I,25992
|
171
172
|
prefect/client/schemas/filters.py,sha256=gv57m0bHJqL7Ifsc_vAdRODFomaMVcrGXKAahOSBU4w,35598
|
172
|
-
prefect/client/schemas/objects.py,sha256=
|
173
|
+
prefect/client/schemas/objects.py,sha256=EuGegMxb88-VBQ9kjYc3x10WKaOK-6RWWXDMRIs_qnY,52389
|
173
174
|
prefect/client/schemas/responses.py,sha256=pUCjHox9DZdmxPBNANCcNzDVSA8q5TUOzl3oru995Cs,14665
|
174
175
|
prefect/client/schemas/schedules.py,sha256=lDD6L9guvVStvjFXDZ5TkdmWVEgVEVEwqOsD8Uc4dFI,12183
|
175
176
|
prefect/client/schemas/sorting.py,sha256=EIQ6FUjUWMwk6fn6ckVLQLXOP-GI5kce7ftjUkDFWV0,2490
|
@@ -197,19 +198,19 @@ prefect/deprecated/packaging/orion.py,sha256=3vRudge_XI4JX3aVxtK2QQvfHQ836C2maNJ
|
|
197
198
|
prefect/deprecated/packaging/serializers.py,sha256=kkFNR8_w2C6zI5A1w_-lfbLVFlhn3SJ28i3T3WKBO94,5165
|
198
199
|
prefect/events/__init__.py,sha256=GtKl2bE--pJduTxelH2xy7SadlLJmmis8WR1EYixhuA,2094
|
199
200
|
prefect/events/actions.py,sha256=X72oHY4f_tstup7_Jv8qjSAwhQo3sHcJFaGoRhisVKA,9149
|
200
|
-
prefect/events/clients.py,sha256=
|
201
|
-
prefect/events/filters.py,sha256=
|
201
|
+
prefect/events/clients.py,sha256=slMDmwoNVHs5P_IaOrIH6caOWf9H937QmYMaFOnUwTc,20391
|
202
|
+
prefect/events/filters.py,sha256=Y2gH6EyQTKj2Tj9Nudbjg-nUqrPaIbzAQ2zqKsPCiHc,8245
|
202
203
|
prefect/events/instrument.py,sha256=IhPBjs8n5xaAC_sPo_GfgppNLYWxIoX0l66WlkzQhlw,3715
|
203
204
|
prefect/events/related.py,sha256=WTygrgtmxXWVlLFey5wJqO45BjHcUMeZkUbXGGmBWfE,6831
|
204
205
|
prefect/events/utilities.py,sha256=zEDmxJpg_stwOuZU4wKjOoOaKn1_9EyULEu9v8nUi6I,2632
|
205
206
|
prefect/events/worker.py,sha256=x1mq9ChaAdUdZpq5lJdRu9yuwiocZXpMuGRL1ZEUWW4,3547
|
206
207
|
prefect/events/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
207
|
-
prefect/events/cli/automations.py,sha256=
|
208
|
+
prefect/events/cli/automations.py,sha256=4niz0uaiv-RAAIhhnN-pkRBpp-lR1BSaKlNwDLvJjaU,10934
|
208
209
|
prefect/events/schemas/__init__.py,sha256=YUyTEY9yVEJAOXWLng7-WlgNlTlJ25kDNPey3pXkn4k,169
|
209
|
-
prefect/events/schemas/automations.py,sha256=
|
210
|
-
prefect/events/schemas/deployment_triggers.py,sha256=
|
211
|
-
prefect/events/schemas/events.py,sha256=
|
212
|
-
prefect/events/schemas/labelling.py,sha256=
|
210
|
+
prefect/events/schemas/automations.py,sha256=c5KwMrmCmQBsdEMapcueJs_t6IkufdV3miQO3nwr43Q,14171
|
211
|
+
prefect/events/schemas/deployment_triggers.py,sha256=xCipjdC-Z80BOJksJlDIwAPpRzAxbFUbBroKOeZYQ90,9567
|
212
|
+
prefect/events/schemas/events.py,sha256=Xdk3VRO42j1oe3qiXfhKAEBL-TrvKjn0qZj_jxvI8Rw,9394
|
213
|
+
prefect/events/schemas/labelling.py,sha256=and3kx2SgnwD2MlMiRxNyFCV_CDZvAVvW1X9GDn0a6E,3255
|
213
214
|
prefect/infrastructure/__init__.py,sha256=Fm1Rhc4I7ZfJePpUAl1F4iNEtcDugoT650WXXt6xoCM,770
|
214
215
|
prefect/infrastructure/base.py,sha256=s2nNbwXnqHV-sBy7LeZzV1IVjqAO0zv795HM4RHOvQI,10880
|
215
216
|
prefect/infrastructure/container.py,sha256=RuWqxSgwwoAxJ9FquYH12wEUizMQM9_b-e5p13ZVscI,31851
|
@@ -222,7 +223,7 @@ prefect/infrastructure/provisioners/ecs.py,sha256=HOURoT3psIUZY1AI-t-l2mT74JdbpW
|
|
222
223
|
prefect/infrastructure/provisioners/modal.py,sha256=mLblDjWWszXXMXWXYzkR_5s3nFFL6c3GvVX-VmIeU5A,9035
|
223
224
|
prefect/input/__init__.py,sha256=TPJ9UfG9_SiBze23sQwU1MnWI8AgyEMNihotgTebFQ0,627
|
224
225
|
prefect/input/actions.py,sha256=YfA9E3lFyH12UPNKGrX0fbWC-vZopndvQ4A6fojjh-k,3876
|
225
|
-
prefect/input/run_input.py,sha256=
|
226
|
+
prefect/input/run_input.py,sha256=BknFCVcpS9b7Gjywv2-lLBg4JQf7rKnRJIVIxsEbdTg,18697
|
226
227
|
prefect/logging/__init__.py,sha256=zx9f5_dWrR4DbcTOFBpNGOPoCZ1QcPFudr7zxb2XRpA,148
|
227
228
|
prefect/logging/configuration.py,sha256=bYqFJm0QgLz92Dub1Lbl3JONjjm0lTK149pNAGbxPdM,3467
|
228
229
|
prefect/logging/filters.py,sha256=9keHLN4-cpnsWcii1qU0RITNi9-m7pOhkJ_t0MtCM4k,1117
|
@@ -243,7 +244,7 @@ prefect/runtime/__init__.py,sha256=iYmfK1HmXiXXCQK77wDloOqZmY7SFF5iyr37jRzuf-c,4
|
|
243
244
|
prefect/runtime/deployment.py,sha256=UWNXH-3-NNVxLCl5XnDKiofo4a5j8w_42ns1OSQMixg,4751
|
244
245
|
prefect/runtime/flow_run.py,sha256=aFM3e9xqpeZQ4WkvZQXD0lmXu2fNVVVA1etSN3ZI9aE,8444
|
245
246
|
prefect/runtime/task_run.py,sha256=_np3pjBHWkvEtSe-QElEAGwUct629vVx_sahPr-H8gM,3402
|
246
|
-
prefect/server/api/collections_data/views/aggregate-worker-metadata.json,sha256=
|
247
|
+
prefect/server/api/collections_data/views/aggregate-worker-metadata.json,sha256=hcS7IWry73QATmzD7qv-uXBmCOrqeKtfIFU46bv-CRs,80259
|
247
248
|
prefect/server/api/static/prefect-logo-mark-gradient.png,sha256=ylRjJkI_JHCw8VbQasNnXQHwZW-sH-IQiUGSD3aWP1E,73430
|
248
249
|
prefect/software/__init__.py,sha256=cn7Hesmkv3unA3NynEiyB0Cj2jAzV17yfwjVsS5Ecso,106
|
249
250
|
prefect/software/base.py,sha256=GV6a5RrLx3JaOg1RI44jZTsI_qbqNWbWF3uVO5csnHM,1464
|
@@ -253,7 +254,7 @@ prefect/software/python.py,sha256=EssQ16aMvWSzzWagtNPfjQLu9ehieRwN0iWeqpBVtRU,17
|
|
253
254
|
prefect/types/__init__.py,sha256=0HPZZotMwbGEoor_hmLlNDohkqoeCGuE8NOJ5fVXTyI,2448
|
254
255
|
prefect/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
255
256
|
prefect/utilities/annotations.py,sha256=p33yhh1Zx8BZUlTtl8gKRbpwWU9FVnZ8cfYrcd5KxDI,3103
|
256
|
-
prefect/utilities/asyncutils.py,sha256=
|
257
|
+
prefect/utilities/asyncutils.py,sha256=TiKiurOoPVEM9HgRKtBg6W3zn0EnyVr1JOV2sHbdgpA,16833
|
257
258
|
prefect/utilities/callables.py,sha256=vbgRqfd79iXbh4QhNX1Ig9MTIcj-aAgH5yLSqobd2sM,11657
|
258
259
|
prefect/utilities/collections.py,sha256=0v-NNXxYYzkUTCCNDMNB44AnDv9yj35UYouNraCqlo8,15449
|
259
260
|
prefect/utilities/compat.py,sha256=mNQZDnzyKaOqy-OV-DnmH_dc7CNF5nQgW_EsA4xMr7g,906
|
@@ -280,11 +281,11 @@ prefect/utilities/schema_tools/validation.py,sha256=ffHO9ryyc4ARgktYrgf6xwjGTY65
|
|
280
281
|
prefect/workers/__init__.py,sha256=6el2Q856CuRPa5Hdrbm9QyAWB_ovcT2bImSFsoWI46k,66
|
281
282
|
prefect/workers/base.py,sha256=RgnveLqomr7m0Tla2-9mFy81XCny9TvpuvvBjlHw3bc,44977
|
282
283
|
prefect/workers/block.py,sha256=5bdCuqT-4I-et_8ZLG2y1AODzYiCQwFiivhdt5NMEog,7635
|
283
|
-
prefect/workers/process.py,sha256=
|
284
|
+
prefect/workers/process.py,sha256=JkmG-juTiVR6acy1t29NkTdLgp5p5VbBHA-2dCCOdv4,10094
|
284
285
|
prefect/workers/server.py,sha256=WVZJxR8nTMzK0ov0BD0xw5OyQpT26AxlXbsGQ1OrxeQ,1551
|
285
286
|
prefect/workers/utilities.py,sha256=VfPfAlGtTuDj0-Kb8WlMgAuOfgXCdrGAnKMapPSBrwc,2483
|
286
|
-
prefect_client-2.18.
|
287
|
-
prefect_client-2.18.
|
288
|
-
prefect_client-2.18.
|
289
|
-
prefect_client-2.18.
|
290
|
-
prefect_client-2.18.
|
287
|
+
prefect_client-2.18.3.dist-info/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
|
288
|
+
prefect_client-2.18.3.dist-info/METADATA,sha256=OTl_Gv2PvAeIT0Cc0nDWRRxdA16Ro2ZSlEulpPdfu7o,7401
|
289
|
+
prefect_client-2.18.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
290
|
+
prefect_client-2.18.3.dist-info/top_level.txt,sha256=MJZYJgFdbRc2woQCeB4vM6T33tr01TmkEhRcns6H_H4,8
|
291
|
+
prefect_client-2.18.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|