prefect-client 3.4.7.dev4__py3-none-any.whl → 3.4.7.dev5__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 CHANGED
@@ -1,5 +1,5 @@
1
1
  # Generated by versioningit
2
- __version__ = "3.4.7.dev4"
3
- __build_date__ = "2025-06-18 08:09:28.573646+00:00"
4
- __git_commit__ = "f2a136e5b5fb96adfde1d9aa44fdedb5b11c97a0"
2
+ __version__ = "3.4.7.dev5"
3
+ __build_date__ = "2025-06-19 08:09:38.201573+00:00"
4
+ __git_commit__ = "3636ab85f878dffcfcb3a5f9a67055bd0219e63f"
5
5
  __dirty__ = False
@@ -6,6 +6,7 @@ from uuid import UUID
6
6
 
7
7
  from httpx import HTTPStatusError, RequestError
8
8
 
9
+ from prefect._internal.compatibility.deprecated import deprecated_callable
9
10
  from prefect.client.orchestration.base import BaseAsyncClient, BaseClient
10
11
  from prefect.exceptions import ObjectNotFound
11
12
 
@@ -167,7 +168,7 @@ class DeploymentClient(BaseClient):
167
168
 
168
169
  return UUID(deployment_id)
169
170
 
170
- def set_deployment_paused_state(self, deployment_id: UUID, paused: bool) -> None:
171
+ def _set_deployment_paused_state(self, deployment_id: UUID, paused: bool) -> None:
171
172
  self.request(
172
173
  "PATCH",
173
174
  "/deployments/{id}",
@@ -175,6 +176,72 @@ class DeploymentClient(BaseClient):
175
176
  json={"paused": paused},
176
177
  )
177
178
 
