Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relocate EntrypointType #14149

Merged
merged 2 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/prefect/cli/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
from prefect.cli.root import app
from prefect.client.schemas.schedules import CronSchedule
from prefect.context import tags
from prefect.deployments.runner import EntrypointType
from prefect.exceptions import FailedRun
from prefect.logging.loggers import get_run_logger
from prefect.runner import Runner
from prefect.settings import PREFECT_UI_URL
from prefect.types.entrypoint import EntrypointType

shell_app = PrefectTyper(
name="shell", help="Serve and watch shell commands as Prefect flows."
Expand Down
14 changes: 1 addition & 13 deletions src/prefect/deployments/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def fast_flow():

"""

import enum
import importlib
import tempfile
from datetime import datetime, timedelta
Expand Down Expand Up @@ -75,6 +74,7 @@ def fast_flow():
PREFECT_DEFAULT_WORK_POOL_NAME,
PREFECT_UI_URL,
)
from prefect.types.entrypoint import EntrypointType
from prefect.utilities.asyncutils import sync_compatible
from prefect.utilities.callables import ParameterSchema, parameter_schema
from prefect.utilities.collections import get_from_dict, isiterable
Expand All @@ -100,18 +100,6 @@ class DeploymentApplyError(RuntimeError):
"""


class EntrypointType(enum.Enum):
"""
Enum representing a entrypoint type.

File path entrypoints are in the format: `path/to/file.py:function_name`.
Module path entrypoints are in the format: `path.to.module.function_name`.
"""

FILE_PATH = "file_path"
MODULE_PATH = "module_path"


class RunnerDeployment(BaseModel):
"""
A Prefect RunnerDeployment definition, used for specifying and building deployments.
Expand Down
3 changes: 2 additions & 1 deletion src/prefect/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
from prefect.client.schemas.schedules import SCHEDULE_TYPES
from prefect.client.utilities import client_injector
from prefect.context import PrefectObjectRegistry, registry_from_script
from prefect.deployments.runner import DeploymentImage, EntrypointType, deploy
from prefect.deployments.runner import DeploymentImage, deploy
from prefect.deployments.steps.core import run_steps
from prefect.events import DeploymentTriggerTypes, TriggerTypes
from prefect.exceptions import (
Expand Down Expand Up @@ -87,6 +87,7 @@
from prefect.states import State
from prefect.task_runners import TaskRunner, ThreadPoolTaskRunner
from prefect.types import BANNED_CHARACTERS, WITHOUT_BANNED_CHARACTERS
from prefect.types.entrypoint import EntrypointType
from prefect.utilities.annotations import NotSet
from prefect.utilities.asyncutils import (
run_sync_in_worker_thread,
Expand Down
13 changes: 13 additions & 0 deletions src/prefect/types/entrypoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from enum import Enum


class EntrypointType(Enum):
"""
Enum representing a entrypoint type.

File path entrypoints are in the format: `path/to/file.py:function_name`.
Module path entrypoints are in the format: `path.to.module.function_name`.
"""

FILE_PATH = "file_path"
MODULE_PATH = "module_path"
3 changes: 2 additions & 1 deletion tests/test_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
RRuleSchedule,
)
from prefect.context import PrefectObjectRegistry
from prefect.deployments.runner import DeploymentImage, EntrypointType, RunnerDeployment
from prefect.deployments.runner import DeploymentImage, RunnerDeployment
from prefect.events import DeploymentEventTrigger, Posture
from prefect.exceptions import (
CancelledRun,
Expand Down Expand Up @@ -71,6 +71,7 @@
get_most_recent_flow_run,
)
from prefect.transactions import transaction
from prefect.types.entrypoint import EntrypointType
from prefect.utilities.annotations import allow_failure, quote
from prefect.utilities.callables import parameter_schema
from prefect.utilities.collections import flatdict_to_dict
Expand Down