What's the recommended way to autodetect flows? Le...
# prefect-community
k
What's the recommended way to autodetect flows? Let's say I have a bunch of flows in a
flows
module, would it still be to build a deployment for each of them?
1
z
Perhaps just
isinstance(obj, Flow)
and iterate over all the items in the module?
k
Oh I also found this discussion: https://github.com/PrefectHQ/prefect/discussions/4042?sort=top but it seems like some things are already outdated like
prefect register
command
z
Yeah that’s for v1
k
Ah ok
z
There’s also this slightly terrifying utility
Copy code
import prefect
import prefect.context


@prefect.flow
def test():
    pass


print(prefect.context.GLOBAL_OBJECT_REGISTRY.get_instances(prefect.Flow))
👀 1
We capture all
Flow
objects that are defined
k
If I create flow deployments instead using Python, would this be "registered" by running
python my_deployment.py
?
z
Yes that’s the idea there
k
Ah awesome, thanks, I'll try this out
Cool, seems to work. I think I'll use that for our CI/CD going forward