Hi Everyone, I have added my flows in the Prefect...
# ask-community
a
Hi Everyone, I have added my flows in the Prefect, and I have facing an strange issue with the flow names. "The thing is flows run Okay when I trigger them manually but when they are triggered via schedular, they throw an error". Error:
Copy code
Failed due to a TypeError: daily_user_ftue() missing 1 required positional argument: 'name' in the Prefect flow run.
Code snippet:
Copy code
@flow(flow_run_name=generate_flow_run_name, retries=3, validate_parameters=False, retry_delay_seconds=60, log_prints=True)
def xyz(name: str):
    xyz_task()


if __name__ == "__main__":
    xyz(name="myflow")
Any help would be much appreciated!!!
s
how did you deploy the flow? in any give method of deploying a flow, if you need to run cron job, all flow parameter needs a default value. either
Copy code
def xyz(name: str = "some defaalt"):
or when you deploy in python
Copy code
xyz.deploy(name="deployment name", parameters={"name": "some default"})
or in prefect.yaml file you also need to specify parameters This makes sense right? How could the flow know the default parameter when it is scheduled to run?
a
When calling xyz("value") , I do pass some value.
I am using prefect.yml file to add all the deployments. How can I specify parameter in yml file?
s
in a cron job, you can't specify any parameter, as it is triggered automatically. That is why you need to specificy parameter's default value. In deploymnet.yaml, With the example here, I believe you could specify default parameter with
Copy code
deployments:
  - # base metadata
    name: your=deployment-name
    parameters:
       xyz: "default value"
🙌 1