From 842948095c264aa4d5573ea7e1fd8bc5113d398b Mon Sep 17 00:00:00 2001 From: Will Raphaelson Date: Fri, 19 Jul 2024 14:07:27 -0500 Subject: [PATCH] Removal 3 warnings (#14675) --- requirements-client.txt | 2 +- .../prefect_kubernetes/jobs.py | 4 +++ src/prefect/client/schemas/objects.py | 5 ++++ src/prefect/deployments/deployments.py | 4 +++ src/prefect/engine.py | 29 ++++++++++++++++++- src/prefect/workers/block.py | 9 ++++++ 6 files changed, 51 insertions(+), 2 deletions(-) diff --git a/requirements-client.txt b/requirements-client.txt index 3733b89dccc4..2af268a02681 100644 --- a/requirements-client.txt +++ b/requirements-client.txt @@ -6,7 +6,7 @@ coolname >= 1.0.4, < 3.0.0 croniter >= 1.0.12, < 3.0.0 fsspec >= 2022.5.0 graphviz >= 0.20.1 -griffe >= 0.20.0 +griffe >= 0.20.0, <0.48.0 httpcore >=1.0.5, < 2.0.0 httpx[http2] >= 0.23, != 0.23.2 importlib_metadata >= 4.4; python_version < '3.10' diff --git a/src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py b/src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py index a41b5ad72639..3f4d835c7cc6 100644 --- a/src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py +++ b/src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py @@ -9,6 +9,7 @@ from pydantic import VERSION as PYDANTIC_VERSION from prefect import task +from prefect._internal.compatibility.deprecated import deprecated_class from prefect.blocks.abstract import JobBlock, JobRun from prefect.utilities.asyncutils import run_sync_in_worker_thread, sync_compatible @@ -357,6 +358,9 @@ def kubernetes_orchestrator(): ) +@deprecated_class( + start_date="Jun 2024", help="Will be removed in Prefect 3. Use Workers instead." +) class KubernetesJobRun(JobRun[Dict[str, Any]]): """A container representing a run of a Kubernetes job.""" diff --git a/src/prefect/client/schemas/objects.py b/src/prefect/client/schemas/objects.py index 5280125e4e6a..9084ff2ce565 100644 --- a/src/prefect/client/schemas/objects.py +++ b/src/prefect/client/schemas/objects.py @@ -17,6 +17,7 @@ from prefect._internal.compatibility.deprecated import ( DeprecatedInfraOverridesField, + deprecated_class, ) from prefect._internal.pydantic import HAS_PYDANTIC_V2 from prefect.types import NonNegativeInteger, PositiveInteger @@ -917,6 +918,10 @@ def validate_name_characters(cls, v): return raise_on_name_with_banned_characters(v) +@deprecated_class( + start_date="Jun 2024", + help="Will be removed in Prefect 3 in favor of prefect.client.schemas.actions.DeploymentScheduleCreate", +) class MinimalDeploymentSchedule(PrefectBaseModel): schedule: SCHEDULE_TYPES = Field( default=..., description="The schedule for the deployment." diff --git a/src/prefect/deployments/deployments.py b/src/prefect/deployments/deployments.py index ce0685b026c4..b9f36b19427a 100644 --- a/src/prefect/deployments/deployments.py +++ b/src/prefect/deployments/deployments.py @@ -238,6 +238,10 @@ async def run_deployment( return flow_run +@deprecated_callable( + start_date="Jun 2024", + help="Will be moved in Prefect 3 to prefect.flows:load_flow_from_flow_run", +) @inject_client async def load_flow_from_flow_run( flow_run: FlowRun, diff --git a/src/prefect/engine.py b/src/prefect/engine.py index f5647fb28f24..88d6b51af92a 100644 --- a/src/prefect/engine.py +++ b/src/prefect/engine.py @@ -113,7 +113,10 @@ import prefect import prefect.context import prefect.plugins -from prefect._internal.compatibility.deprecated import deprecated_parameter +from prefect._internal.compatibility.deprecated import ( + deprecated_callable, + deprecated_parameter, +) from prefect._internal.compatibility.experimental import experimental_parameter from prefect._internal.concurrency.api import create_call, from_async, from_sync from prefect._internal.concurrency.calls import get_current_call @@ -975,6 +978,10 @@ async def orchestrate_flow_run( return state +@deprecated_callable( + start_date="Jun 2024", + help="Will be moved in Prefect 3 to prefect.flow_runs:pause_flow_run", +) @overload async def pause_flow_run( wait_for_input: None = None, @@ -987,6 +994,10 @@ async def pause_flow_run( ... +@deprecated_callable( + start_date="Jun 2024", + help="Will be moved in Prefect 3 to prefect.flow_runs:pause_flow_run", +) @overload async def pause_flow_run( wait_for_input: Type[T], @@ -1095,6 +1106,10 @@ def my_flow(): ) +@deprecated_callable( + start_date="Jun 2024", + help="Will be moved in Prefect 3 to prefect.flow_runs:_in_process_pause", +) @inject_client async def _in_process_pause( timeout: int = 3600, @@ -1190,6 +1205,10 @@ async def _in_process_pause( raise FlowPauseTimeout("Flow run was paused and never resumed.") +@deprecated_callable( + start_date="Jun 2024", + help="Will be moved in Prefect 3 to prefect.flow_runs.pause_flow_run.", +) @inject_client async def _out_of_process_pause( flow_run_id: UUID, @@ -1212,6 +1231,10 @@ async def _out_of_process_pause( raise RuntimeError(response.details.reason) +@deprecated_callable( + start_date="Jun 2024", + help="Will be moved in Prefect 3 to prefect.flow_runs:suspend_flow_run", +) @overload async def suspend_flow_run( wait_for_input: None = None, @@ -1343,6 +1366,10 @@ async def suspend_flow_run( raise Pause() +@deprecated_callable( + start_date="Jun 2024", + help="Will be moved in Prefect 3 to prefect.flow_runs:resume_flow_run", +) @sync_compatible async def resume_flow_run(flow_run_id, run_input: Optional[Dict] = None): """ diff --git a/src/prefect/workers/block.py b/src/prefect/workers/block.py index 892c913976e4..c400c4c7f330 100644 --- a/src/prefect/workers/block.py +++ b/src/prefect/workers/block.py @@ -4,6 +4,7 @@ import anyio import anyio.abc +from prefect._internal.compatibility.deprecated import deprecated_class from prefect._internal.pydantic import HAS_PYDANTIC_V2 from prefect._internal.schemas.validators import validate_block_is_infrastructure from prefect.blocks.core import Block @@ -27,6 +28,10 @@ from prefect.client.schemas.responses import DeploymentResponse +@deprecated_class( + start_date="Jun 2024", + help="Refer to the upgrade guide for more information: https://docs.prefect.io/latest/guides/upgrade-guide-agents-to-workers/", +) class BlockWorkerJobConfiguration(BaseModel): block: Block = Field( default=..., description="The infrastructure block to use for job creation." @@ -144,6 +149,10 @@ class BlockWorkerResult(BaseWorkerResult): """Result of a block worker job""" +@deprecated_class( + start_date="Jun 2024", + help="Refer to the upgrade guide for more information: https://docs.prefect.io/latest/guides/upgrade-guide-agents-to-workers/", +) class BlockWorker(BaseWorker): type = "block" job_configuration = BlockWorkerJobConfiguration