Skip to content

Commit

Permalink
Removal 3 warnings (#14675)
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Raphaelson authored Jul 19, 2024
1 parent faa5350 commit 8429480
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 2 deletions.
2 changes: 1 addition & 1 deletion requirements-client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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."""

Expand Down
5 changes: 5 additions & 0 deletions src/prefect/client/schemas/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."
Expand Down
4 changes: 4 additions & 0 deletions src/prefect/deployments/deployments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
29 changes: 28 additions & 1 deletion src/prefect/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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],
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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):
"""
Expand Down
9 changes: 9 additions & 0 deletions src/prefect/workers/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8429480

Please sign in to comment.