Prefect 2.16.5 prefect.yaml parameters problem

Hello everybody,

I’m using Prefect 2.16.5, and I would like to deploy the deployments defined in the prefect.yaml, specifying flow parameters directly in it.

The flow code is a function like:

def run_test(parameter1: str, parameter2: str, parameter3: int):

The prefect.yaml is structured as follows:

- name: test_dep
  tags: []
  description: ""
  entrypoint: src/
  parameters: {}
    name: test_schedule
    job_variables: {}
  schedules: []
  - prefect.deployments.steps.set_working_directory:
      directory: /test
          *should i define here parameters???*

The goal is to create different deployments with different schedules and parameters by updating the yaml, bypassing the GUI. Is that possible?

I tried to run prefect deploy -n test_dep, but the yaml gets overwritten, deleting the parameters (I could not find how to correctly define them).

Thank you very much for the help.

p.s.: I tried using API and i could made it by creating deployment_n.json, but i need to create a flow to have an ID associated, otherwise it returns foreign key error.

This has a direct solution, as one of the prefect cli flags prevents overwrite of the file. I use this pattern in my own projects, with a --prefect-file flag and the global flag ‘prefect --no-prompt’

Thank you merlin for the response, but the problem is it overwrites because it doesn’t recognize the parameters. Even with no prompt, the parameters are not set correctly in the deployment.

Thanks again

Ah, this is something new for me to worry about since I’m storing my deployment CI/CD configuration in those prefect.yaml files.

I do:

prefect --no-prompt deploy --all --prefect-file "${project_N/prefect.yaml}"

And it hasn’t overwritten. You are saying that if deployment parameters aren’t recognized this action will overwrite the files.

Cool! I’m pulling from local for now:

  - prefect.deployments.steps.set_working_directory:
      directory: /test

The command you use, deploy all the deployments written in the specified path of the prefect.yaml . The problem in my case is that when I do it, it does not set the flow parameters. Any change to them doesn’t affect the deploy.

I tried also serving directly from flow doing run_test.serve(parameters= my_dict_parameters), but there must be another simpler solution, since in this case i have to load a different dict/json/yaml every serve…