prefect-client 2.20.1__py3-none-any.whl → 2.20.2__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.
File without changes
File without changes
@@ -586,7 +586,7 @@ class KubernetesJob(Infrastructure):
586
586
  "prefect-job-"
587
587
  # We generate a name using a hash of the primary job settings
588
588
  + stable_hash(
589
- *self.command,
589
+ *self.command if self.command else "",
590
590
  *self.env.keys(),
591
591
  *[v for v in self.env.values() if v is not None],
592
592
  )
@@ -12,12 +12,14 @@ Available attributes:
12
12
  - `scheduled_start_time`: the flow run's expected scheduled start time; defaults to now if not present
13
13
  - `name`: the name of the flow run
14
14
  - `flow_name`: the name of the flow
15
+ - `flow_version`: the version of the flow
15
16
  - `parameters`: the parameters that were passed to this run; note that these do not necessarily
16
17
  include default values set on the flow function, only the parameter values explicitly passed for the run
17
18
  - `parent_flow_run_id`: the ID of the flow run that triggered this run, if any
18
19
  - `parent_deployment_id`: the ID of the deployment that triggered this run, if any
19
20
  - `run_count`: the number of times this flow run has been run
20
21
  """
22
+
21
23
  import os
22
24
  from typing import Any, Dict, List, Optional
23
25
 
@@ -34,6 +36,7 @@ __all__ = [
34
36
  "scheduled_start_time",
35
37
  "name",
36
38
  "flow_name",
39
+ "flow_version",
37
40
  "parameters",
38
41
  "parent_flow_run_id",
39
42
  "parent_deployment_id",
@@ -188,6 +191,21 @@ def get_flow_name() -> Optional[str]:
188
191
  return flow_run_ctx.flow.name
189
192
 
190
193
 
194
+ def get_flow_version() -> Optional[str]:
195
+ flow_run_ctx = FlowRunContext.get()
196
+ run_id = get_id()
197
+ if flow_run_ctx is None and run_id is None:
198
+ return None
199
+ elif flow_run_ctx is None:
200
+ flow = from_sync.call_soon_in_loop_thread(
201
+ create_call(_get_flow_from_run, run_id)
202
+ ).result()
203
+
204
+ return flow.version
205
+ else:
206
+ return flow_run_ctx.flow.version
207
+
208
+
191
209
  def get_scheduled_start_time() -> pendulum.DateTime:
192
210
  flow_run_ctx = FlowRunContext.get()
193
211
  run_id = get_id()
@@ -271,6 +289,7 @@ FIELDS = {
271
289
  "scheduled_start_time": get_scheduled_start_time,
272
290
  "name": get_name,
273
291
  "flow_name": get_flow_name,
292
+ "flow_version": get_flow_version,
274
293
  "parameters": get_parameters,
275
294
  "parent_flow_run_id": get_parent_flow_run_id,
276
295
  "parent_deployment_id": get_parent_deployment_id,
prefect/settings.py CHANGED
@@ -345,7 +345,11 @@ def template_with_settings(*upstream_settings: Setting) -> Callable[["Settings",
345
345
  setting.name: setting.value_from(settings) for setting in upstream_settings
346
346
  }
347
347
  template = string.Template(str(value))
348
- return original_type(template.substitute(template_values))
348
+ # Note the use of `safe_substitute` to avoid raising an exception if a
349
+ # template value is missing. In this case, template values will be left
350
+ # as-is in the string. Using `safe_substitute` prevents us raising when
351
+ # the DB password contains a `$` character.
352
+ return original_type(template.safe_substitute(template_values))
349
353
 
350
354
  return templater
351
355
 
prefect/workers/base.py CHANGED
@@ -981,7 +981,12 @@ class BaseWorker(abc.ABC):
981
981
 
982
982
  deployment_vars = deployment.job_variables or {}
983
983
  flow_run_vars = flow_run.job_variables or {}
984
- job_variables = {**deployment_vars, **flow_run_vars}
984
+ job_variables = {**deployment_vars}
985
+
986
+ # merge environment variables carefully, otherwise full override
987
+ if isinstance(job_variables.get("env"), dict):
988
+ job_variables["env"].update(flow_run_vars.pop("env", {}))
989
+ job_variables.update(flow_run_vars)
985
990
 
986
991
  configuration = await self.job_configuration.from_template_and_values(
987
992
  base_job_template=self._work_pool.base_job_template,
@@ -1,16 +1,14 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prefect-client
3
- Version: 2.20.1
3
+ Version: 2.20.2
4
4
  Summary: Workflow orchestration and management.
5
5
  Home-page: https://www.prefect.io
6
6
  Author: Prefect Technologies, Inc.
7
7
  Author-email: help@prefect.io
8
- License: UNKNOWN
9
8
  Project-URL: Changelog, https://github.com/PrefectHQ/prefect/blob/main/RELEASE-NOTES.md
10
9
  Project-URL: Documentation, https://docs.prefect.io
11
10
  Project-URL: Source, https://github.com/PrefectHQ/prefect
12
11
  Project-URL: Tracker, https://github.com/PrefectHQ/prefect/issues
13
- Platform: UNKNOWN
14
12
  Classifier: Natural Language :: English
15
13
  Classifier: Intended Audience :: Developers
16
14
  Classifier: Intended Audience :: System Administrators
@@ -23,6 +21,7 @@ Classifier: Programming Language :: Python :: 3.11
23
21
  Classifier: Topic :: Software Development :: Libraries
24
22
  Requires-Python: >=3.8
25
23
  Description-Content-Type: text/markdown
24
+ License-File: LICENSE
26
25
  Requires-Dist: anyio<5.0.0,>=4.4.0
27
26
  Requires-Dist: asgi-lifespan<3.0,>=1.0
28
27
  Requires-Dist: cachetools<6.0,>=5.3
@@ -172,5 +171,3 @@ Prefect is made possible by the fastest growing community of thousands of friend
172
171
  See our [documentation on contributing to Prefect](https://docs.prefect.io/contributing/overview/).
173
172
 
174
173
  Thanks for being part of the mission to build a new kind of workflow system and, of course, **happy engineering!**
175
-
176
-
@@ -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=gFVXmGLapnkIV7hQvRJMJ6472UZJr6gqZYk1xwcqgnQ,74931
22
+ prefect/settings.py,sha256=U4nySdke3t_TyQRJtcgkv5x4LLzwUwWPFrYMFh-QJB8,75227
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
@@ -85,6 +85,7 @@ prefect/_vendor/fastapi/exceptions.py,sha256=131GbKBhoKJNvkE3k2-IvKye6xH-fvNaJ20
85
85
  prefect/_vendor/fastapi/logger.py,sha256=I9NNi3ov8AcqbsbC9wl1X-hdItKgYt2XTrx1f99Zpl4,54
86
86
  prefect/_vendor/fastapi/param_functions.py,sha256=BLvSfhJqiViP-_zYQ7BL_t9IARf4EJbKZSikDNsOkfw,9130
87
87
  prefect/_vendor/fastapi/params.py,sha256=UBEVQ_EK9iIbF3DOJXfH2zcO27uvf5NeRdslMOEtIEA,13350
88
+ prefect/_vendor/fastapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
89
  prefect/_vendor/fastapi/requests.py,sha256=KsGwp86w95S-0wgx4pL-T4i9M_z-_KlMzX43rdUg9YU,183
89
90
  prefect/_vendor/fastapi/responses.py,sha256=M67RzoU0K91ojgHjvDIDK3iyBAvA9YKPsUJIP4FtxtY,1381
90
91
  prefect/_vendor/fastapi/routing.py,sha256=Kz1WttDcSqHkt1fW9_UmkZG-G0noRY3FAStkfw_VUNE,57083
@@ -130,6 +131,7 @@ prefect/_vendor/starlette/datastructures.py,sha256=AyApp3jfD9muXBn8EVbuAVk6ZhCDY
130
131
  prefect/_vendor/starlette/endpoints.py,sha256=00KnI8grT2xxv1jERCvAgqwVxRDOo8hrqpFHnKow9xs,5319
131
132
  prefect/_vendor/starlette/exceptions.py,sha256=ODmYfjgNKWAZwfV8TDVepoEwhv1Kl92KvvwMvEJ04AA,1840
132
133
  prefect/_vendor/starlette/formparsers.py,sha256=aNoQl0CPI7pYnvae2k0KB2jNnv6mQJL-N2FuhRhPLW4,10450
134
+ prefect/_vendor/starlette/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
133
135
  prefect/_vendor/starlette/requests.py,sha256=dytpLA1l9oVb-u98i4caDI1z4-XtPCe1jzjFajlQWa8,10899
134
136
  prefect/_vendor/starlette/responses.py,sha256=1l36hyZeTXWYCQ8dYCo-eM_I6KyGuq_qUdtM9GBT3EA,12565
135
137
  prefect/_vendor/starlette/routing.py,sha256=Y0uiRXBQ0uRWs1O63qFD6doqKeh-KhqhuiHU5ovodQs,35696
@@ -214,7 +216,7 @@ prefect/events/schemas/labelling.py,sha256=and3kx2SgnwD2MlMiRxNyFCV_CDZvAVvW1X9G
214
216
  prefect/infrastructure/__init__.py,sha256=Fm1Rhc4I7ZfJePpUAl1F4iNEtcDugoT650WXXt6xoCM,770
215
217
  prefect/infrastructure/base.py,sha256=s2nNbwXnqHV-sBy7LeZzV1IVjqAO0zv795HM4RHOvQI,10880
216
218
  prefect/infrastructure/container.py,sha256=gl38tFrym_wHQb0pCtcitMmHlL6eckHKAL3-EAM2Gec,32140
217
- prefect/infrastructure/kubernetes.py,sha256=28DLYNomVj2edmtM1c0ksbGUkBd1GwOlIIMDdSaLPbw,35703
219
+ prefect/infrastructure/kubernetes.py,sha256=_hU3W4S7ka-KeDONgQvFKdEA6vno4-eAdIhJEq2vb74,35727
218
220
  prefect/infrastructure/process.py,sha256=ZclTVl55ygEItkfB-ARFEIIZW4bk9ImuQzMTFfQNrnE,11324
219
221
  prefect/infrastructure/provisioners/__init__.py,sha256=e9rfFnLqqwjexvYoiRZIY-CEwK-7ZhCQm745Z-Uxon8,1666
220
222
  prefect/infrastructure/provisioners/cloud_run.py,sha256=kqk8yRZ4gfGJLgCEJL8vNYvRyONe2Mc4e_0DHeEb0iM,17658
@@ -242,7 +244,7 @@ prefect/runner/submit.py,sha256=w53VdsqfwjW-M3e8hUAAoVlNrXsvGuuyGpEN0wi3vX0,8537
242
244
  prefect/runner/utils.py,sha256=G8qv6AwAa43HcgLOo5vDhoXna1xP0HlaMVYEbAv0Pck,3318
243
245
  prefect/runtime/__init__.py,sha256=iYmfK1HmXiXXCQK77wDloOqZmY7SFF5iyr37jRzuf-c,406
244
246
  prefect/runtime/deployment.py,sha256=UWNXH-3-NNVxLCl5XnDKiofo4a5j8w_42ns1OSQMixg,4751
245
- prefect/runtime/flow_run.py,sha256=aFM3e9xqpeZQ4WkvZQXD0lmXu2fNVVVA1etSN3ZI9aE,8444
247
+ prefect/runtime/flow_run.py,sha256=J9VzMiVtgkHIhu5_liusi3efRuCB4TRCKflxWOmieg8,8955
246
248
  prefect/runtime/task_run.py,sha256=_np3pjBHWkvEtSe-QElEAGwUct629vVx_sahPr-H8gM,3402
247
249
  prefect/server/api/collections_data/views/aggregate-worker-metadata.json,sha256=hcS7IWry73QATmzD7qv-uXBmCOrqeKtfIFU46bv-CRs,80259
248
250
  prefect/server/api/static/prefect-logo-mark-gradient.png,sha256=ylRjJkI_JHCw8VbQasNnXQHwZW-sH-IQiUGSD3aWP1E,73430
@@ -280,13 +282,13 @@ prefect/utilities/schema_tools/__init__.py,sha256=KsFsTEHQqgp89TkDpjggkgBBywoHQP
280
282
  prefect/utilities/schema_tools/hydration.py,sha256=RNuJK4Vd__V69gdQbaWSVhSkV0AUISfGzH_xd0p6Zh0,8291
281
283
  prefect/utilities/schema_tools/validation.py,sha256=zZHL_UFxAlgaUzi-qsEOrhWtZ7EkFQvPkX_YN1EJNTo,8414
282
284
  prefect/workers/__init__.py,sha256=6el2Q856CuRPa5Hdrbm9QyAWB_ovcT2bImSFsoWI46k,66
283
- prefect/workers/base.py,sha256=LKIMS2DaQSQRV4rjbrMYeQnY-9rzgj_KWBRIq-8c5rg,45125
285
+ prefect/workers/base.py,sha256=wCCxTUuU5fIyLOkfjCIFIKi7T60B3-UQsyrq0kJuHjg,45351
284
286
  prefect/workers/block.py,sha256=aYY__uq3v1eq1kkbVukxyhQNbkknaKYo6-_3tcrfKKA,8067
285
287
  prefect/workers/process.py,sha256=pPtCdA7fKQ4OsvoitT-cayZeh5HgLX4xBUYlb2Zad-Q,9475
286
288
  prefect/workers/server.py,sha256=WVZJxR8nTMzK0ov0BD0xw5OyQpT26AxlXbsGQ1OrxeQ,1551
287
289
  prefect/workers/utilities.py,sha256=VfPfAlGtTuDj0-Kb8WlMgAuOfgXCdrGAnKMapPSBrwc,2483
288
- prefect_client-2.20.1.dist-info/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
289
- prefect_client-2.20.1.dist-info/METADATA,sha256=LRLUAgUEkAvRJjlJhMTYJWFPiAdSRA-kuaOYA5z9FCc,7407
290
- prefect_client-2.20.1.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
291
- prefect_client-2.20.1.dist-info/top_level.txt,sha256=MJZYJgFdbRc2woQCeB4vM6T33tr01TmkEhRcns6H_H4,8
292
- prefect_client-2.20.1.dist-info/RECORD,,
290
+ prefect_client-2.20.2.dist-info/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
291
+ prefect_client-2.20.2.dist-info/METADATA,sha256=A2xzGpbdwZqxOsA5PS1ehunrwe547RvIBtCqrU3yO-U,7392
292
+ prefect_client-2.20.2.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
293
+ prefect_client-2.20.2.dist-info/top_level.txt,sha256=MJZYJgFdbRc2woQCeB4vM6T33tr01TmkEhRcns6H_H4,8
294
+ prefect_client-2.20.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.44.0)
2
+ Generator: setuptools (72.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5