prefect-client 2.20.6__py3-none-any.whl → 2.20.8__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.
@@ -580,6 +580,7 @@ class RunnerDeployment(BaseModel):
580
580
  cls,
581
581
  entrypoint: str,
582
582
  name: str,
583
+ flow_name: Optional[str] = None,
583
584
  interval: Optional[
584
585
  Union[Iterable[Union[int, float, timedelta]], int, float, timedelta]
585
586
  ] = None,
@@ -606,6 +607,7 @@ class RunnerDeployment(BaseModel):
606
607
  entrypoint: The path to a file containing a flow and the name of the flow function in
607
608
  the format `./path/to/file.py:flow_func_name`.
608
609
  name: A name for the deployment
610
+ flow_name: The name of the flow to deploy
609
611
  interval: An interval on which to execute the current flow. Accepts either a number
610
612
  or a timedelta object. If a number is given, it will be interpreted as seconds.
611
613
  cron: A cron schedule of when to execute runs of this flow.
@@ -649,7 +651,7 @@ class RunnerDeployment(BaseModel):
649
651
 
650
652
  deployment = cls(
651
653
  name=Path(name).stem,
652
- flow_name=flow.name,
654
+ flow_name=flow_name or flow.name,
653
655
  schedule=schedule,
654
656
  schedules=constructed_schedules,
655
657
  paused=paused,
@@ -678,6 +680,7 @@ class RunnerDeployment(BaseModel):
678
680
  storage: RunnerStorage,
679
681
  entrypoint: str,
680
682
  name: str,
683
+ flow_name: Optional[str] = None,
681
684
  interval: Optional[
682
685
  Union[Iterable[Union[int, float, timedelta]], int, float, timedelta]
683
686
  ] = None,
@@ -705,6 +708,7 @@ class RunnerDeployment(BaseModel):
705
708
  entrypoint: The path to a file containing a flow and the name of the flow function in
706
709
  the format `./path/to/file.py:flow_func_name`.
707
710
  name: A name for the deployment
711
+ flow_name: The name of the flow to deploy
708
712
  storage: A storage object to use for retrieving flow code. If not provided, a
709
713
  URL must be provided.
710
714
  interval: An interval on which to execute the current flow. Accepts either a number
@@ -755,7 +759,7 @@ class RunnerDeployment(BaseModel):
755
759
 
756
760
  deployment = cls(
757
761
  name=Path(name).stem,
758
- flow_name=flow.name,
762
+ flow_name=flow_name or flow.name,
759
763
  schedule=schedule,
760
764
  schedules=constructed_schedules,
761
765
  paused=paused,
prefect/engine.py CHANGED
@@ -167,6 +167,7 @@ from prefect.results import ResultFactory, UnknownResult
167
167
  from prefect.settings import (
168
168
  PREFECT_DEBUG_MODE,
169
169
  PREFECT_EXPERIMENTAL_ENABLE_NEW_ENGINE,
170
+ PREFECT_RUN_ON_COMPLETION_HOOKS_ON_CACHED,
170
171
  PREFECT_TASK_INTROSPECTION_WARN_THRESHOLD,
171
172
  PREFECT_TASKS_REFRESH_CACHE,
172
173
  PREFECT_UI_URL,
@@ -2117,6 +2118,19 @@ async def orchestrate_task_run(
2117
2118
  # flag to ensure we only update the task run name once
2118
2119
  run_name_set = False
2119
2120
 
2121
+ run_on_completion_hooks_on_cached = (
2122
+ PREFECT_RUN_ON_COMPLETION_HOOKS_ON_CACHED
2123
+ and state.is_completed()
2124
+ and state.name == "Cached"
2125
+ )
2126
+
2127
+ if run_on_completion_hooks_on_cached:
2128
+ await _run_task_hooks(
2129
+ task=task,
2130
+ task_run=task_run,
2131
+ state=state,
2132
+ )
2133
+
2120
2134
  # Only run the task if we enter a `RUNNING` state
2121
2135
  while state.is_running():
2122
2136
  # Retrieve the latest metadata for the task run context
@@ -2326,9 +2340,16 @@ async def _run_task_hooks(task: Task, task_run: TaskRun, state: State) -> None:
2326
2340
  catch and log any errors that occur.
2327
2341
  """
2328
2342
  hooks = None
2343
+ run_on_completion_hooks_on_cached = (
2344
+ PREFECT_RUN_ON_COMPLETION_HOOKS_ON_CACHED
2345
+ and state.is_completed()
2346
+ and state.name == "Cached"
2347
+ )
2329
2348
  if state.is_failed() and task.on_failure:
2330
2349
  hooks = task.on_failure
2331
- elif state.is_completed() and task.on_completion:
2350
+ elif (
2351
+ state.is_completed() or run_on_completion_hooks_on_cached
2352
+ ) and task.on_completion:
2332
2353
  hooks = task.on_completion
2333
2354
 
2334
2355
  if hooks:
prefect/flows.py CHANGED
@@ -679,6 +679,7 @@ class Flow(Generic[P, R]):
679
679
  storage=self._storage,
680
680
  entrypoint=self._entrypoint,
681
681
  name=name,
682
+ flow_name=self.name,
682
683
  interval=interval,
683
684
  cron=cron,
684
685
  rrule=rrule,
@@ -698,7 +699,7 @@ class Flow(Generic[P, R]):
698
699
  )
699
700
  else:
700
701
  return RunnerDeployment.from_flow(
701
- self,
702
+ flow=self,
702
703
  name=name,
703
704
  interval=interval,
704
705
  cron=cron,
@@ -77,6 +77,7 @@ loggers:
77
77
  prefect.extra:
78
78
  level: "${PREFECT_LOGGING_LEVEL}"
79
79
  handlers: [api]
80
+ propagate: false
80
81
 
81
82
  prefect.flow_runs:
82
83
  level: NOTSET
prefect/settings.py CHANGED
@@ -649,7 +649,7 @@ PREFECT_API_KEY = Setting(
649
649
  )
650
650
  """API key used to authenticate with a the Prefect API. Defaults to `None`."""
651
651
 
652
- PREFECT_API_ENABLE_HTTP2 = Setting(bool, default=True)
652
+ PREFECT_API_ENABLE_HTTP2 = Setting(bool, default=False)
653
653
  """
654
654
  If true, enable support for HTTP/2 for communicating with an API.
655
655
 
@@ -1759,6 +1759,11 @@ PREFECT_API_EVENTS_RELATED_RESOURCE_CACHE_TTL = Setting(
1759
1759
  How long to cache related resource data for emitting server-side vents
1760
1760
  """
1761
1761
 
1762
+ PREFECT_RUN_ON_COMPLETION_HOOKS_ON_CACHED = Setting(bool, default=False)
1763
+ """
1764
+ Whether or not to run on_completion hooks on cached task runs.
1765
+ """
1766
+
1762
1767
 
1763
1768
  def automation_settings_enabled() -> bool:
1764
1769
  """
@@ -399,6 +399,7 @@ def safe_load_namespace(
399
399
  # Save original sys.path and modify it
400
400
  original_sys_path = sys.path.copy()
401
401
  sys.path.insert(0, parent_dir)
402
+ sys.path.insert(0, file_dir)
402
403
 
403
404
  # Create a temporary module for import context
404
405
  temp_module = ModuleType(package_name)
prefect/workers/base.py CHANGED
@@ -139,6 +139,12 @@ class BaseJobConfiguration(BaseModel):
139
139
  )
140
140
  variables.update(values)
141
141
 
142
+ # deep merge `env`
143
+ if isinstance(job_config.get("env"), dict) and (
144
+ hardcoded_env := variables.get("env")
145
+ ):
146
+ job_config["env"] = {**hardcoded_env, **job_config.get("env", {})}
147
+
142
148
  populated_configuration = apply_values(template=job_config, values=variables)
143
149
  populated_configuration = await resolve_block_document_references(
144
150
  template=populated_configuration, client=client
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prefect-client
3
- Version: 2.20.6
3
+ Version: 2.20.8
4
4
  Summary: Workflow orchestration and management.
5
5
  Home-page: https://www.prefect.io
6
6
  Author: Prefect Technologies, Inc.
@@ -40,7 +40,7 @@ Requires-Dist: jsonschema<5.0.0,>=4.0.0
40
40
  Requires-Dist: orjson<4.0,>=3.7
41
41
  Requires-Dist: packaging<24.3,>=21.3
42
42
  Requires-Dist: pathspec>=0.8.0
43
- Requires-Dist: pydantic[email]!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.10.0
43
+ Requires-Dist: pydantic[email]!=2.0.0,!=2.0.1,!=2.1.0,<2.9.0,>=1.10.0
44
44
  Requires-Dist: pydantic-core<3.0.0,>=2.12.0
45
45
  Requires-Dist: python-dateutil<3.0.0,>=2.8.2
46
46
  Requires-Dist: python-slugify<9.0,>=5.0
@@ -5,11 +5,11 @@ prefect/agent.py,sha256=HaGT0yh3fciluYpO99dVHo_LHq7N2cYLuWNrEV_kPV8,27789
5
5
  prefect/artifacts.py,sha256=mreaBE4qMoXkjc9YI-5cAxoye7ixraHB_zr8GTK9xPU,8694
6
6
  prefect/automations.py,sha256=rjVtQblBlKhD_q24bG6zbxJeb_XQJnodMlhr565aZJY,4853
7
7
  prefect/context.py,sha256=Hgn3rIjCbqfCmGnZzV_eZ2FwxGjEhaZjUw_nppqNQSA,18189
8
- prefect/engine.py,sha256=yw6LVoaEUCTR-NkSJXRau2gB9jNCspMw83ELaxmwpnE,92291
8
+ prefect/engine.py,sha256=i68gM-ZZ2x9D4aIwaLmApWeHqpMb2U2QWNJjX3aPmZM,92887
9
9
  prefect/exceptions.py,sha256=ElqC81_w6XbTaxLYANLMIPK8Fz46NmJZCRKL4NZ-JIg,10907
10
10
  prefect/filesystems.py,sha256=XniPSdBAqywj43X7GyfuWJQIbz07QJ5Y3cVNLhIF3lQ,35260
11
11
  prefect/flow_runs.py,sha256=mFHLavZk1yZ62H3UazuNDBZWAF7AqKttA4rMcHgsVSw,3119
12
- prefect/flows.py,sha256=-Ietkctf2ONzmqcytI9Fc8T1-vtPmEuOo3m6wPNLIrQ,84735
12
+ prefect/flows.py,sha256=6ZPoUsKRwzLfAt-QFgfteKHdmhs-ybp6Mf_7ryckTGc,84777
13
13
  prefect/futures.py,sha256=RaWfYIXtH7RsWxQ5QWTTlAzwtVV8XWpXaZT_hLq35vQ,12590
14
14
  prefect/manifests.py,sha256=sTM7j8Us5d49zaydYKWsKb7zJ96v1ChkLkLeR0GFYD8,683
15
15
  prefect/new_flow_engine.py,sha256=A1adTWTBAwPCn6ay003Jsoc2SdYgHV4AcJo1bmpa_7Y,16039
@@ -19,7 +19,7 @@ prefect/profiles.toml,sha256=Fs8hD_BdWHZgAijgk8pK_Zx-Pm-YFixqDIfEP6fM-qU,38
19
19
  prefect/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  prefect/results.py,sha256=JXuySIfJb9weg49A2YsI3ZxoPoAAYcXn7ajui_8vMbE,25502
21
21
  prefect/serializers.py,sha256=MsMTPgo6APq-pN1pcLD9COdVFnBS9E3WaMuaKgpeJdQ,8821
22
- prefect/settings.py,sha256=U4nySdke3t_TyQRJtcgkv5x4LLzwUwWPFrYMFh-QJB8,75227
22
+ prefect/settings.py,sha256=hQw2VtosFrWG_Q1w8WbodS6MIZBtX-QcGZz-hZfhp-g,75373
23
23
  prefect/states.py,sha256=B38zIXnqc8cmw3GPxmMQ4thX6pXb6UtG4PoTZ5thGQs,21036
24
24
  prefect/task_engine.py,sha256=_2I7XLwoT_nNhpzTMa_52aQKjsDoaW6WpzwIHYEWZS0,2598
25
25
  prefect/task_runners.py,sha256=HXUg5UqhZRN2QNBqMdGE1lKhwFhT8TaRN75ScgLbnw8,11012
@@ -183,7 +183,7 @@ prefect/concurrency/sync.py,sha256=QtnPRfVX9GqVyuZOt6W9yJuT9G-PlCSVnxlZKFTjuKY,3
183
183
  prefect/deployments/__init__.py,sha256=dM866rOEz3BbAN_xaFMHj3Hw1oOFemBTZ2yxVE6IGoY,394
184
184
  prefect/deployments/base.py,sha256=0l2D_laMc3q2Q5nvh-WANv3iDy4Ih5BqcPMNJJbHuP0,16391
185
185
  prefect/deployments/deployments.py,sha256=S9ro-RUNrc2v8uWFkLr3-JE7h3RGC-HO_f5T7xe4ABw,41884
186
- prefect/deployments/runner.py,sha256=a2dxc84zCofZFXV47M2zfntqUaoAhGWvf7o0s3MjPws,44772
186
+ prefect/deployments/runner.py,sha256=hz_H83e7PMaMXaiZxvpQuDcIjh_JMdbXROKkjlGNxNY,44988
187
187
  prefect/deployments/schedules.py,sha256=23GDCAKOP-aAEKGappwTrM4HU67ndVH7NR4Dq0neU_U,1884
188
188
  prefect/deployments/steps/__init__.py,sha256=3pZWONAZzenDszqNQT3bmTFilnvjB6xMolMz9tr5pLw,229
189
189
  prefect/deployments/steps/core.py,sha256=KEV05IECTlUXz-GS8bzmhrxx6U9dXJP3-SB-o4-vr0s,6845
@@ -232,7 +232,7 @@ prefect/logging/formatters.py,sha256=EPppQgqvbsIoSDGZFUqHJj1XdL-dvXGZe4TEcuRtfOI
232
232
  prefect/logging/handlers.py,sha256=zypWVA9EbaKMimRnZWxjmYYmZE04pB7OP5zKwkrOYHQ,10685
233
233
  prefect/logging/highlighters.py,sha256=BpSXOy0n3lFVvlKWa7jC-HetAiClFi9jnQtEq5-rgok,1681
234
234
  prefect/logging/loggers.py,sha256=kfTpM0RIcWm87UBYKggzcv0xeFfbuSIjH_i4pXdAZlo,11485
235
- prefect/logging/logging.yml,sha256=UkEewf0c3_dURI2uCU4RrxkhI5Devoa1s93fl7hilcg,3160
235
+ prefect/logging/logging.yml,sha256=ALNY_E1i3E7tkagCB3Qg35IvuRBHt-t9QqVJvsSq5xA,3185
236
236
  prefect/pydantic/__init__.py,sha256=BsW32X7fvl44J1JQer1tkEpfleMtL2kL5Uy1KmwWvso,2714
237
237
  prefect/pydantic/main.py,sha256=ups_UULBhCPhB-E7X7-Qgbpor1oJdqChRzpD0ZYQH8A,839
238
238
  prefect/runner/__init__.py,sha256=7U-vAOXFkzMfRz1q8Uv6Otsvc0OrPYLLP44srwkJ_8s,89
@@ -265,7 +265,7 @@ prefect/utilities/dockerutils.py,sha256=O5lIgCej5KGRYU2TC1NzNuIK595uOIWJilhZXYEV
265
265
  prefect/utilities/engine.py,sha256=6O7zYZQfpo6FtsI6n9DUNs-MB7_xLs3iXiCnSukR8qI,26046
266
266
  prefect/utilities/filesystem.py,sha256=M_TeZ1MftjBf7hDLWk-Iphir369TpJ1binMsBKiO9YE,4449
267
267
  prefect/utilities/hashing.py,sha256=EOwZLmoIZImuSTxAvVqInabxJ-4RpEfYeg9e2EDQF8o,1752
268
- prefect/utilities/importtools.py,sha256=JteP9zFz-oJyxSVYr63kJ-RpDL2jjTfJMqgYaBst19M,19518
268
+ prefect/utilities/importtools.py,sha256=r1Ii7CfUJr50y4WktUcBcKMBS9qyL5i6dCpBWuG-D9c,19555
269
269
  prefect/utilities/math.py,sha256=wLwcKVidpNeWQi1TUIWWLHGjlz9UgboX9FUGhx_CQzo,2821
270
270
  prefect/utilities/names.py,sha256=x-stHcF7_tebJPvB1dz-5FvdXJXNBTg2kFZXSnIBBmk,1657
271
271
  prefect/utilities/processutils.py,sha256=yo_GO48pZzgn4A0IK5irTAoqyUCYvWKDSqHXCrtP8c4,14547
@@ -281,13 +281,13 @@ prefect/utilities/schema_tools/__init__.py,sha256=KsFsTEHQqgp89TkDpjggkgBBywoHQP
281
281
  prefect/utilities/schema_tools/hydration.py,sha256=RNuJK4Vd__V69gdQbaWSVhSkV0AUISfGzH_xd0p6Zh0,8291
282
282
  prefect/utilities/schema_tools/validation.py,sha256=zZHL_UFxAlgaUzi-qsEOrhWtZ7EkFQvPkX_YN1EJNTo,8414
283
283
  prefect/workers/__init__.py,sha256=6el2Q856CuRPa5Hdrbm9QyAWB_ovcT2bImSFsoWI46k,66
284
- prefect/workers/base.py,sha256=wCCxTUuU5fIyLOkfjCIFIKi7T60B3-UQsyrq0kJuHjg,45351
284
+ prefect/workers/base.py,sha256=LNcVu0FIDBYv2XnWH1a2uV2Yyngtlyq8_pvLC4dxbrc,45576
285
285
  prefect/workers/block.py,sha256=aYY__uq3v1eq1kkbVukxyhQNbkknaKYo6-_3tcrfKKA,8067
286
286
  prefect/workers/process.py,sha256=pPtCdA7fKQ4OsvoitT-cayZeh5HgLX4xBUYlb2Zad-Q,9475
287
287
  prefect/workers/server.py,sha256=WVZJxR8nTMzK0ov0BD0xw5OyQpT26AxlXbsGQ1OrxeQ,1551
288
288
  prefect/workers/utilities.py,sha256=VfPfAlGtTuDj0-Kb8WlMgAuOfgXCdrGAnKMapPSBrwc,2483
289
- prefect_client-2.20.6.dist-info/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
290
- prefect_client-2.20.6.dist-info/METADATA,sha256=NR7WdGoTzZ_ar-BpfiZhIW38HBAI5hQSkZvgmviBwEw,7391
291
- prefect_client-2.20.6.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
292
- prefect_client-2.20.6.dist-info/top_level.txt,sha256=MJZYJgFdbRc2woQCeB4vM6T33tr01TmkEhRcns6H_H4,8
293
- prefect_client-2.20.6.dist-info/RECORD,,
289
+ prefect_client-2.20.8.dist-info/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
290
+ prefect_client-2.20.8.dist-info/METADATA,sha256=N2zG-uLMm8bpAUI-KGSTVlDVZvVgLzE4BhpgSUQd-mQ,7391
291
+ prefect_client-2.20.8.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
292
+ prefect_client-2.20.8.dist-info/top_level.txt,sha256=MJZYJgFdbRc2woQCeB4vM6T33tr01TmkEhRcns6H_H4,8
293
+ prefect_client-2.20.8.dist-info/RECORD,,