179
+ @deprecated_callable(
180
+ start_date="Jun 2025",
181
+ help="Use pause_deployment or resume_deployment instead.",
182
+ )
183
+ def set_deployment_paused_state(self, deployment_id: UUID, paused: bool) -> None:
184
+ """
185
+ DEPRECATED: Use pause_deployment or resume_deployment instead.
186
+
187
+ Set the paused state of a deployment.
188
+
189
+ Args:
190
+ deployment_id: the deployment ID to update
191
+ paused: whether the deployment should be paused
192
+ """
193
+ self._set_deployment_paused_state(deployment_id, paused)
194
+
195
+ def pause_deployment(self, deployment_id: Union[UUID, str]) -> None:
196
+ """
197
+ Pause a deployment by ID.
198
+
199
+ Args:
200
+ deployment_id: The deployment ID of interest (can be a UUID or a string).
201
+
202
+ Raises:
203
+ ObjectNotFound: If request returns 404
204
+ RequestError: If request fails
205
+ """
206
+ if not isinstance(deployment_id, UUID):
207
+ try:
208
+ deployment_id = UUID(deployment_id)
209
+ except ValueError:
210
+ raise ValueError(f"Invalid deployment ID: {deployment_id}")
211
+
212
+ try:
213
+ self._set_deployment_paused_state(deployment_id, paused=True)
214
+ except HTTPStatusError as e:
215
+ if e.response.status_code == 404:
216
+ raise ObjectNotFound(http_exc=e) from e
217
+ else:
218
+ raise
219
+
220
+ def resume_deployment(self, deployment_id: Union[UUID, str]) -> None:
221
+ """
222
+ Resume (unpause) a deployment by ID.
223
+
224
+ Args:
225
+ deployment_id: The deployment ID of interest (can be a UUID or a string).
226
+
227
+ Raises:
228
+ ObjectNotFound: If request returns 404
229
+ RequestError: If request fails
230
+ """
231
+ if not isinstance(deployment_id, UUID):
232
+ try:
233
+ deployment_id = UUID(deployment_id)
234
+ except ValueError:
235
+ raise ValueError(f"Invalid deployment ID: {deployment_id}")
236
+
237
+ try:
238
+ self._set_deployment_paused_state(deployment_id, paused=False)
239
+ except HTTPStatusError as e:
240
+ if e.response.status_code == 404:
241
+ raise ObjectNotFound(http_exc=e) from e
242
+ else:
243
+ raise
244
+
178
245
  def update_deployment(
179
246
  self,
180
247
  deployment_id: UUID,
@@ -760,7 +827,7 @@ class DeploymentAsyncClient(BaseAsyncClient):
760
827
 
761
828
  return UUID(deployment_id)
762
829
 
763
- async def set_deployment_paused_state(
830
+ async def _set_deployment_paused_state(
764
831
  self, deployment_id: UUID, paused: bool
765
832
  ) -> None:
766
833
  await self.request(
@@ -770,6 +837,74 @@ class DeploymentAsyncClient(BaseAsyncClient):
770
837
  json={"paused": paused},
771
838
  )
772
839
 
840
+ @deprecated_callable(
841
+ start_date="Jun 2025",
842
+ help="Use pause_deployment or resume_deployment instead.",
843
+ )
844
+ async def set_deployment_paused_state(
845
+ self, deployment_id: UUID, paused: bool
846
+ ) -> None:
847
+ """
848
+ DEPRECATED: Use pause_deployment or resume_deployment instead.
849
+
850
+ Set the paused state of a deployment.
851
+
852
+ Args:
853
+ deployment_id: the deployment ID to update
854
+ paused: whether the deployment should be paused
855
+ """
856
+ await self._set_deployment_paused_state(deployment_id, paused)
857
+
858
+ async def pause_deployment(self, deployment_id: Union[UUID, str]) -> None:
859
+ """
860
+ Pause a deployment by ID.
861
+
862
+ Args:
863
+ deployment_id: The deployment ID of interest (can be a UUID or a string).
864
+
865
+ Raises:
866
+ ObjectNotFound: If request returns 404
867
+ RequestError: If request fails
868
+ """
869
+ if not isinstance(deployment_id, UUID):
870
+ try:
871
+ deployment_id = UUID(deployment_id)
872
+ except ValueError:
873
+ raise ValueError(f"Invalid deployment ID: {deployment_id}")
874
+
875
+ try:
876
+ await self._set_deployment_paused_state(deployment_id, paused=True)
877
+ except HTTPStatusError as e:
878
+ if e.response.status_code == 404:
879
+ raise ObjectNotFound(http_exc=e) from e
880
+ else:
881
+ raise
882
+
883
+ async def resume_deployment(self, deployment_id: Union[UUID, str]) -> None:
884
+ """
885
+ Resume (unpause) a deployment by ID.
886
+
887
+ Args:
888
+ deployment_id: The deployment ID of interest (can be a UUID or a string).
889
+
890
+ Raises:
891
+ ObjectNotFound: If request returns 404
892
+ RequestError: If request fails
893
+ """
894
+ if not isinstance(deployment_id, UUID):
895
+ try:
896
+ deployment_id = UUID(deployment_id)
897
+ except ValueError:
898
+ raise ValueError(f"Invalid deployment ID: {deployment_id}")
899
+
900
+ try:
901
+ await self._set_deployment_paused_state(deployment_id, paused=False)
902
+ except HTTPStatusError as e:
903
+ if e.response.status_code == 404:
904
+ raise ObjectNotFound(http_exc=e) from e
905
+ else:
906
+ raise
907
+
773
908
  async def update_deployment(
774
909
  self,
775
910
  deployment_id: UUID,
prefect/runner/runner.py CHANGED
@@ -945,7 +945,7 @@ class Runner:
945
945
  """
946
946
  self._logger.info("Pausing all deployments...")
947
947
  for deployment_id in self._deployment_ids:
948
- await self._client.set_deployment_paused_state(deployment_id, True)
948
+ await self._client.pause_deployment(deployment_id)
949
949
  self._logger.debug(f"Paused deployment '{deployment_id}'")
950
950
 
951
951
  self._logger.info("All deployments have been paused!")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prefect-client
3
- Version: 3.4.7.dev4
3
+ Version: 3.4.7.dev5
4
4
  Summary: Workflow orchestration and management.
5
5
  Project-URL: Changelog, https://github.com/PrefectHQ/prefect/releases
6
6
  Project-URL: Documentation, https://docs.prefect.io
@@ -2,7 +2,7 @@ prefect/.prefectignore,sha256=awSprvKT0vI8a64mEOLrMxhxqcO-b0ERQeYpA2rNKVQ,390
2
2
  prefect/AGENTS.md,sha256=qmCZAuKIF9jQyp5TrW_T8bsM_97-QaiCoQp71A_b2Lg,1008
3
3
  prefect/__init__.py,sha256=iCdcC5ZmeewikCdnPEP6YBAjPNV5dvfxpYCTpw30Hkw,3685
4
4
  prefect/__main__.py,sha256=WFjw3kaYJY6pOTA7WDOgqjsz8zUEUZHCcj3P5wyVa-g,66
5
- prefect/_build_info.py,sha256=tffaShFeVAkOpp2FeHJl2rknEfdLB7UQINPTvgTU6a8,185
5
+ prefect/_build_info.py,sha256=j5vWqNJWh9LFc4M6XTXV72BgaN0wiTsLUGw4b6gVmco,185
6
6
  prefect/_result_records.py,sha256=S6QmsODkehGVSzbMm6ig022PYbI6gNKz671p_8kBYx4,7789
7
7
  prefect/_versioning.py,sha256=YqR5cxXrY4P6LM1Pmhd8iMo7v_G2KJpGNdsf4EvDFQ0,14132
8
8
  prefect/_waiters.py,sha256=Ia2ITaXdHzevtyWIgJoOg95lrEXQqNEOquHvw3T33UQ,9026
@@ -107,7 +107,7 @@ prefect/client/orchestration/_blocks_types/client.py,sha256=alA4xD-yp3mycAbzMyRu
107
107
  prefect/client/orchestration/_concurrency_limits/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
108
108
  prefect/client/orchestration/_concurrency_limits/client.py,sha256=r_oyY7hQbgyG1rntwe7WWcsraQHBKhk6MOPFUAHWiVc,23678
109
109
  prefect/client/orchestration/_deployments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
110
- prefect/client/orchestration/_deployments/client.py,sha256=a_sUmznQC3lBLxXfu4hIIbszbUc28sWXtCioQoNgZPk,43876
110
+ prefect/client/orchestration/_deployments/client.py,sha256=KMA_ldpBiUVqvV2-FSOgARyb3objs8MAAe1uD-RXcaE,48477
111
111
  prefect/client/orchestration/_flow_runs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
112
112
  prefect/client/orchestration/_flow_runs/client.py,sha256=fjh5J-LG8tsny7BGYEvynbuGuHDAudYHpx-PamL0GYQ,32220
113
113
  prefect/client/orchestration/_flows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -193,7 +193,7 @@ prefect/logging/loggers.py,sha256=rwFJv0i3dhdKr25XX-xUkQy4Vv4dy18bTy366jrC0OQ,12
193
193
  prefect/logging/logging.yml,sha256=G5hFJ57Vawz40_w8tDdhqq00dp103OvVDVmWrSQeQcQ,3285
194
194
  prefect/runner/__init__.py,sha256=pQBd9wVrUVUDUFJlgiweKSnbahoBZwqnd2O2jkhrULY,158
195
195
  prefect/runner/_observers.py,sha256=PpyXQL5bjp86AnDFEzcFPS5ayL6ExqcYgyuBMMQCO9Q,2183
196
- prefect/runner/runner.py,sha256=q_3l2awvZATTTgVW3MYiElWHRWw5_ZIliUN9Ltt9d9M,59591
196
+ prefect/runner/runner.py,sha256=bucchmFv7g4lYaxDyPtkRXZgyaBmyRpS23maMUT0AQg,59574
197
197
  prefect/runner/server.py,sha256=5vMIJcgunjiDVzJEig09yOP8EbhcW6s-9zNUt101b44,11994
198
198
  prefect/runner/storage.py,sha256=n-65YoEf7KNVInnmMPeP5TVFJOa2zOS8w9en9MHi6uo,31328
199
199
  prefect/runner/submit.py,sha256=b5n1M12DFQsxo6FazZnDbblRcIE7H3xrpecDMb4CjJY,9512
@@ -329,7 +329,7 @@ prefect/workers/cloud.py,sha256=dPvG1jDGD5HSH7aM2utwtk6RaJ9qg13XjkA0lAIgQmY,287
329
329
  prefect/workers/process.py,sha256=Yi5D0U5AQ51wHT86GdwtImXSefe0gJf3LGq4r4z9zwM,11090
330
330
  prefect/workers/server.py,sha256=2pmVeJZiVbEK02SO6BEZaBIvHMsn6G8LzjW8BXyiTtk,1952
331
331
  prefect/workers/utilities.py,sha256=VfPfAlGtTuDj0-Kb8WlMgAuOfgXCdrGAnKMapPSBrwc,2483
332
- prefect_client-3.4.7.dev4.dist-info/METADATA,sha256=OkzXvCsiyz1Qs2jMNsixg3GzEMIuQLwmn0ZYSQaPraY,7517
333
- prefect_client-3.4.7.dev4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
334
- prefect_client-3.4.7.dev4.dist-info/licenses/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
335
- prefect_client-3.4.7.dev4.dist-info/RECORD,,
332
+ prefect_client-3.4.7.dev5.dist-info/METADATA,sha256=2MOLNYyWyvWP14kqrkU6eHZOXb2soCwenx0Oy3ie_zI,7517
333
+ prefect_client-3.4.7.dev5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
334
+ prefect_client-3.4.7.dev5.dist-info/licenses/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
335
+ prefect_client-3.4.7.dev5.dist-info/RECORD,,