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
Add examples to the docs showing how to specify various Deployment attributes in a YAML config #5919
Comments
I'm interested in this as well. This kind of "Infrastructure as config" approach where deployment configuration is expressed as files that can be tracked by version control is something I think would be beneficial in some projects. One problem I have related to this is that not only is "DeploymentSpec" not detailed in the documentation, it's not even in the # yaml-language-server: $schema=http://localhost:4200/openapi.json#components/schemas/DeploymentSpec
name: demo-github-stuff
flow_location: ./demo_github_stuff.py
flow_name: GitHub Stars
tags:
- foo
- bar
flow_runner:
type: subprocess
config:
virtualenv: "/foo/bar/.pyenv"
parameters:
name: "Earth"
schedule:
interval: 3600 ...and have the VSCode YAML extension validate the document for me and guide me through writing it. EDIT: It was a lucky guess on my part that the YAML extension actually parses the schema URL like it would inside a JSON schema, meaning URL fragments work as JSON pointers. That means you could actually get the document to properly validate like that just by having that comment as the first line, if DeploymentSpec was actually exposed in the OpenAPI definition. EDIT2: DeploymentSpec being absent from the OpenAPI document is apparently just a consequence of how FastAPI only includes model schemas that are present in documented routes, which makes sense given its use case. Still, having the schema of configuration files available somewhere, possibly generated by Pydantic directly on a separate route, could prove really handy when editing these and others. EDIT3: Just as I made my previous edit, I notice that Prefect 2.0b8 released this morning, with the documenteation amended to say "Deployments based on DeploymentSpec are deprecated as of the Prefect 2.0b8 release", so I guess |
@sm-Fifteen So how do you know what to pass to flow:
name: "My flow"
path: "bucket/path/flow.py"
...
packager:
type: "file"
filesystem:
_block_document_id: "your_remote_filesystem_block_id" But I don't have the time to debug this or trace the entire logic so I'm waiting until there is any documentation available (hopefully Wednesday :)). |
@trymzet: Turns out the # yaml-language-server: $schema=./prefect_deployment.schema.json
name: demo-github-stuff
flow:
path: ./demo_github_stuff.py
name: GitHub Stars
tags:
- foo
- bar
flow_runner:
type: subprocess
config:
virtualenv: "/foo/bar/.pyenv"
parameters: {}
schedule:
interval: 300
packager:
type: 'orion'
serializer:
type: 'source' It's not quite ideal yet, because with the way As for what to put under |
Deployment docs have been updated showing deployment YAML file fields and how to make Deployments via Python deployment definitions. |
Opened from the Prefect Public Slack Community
mzawadzki: Is there a way to specify
flow_runner
in the deployment? I getValueError: Unregistered flow runner 'DockerFlowRunner'
when runningprefect deployment create my_deployment.yaml
. My deployment looks like this:Unfortunately the
flow_runner
config is not documented anywhere so it's hard for me to say if I'm specifying it incorrectly or it's not supported at all.anna: Can you try the same using Python? much easier than YAML:
anna: afaik, YAML is pretty much only for non-Python DevOps admins
maybe you can try this?
mzawadzki: I'll check and get back to you but I'd prefer to use YAML eventually, I don't feel comfortable storing configs in executable files, I feel like analysts will eventually abuse this somehow 😅 and YAML files are very easy and safe to parse and check for policy in CI/CD.
anna: how would they abuse DeploymentSpec, but wouldn't abuse YAML? :thinking_face: it's the same config that gets sent to the backend
anna: But I totally understand what you mean with respect to ensuring standards, specifying deployments via Python code allows to build some extra abstraction/function allowing you to avoid boilerplate (which YAML forces you to have) - an example:
anna: when using the same default spec, creating deployment is as simple as a single line and passing the flow to it as in here:
anna: <@ULVA73B9P> open "Add examples to the docs showing how to specify various Deployment attributes in a YAML config"
Original thread can be found here.
The text was updated successfully, but these errors were encountered: