Skip to content

Commit

Permalink
relocate EntrypointType (#14149)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaazzam authored Jun 19, 2024
1 parent f7c3e6d commit 539e380
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
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

0 comments on commit 539e380

Please sign in to comment.