prefect-client 2.20.15__py3-none-any.whl → 2.20.17__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.
@@ -1,5 +1,6 @@
1
1
  import asyncio
2
2
  import datetime
3
+ import ssl
3
4
  import warnings
4
5
  from contextlib import AsyncExitStack
5
6
  from typing import (
@@ -275,12 +276,18 @@ class PrefectClient:
275
276
  httpx_settings.setdefault("headers", {})
276
277
 
277
278
  if PREFECT_API_TLS_INSECURE_SKIP_VERIFY:
278
- httpx_settings.setdefault("verify", False)
279
+ # Create an unverified context for insecure connections
280
+ ctx = ssl.create_default_context()
281
+ ctx.check_hostname = False
282
+ ctx.verify_mode = ssl.CERT_NONE
283
+ httpx_settings.setdefault("verify", ctx)
279
284
  else:
280
285
  cert_file = PREFECT_API_SSL_CERT_FILE.value()
281
286
  if not cert_file:
282
287
  cert_file = certifi.where()
283
- httpx_settings.setdefault("verify", cert_file)
288
+ # Create a verified context with the certificate file
289
+ ctx = ssl.create_default_context(cafile=cert_file)
290
+ httpx_settings.setdefault("verify", ctx)
284
291
 
285
292
  if api_version is None:
286
293
  api_version = SERVER_API_VERSION
@@ -492,6 +499,23 @@ class PrefectClient:
492
499
  response = await self._client.get(f"/flows/{flow_id}")
493
500
  return Flow.parse_obj(response.json())
494
501
 
502
+ async def delete_flow(self, flow_id: UUID) -> None:
503
+ """
504
+ Delete a flow by UUID.
505
+ Args:
506
+ flow_id: ID of the flow to be deleted
507
+ Raises:
508
+ prefect.exceptions.ObjectNotFound: If request returns 404
509
+ httpx.RequestError: If requests fails
510
+ """
511
+ try:
512
+ await self._client.delete(f"/flows/{flow_id}")
513
+ except httpx.HTTPStatusError as e:
514
+ if e.response.status_code == status.HTTP_404_NOT_FOUND:
515
+ raise prefect.exceptions.ObjectNotFound(http_exc=e) from e
516
+ else:
517
+ raise
518
+
495
519
  async def read_flows(
496
520
  self,
497
521
  *,
@@ -3438,11 +3462,19 @@ class SyncPrefectClient:
3438
3462
 
3439
3463
  if PREFECT_API_TLS_INSECURE_SKIP_VERIFY:
3440
3464
  httpx_settings.setdefault("verify", False)
3465
+ # Create an unverified context for insecure connections
3466
+ ctx = ssl.create_default_context()
3467
+ ctx.check_hostname = False
3468
+ ctx.verify_mode = ssl.CERT_NONE
3469
+ httpx_settings.setdefault("verify", ctx)
3441
3470
  else:
3442
3471
  cert_file = PREFECT_API_SSL_CERT_FILE.value()
3443
3472
  if not cert_file:
3444
3473
  cert_file = certifi.where()
3445
3474
  httpx_settings.setdefault("verify", cert_file)
3475
+ # Create a verified context with the certificate file
3476
+ ctx = ssl.create_default_context(cafile=cert_file)
3477
+ httpx_settings.setdefault("verify", ctx)
3446
3478
 
3447
3479
  if api_version is None:
3448
3480
  api_version = SERVER_API_VERSION
@@ -410,6 +410,9 @@ class FlowRunPolicy(PrefectBaseModel):
410
410
  resuming: Optional[bool] = Field(
411
411
  default=False, description="Indicates if this run is resuming from a pause."
412
412
  )
413
+ retry_type: Optional[Literal["in_process", "reschedule"]] = Field(
414
+ default=None, description="The type of retry this run is undergoing."
415
+ )
413
416
 
414
417
  @root_validator
415
418
  def populate_deprecated_fields(cls, values):
prefect/settings.py CHANGED
@@ -1310,6 +1310,36 @@ compromise. Adjust this setting based on your specific security requirements
1310
1310
  and usage patterns.
1311
1311
  """
1312
1312
 
1313
+ PREFECT_SERVER_CORS_ALLOWED_ORIGINS = Setting(
1314
+ str,
1315
+ default="*",
1316
+ )
1317
+ """
1318
+ A comma-separated list of origins that are authorized to make cross-origin requests to the API.
1319
+
1320
+ By default, this is set to `*`, which allows requests from all origins.
1321
+ """
1322
+
1323
+ PREFECT_SERVER_CORS_ALLOWED_METHODS = Setting(
1324
+ str,
1325
+ default="*",
1326
+ )
1327
+ """
1328
+ A comma-separated list of methods that are authorized to make cross-origin requests to the API.
1329
+
1330
+ By default, this is set to `*`, which allows requests with all methods.
1331
+ """
1332
+
1333
+ PREFECT_SERVER_CORS_ALLOWED_HEADERS = Setting(
1334
+ str,
1335
+ default="*",
1336
+ )
1337
+ """
1338
+ A comma-separated list of headers that are authorized to make cross-origin requests to the API.
1339
+
1340
+ By default, this is set to `*`, which allows requests with all headers.
1341
+ """
1342
+
1313
1343
  PREFECT_UI_ENABLED = Setting(
1314
1344
  bool,
1315
1345
  default=True,
prefect/tasks.py CHANGED
@@ -342,6 +342,10 @@ class Task(Generic[P, R]):
342
342
 
343
343
  if callable(retry_delay_seconds):
344
344
  self.retry_delay_seconds = retry_delay_seconds(retries)
345
+ elif not isinstance(retry_delay_seconds, (list, int, float, type(None))):
346
+ raise TypeError(
347
+ f"Invalid `retry_delay_seconds` provided; must be an int, float, list or callable. Received type {type(retry_delay_seconds)}"
348
+ )
345
349
  else:
346
350
  self.retry_delay_seconds = retry_delay_seconds
347
351
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: prefect-client
3
- Version: 2.20.15
3
+ Version: 2.20.17
4
4
  Summary: Workflow orchestration and management.
5
5
  Home-page: https://www.prefect.io
6
6
  Author: Prefect Technologies, Inc.
@@ -61,6 +61,18 @@ Requires-Dist: itsdangerous
61
61
  Requires-Dist: python-multipart>=0.0.7
62
62
  Provides-Extra: notifications
63
63
  Requires-Dist: apprise<2.0.0,>=1.1.0; extra == "notifications"
64
+ Dynamic: author
65
+ Dynamic: author-email
66
+ Dynamic: classifier
67
+ Dynamic: description
68
+ Dynamic: description-content-type
69
+ Dynamic: home-page
70
+ Dynamic: license-file
71
+ Dynamic: project-url
72
+ Dynamic: provides-extra
73
+ Dynamic: requires-dist
74
+ Dynamic: requires-python
75
+ Dynamic: summary
64
76
 
65
77
  <p align="center"><img src="https://github.com/PrefectHQ/prefect/assets/3407835/c654cbc6-63e8-4ada-a92a-efd2f8f24b85" width=1000></p>
66
78
 
@@ -19,12 +19,12 @@ 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=hQw2VtosFrWG_Q1w8WbodS6MIZBtX-QcGZz-hZfhp-g,75373
22
+ prefect/settings.py,sha256=Uz-NbP7KNLGVdJi_mhMTT_XHtJIZykWRcnkgNNtmoI0,76132
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
26
26
  prefect/task_server.py,sha256=-wHuAlY8DLEQuJcEvcFfB4da0Xdnmqk6D7GjHShh-Ik,11668
27
- prefect/tasks.py,sha256=PO4i5Dl69t6qnlVnXD4vnCvuZI07SNiyGOrXPkw8gR4,56439
27
+ prefect/tasks.py,sha256=6a_w3RWcTGmW3iZMzH-gFhvWLBp0-aw3j0ktnFZKCwc,56706
28
28
  prefect/variables.py,sha256=woS7idyYxCJ4BJ6AVitcfb_Db7CReFg7KLqW5hc685w,4014
29
29
  prefect/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  prefect/_internal/_logging.py,sha256=HvNHY-8P469o5u4LYEDBTem69XZEt1QUeUaLToijpak,810
@@ -167,13 +167,13 @@ prefect/client/base.py,sha256=YSPeE7hV0NCuD6WzoAACDYGFK4Yq35d26pITZ3elNyY,24669
167
167
  prefect/client/cloud.py,sha256=E54OAFr7bY5IXhhMBdjGwLQiR0eU-WWFoEEiOq2l53I,4104
168
168
  prefect/client/collections.py,sha256=I9EgbTg4Fn57gn8vwP_WdDmgnATbx9gfkm2jjhCORjw,1037
169
169
  prefect/client/constants.py,sha256=Z_GG8KF70vbbXxpJuqW5pLnwzujTVeHbcYYRikNmGH0,29
170
- prefect/client/orchestration.py,sha256=0lJx6nRKyboYFf_wVdRBVXaH5nFAdFOlWJZV0AXgYYg,140503
170
+ prefect/client/orchestration.py,sha256=rGIIJe1c9HhJSOj7ZdROz8Mnoj9qnDBuwzYjxygEqtk,141876
171
171
  prefect/client/subscriptions.py,sha256=3kqPH3F-CwyrR5wygCpJMjRjM_gcQjd54Qjih6FcLlA,3372
172
172
  prefect/client/utilities.py,sha256=7V4IkfC8x_OZuPXGvtIMmwZCOW63hSY8iVQkuRYTR6g,3079
173
173
  prefect/client/schemas/__init__.py,sha256=KlyqFV-hMulMkNstBn_0ijoHoIwJZaBj6B1r07UmgvE,607
174
174
  prefect/client/schemas/actions.py,sha256=4mq1OXMsXs6aGlXg1G232RNcn0ivAOIgikL0IKs6S-E,27943
175
175
  prefect/client/schemas/filters.py,sha256=gv57m0bHJqL7Ifsc_vAdRODFomaMVcrGXKAahOSBU4w,35598
176
- prefect/client/schemas/objects.py,sha256=bA0kAN9fbeiE6yUGX6bRlScheYtg8uxu0eeuC3-3zd8,53309
176
+ prefect/client/schemas/objects.py,sha256=V3UQCXpgh2xgxIN6wjzXbm-tSCjB9cOIH8yei9sDT4E,53464
177
177
  prefect/client/schemas/responses.py,sha256=XAc95g3PRL9UIkH9_VMuv0ECHKdc19guBLmdt5KefkI,15325
178
178
  prefect/client/schemas/schedules.py,sha256=ZF7fFbkcc8rVdx2MxE8DR0av3FUE9qDPjLreEuV8HfM,12193
179
179
  prefect/client/schemas/sorting.py,sha256=EIQ6FUjUWMwk6fn6ckVLQLXOP-GI5kce7ftjUkDFWV0,2490
@@ -289,8 +289,8 @@ prefect/workers/block.py,sha256=aYY__uq3v1eq1kkbVukxyhQNbkknaKYo6-_3tcrfKKA,8067
289
289
  prefect/workers/process.py,sha256=pPtCdA7fKQ4OsvoitT-cayZeh5HgLX4xBUYlb2Zad-Q,9475
290
290
  prefect/workers/server.py,sha256=WVZJxR8nTMzK0ov0BD0xw5OyQpT26AxlXbsGQ1OrxeQ,1551
291
291
  prefect/workers/utilities.py,sha256=VfPfAlGtTuDj0-Kb8WlMgAuOfgXCdrGAnKMapPSBrwc,2483
292
- prefect_client-2.20.15.dist-info/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
293
- prefect_client-2.20.15.dist-info/METADATA,sha256=U4V3ao8oXEhOp4W4sOo8omIQqiKoXGESn5b2vbQu9Tc,7392
294
- prefect_client-2.20.15.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
295
- prefect_client-2.20.15.dist-info/top_level.txt,sha256=MJZYJgFdbRc2woQCeB4vM6T33tr01TmkEhRcns6H_H4,8
296
- prefect_client-2.20.15.dist-info/RECORD,,
292
+ prefect_client-2.20.17.dist-info/licenses/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
293
+ prefect_client-2.20.17.dist-info/METADATA,sha256=vCtPAz7-Vqx07iy1qAOLRRUVk-Gteo1JnSg5t9lWfPs,7656
294
+ prefect_client-2.20.17.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
295
+ prefect_client-2.20.17.dist-info/top_level.txt,sha256=MJZYJgFdbRc2woQCeB4vM6T33tr01TmkEhRcns6H_H4,8
296
+ prefect_client-2.20.17.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (77.0.3)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5