Hey is there any documentation on the prefect cli?...
# ask-community
j
Hey is there any documentation on the prefect cli? Specifically I was wondering how prefect tries to discover flows 🙂 Should I have an export call flow or something?
Copy code
> prefect run -m src.flows.internal_syncs.firestore_export.flow
Retrieving local flow... Error
Found no flows at src.flows.internal_syncs.firestore_export.flow.
1
My assumption seems correct 😛
a
the CLI docs are mostly in API reference https://docs.prefect.io/orchestration/concepts/cli.html
j
Yea found those, but wasn’t clear to me how the cli tries to discover flows. But after testing it seems it just works if there is flow exported 🙂
Thanks
a
normally, you register your flows explicitly so there is no discovery per se, Prefect then takes the flow from your storage configuration.
and for a local run, you could also run it by pointing to the flow file, rather than a module (it seems simpler):
Copy code
prefect run -p your_flow.py
j
Yea, I’ve created my own flow discovery to be used in my CI/CD. Developed it before prefect cli was made.
But the prefect run command seems nice as it allowed me to pass parameters directly 🙂
Hence I was wondering how prefect discovers the flows from the cli
a
there is some batch logic for the “prefect register”, but for “prefect run” it just takes your path or module to run it locally. If you use:
Copy code
prefect run --name your_flow_name
then it queries Prefect API for a flow registered with that name. If there is more than one, it will require you to also pass a project name to uniquely identify the flow to run:
Copy code
prefect run --name yourname --project yourproject
j
Yes exactly, sounds cool if my custom setup is compatible then 😬
👍 1