https://prefect.io logo
j

jeff n

01/29/2021, 4:33 PM
I am trying to thinking through a rapid pipeline without the overhead of Kubernetes or Docker images. When I register a flow how does prefect know what code to register. Could I do something like:
Copy code
with Flow("Example") as flow:
    ....

def __main__():
   if os.getenv("production") == True:
       flow.schedule(my_scheduler)
    flow.register()
If I register a flow with that in the main would I be able to control if it has a schedule?
n

nicholas

01/29/2021, 5:10 PM
Hi @jeff n - you've got a number of options to accomplish this. I'd recommend looking at either GitHub or Local storage options, which allow you to deploy your code either to GitHub or to the machine on which your agent is running. Prefect takes the storage refs and your agent figures out what to do with them. In the case of GitHub, you'll provide an access token to access the repo and a reference to the index file; in the case of local storage (which is the default if no storage is configured), Prefect knows the relative location of your flow and your Agent running on that machine can run it on that same machine.
j

jeff n

01/29/2021, 5:34 PM
Much appreciated
😄 1