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

Fix loading of existing deployment descriptions from the server #8675

Merged
merged 1 commit into from
Feb 28, 2023
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
8 changes: 5 additions & 3 deletions src/prefect/cli/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,8 @@ async def build(
"--description",
"-d",
help=(
"The description to give the deployment. "
"If not provided, the description will be populated from the flow's description."
"The description to give the deployment. If not provided, the description"
" will be populated from the flow's description."
),
),
version: str = typer.Option(
Expand Down Expand Up @@ -1077,6 +1077,9 @@ async def build(
if parameters:
init_kwargs["parameters"] = parameters

if description:
init_kwargs["description"] = description

# if a schedule, tags, work_queue_name, or infrastructure are not provided via CLI,
# we let `build_from_flow` load them from the server
if schedule:
Expand All @@ -1094,7 +1097,6 @@ async def build(
deployment = await Deployment.build_from_flow(
flow=flow,
name=name,
description=description,
output=deployment_loc,
skip_upload=skip_upload,
apply=False,
Expand Down
4 changes: 1 addition & 3 deletions src/prefect/deployments.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,6 @@ async def build_from_flow(
cls,
flow: Flow,
name: str,
description: str = None,
output: str = None,
skip_upload: bool = False,
ignore_file: str = ".prefectignore",
Expand All @@ -701,7 +700,6 @@ async def build_from_flow(
Args:
flow: A flow function to deploy
name: A name for the deployment
description (optional): A description for the deployment; defaults to the flow's description
output (optional): if provided, the full deployment specification will be written as a YAML
file in the location specified by `output`
skip_upload: if True, deployment files are not automatically uploaded to remote storage
Expand All @@ -718,7 +716,7 @@ async def build_from_flow(

# note that `deployment.load` only updates settings that were *not*
# provided at initialization
deployment = cls(name=name, description=description, **kwargs)
deployment = cls(name=name, **kwargs)
deployment.flow_name = flow.name
if not deployment.entrypoint:
## first see if an entrypoint can be determined
Expand Down