Skip to content

Commit 74b5584

Browse files
committed
fix schedule construction
1 parent 03213d2 commit 74b5584

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/prefect/cli/deploy.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
)
4545
from prefect.cli.root import app, is_interactive
4646
from prefect.client.base import ServerType
47+
from prefect.client.orchestration import get_client
4748
from prefect.client.schemas.actions import DeploymentScheduleCreate
4849
from prefect.client.schemas.filters import WorkerFilter
4950
from prefect.client.schemas.objects import ConcurrencyLimitConfig
@@ -52,7 +53,6 @@
5253
IntervalSchedule,
5354
RRuleSchedule,
5455
)
55-
from prefect.client.utilities import inject_client
5656
from prefect.deployments import initialize_project
5757
from prefect.deployments.base import (
5858
_format_deployment_for_saving_to_prefect_file,
@@ -477,14 +477,14 @@ async def deploy(
477477
exit_with_error(str(exc))
478478

479479

480-
@inject_client
481480
async def _run_single_deploy(
482481
deploy_config: dict[str, Any],
483482
actions: dict[str, Any],
484483
options: dict[str, Any] | None = None,
485484
client: Optional["PrefectClient"] = None,
486485
prefect_file: Path = Path("prefect.yaml"),
487486
):
487+
client = client or get_client()
488488
deploy_config = deepcopy(deploy_config) if deploy_config else {}
489489
actions = deepcopy(actions) if actions else {}
490490
options = deepcopy(options) if options else {}
@@ -919,10 +919,8 @@ def _construct_schedules(
919919
Returns:
920920
A list of schedule objects
921921
"""
922-
schedules = []
923-
schedule_configs: list[dict[str, Any]] | NotSet = (
924-
deploy_config.get("schedules", []) or []
925-
)
922+
schedules: list[DeploymentScheduleCreate] = [] # Initialize with empty list
923+
schedule_configs = deploy_config.get("schedules", NotSet) or []
926924

927925
if schedule_configs is not NotSet:
928926
schedules = [
@@ -932,8 +930,6 @@ def _construct_schedules(
932930
elif schedule_configs is NotSet:
933931
if is_interactive():
934932
schedules = prompt_schedules(app.console)
935-
else:
936-
schedules = []
937933

938934
return schedules
939935

0 commit comments

Comments
 (0)