Skip to main content
The simplest way to create a deployment for your flow is by calling its serve method. This method creates a deployment for the flow and starts a long-running process that monitors for work from the Prefect server. When work is found, it is executed within its own isolated subprocess.
hello_world.py
This interface provides the configuration for a deployment (with no strong infrastructure requirements), such as:
  • schedules
  • event triggers
  • metadata such as tags and description
  • default parameter values
Schedules are auto-paused on shutdownBy default, stopping the process running flow.serve will pause the schedule for the deployment (if it has one).When running this in environments where restarts are expected use thepause_on_shutdown=False flag to prevent this behavior:

Serve multiple flows at once

Serve multiple flows with the same process using the serve utility along with the to_deployment method of flows:
The behavior and interfaces are identical to the single flow case.

Retrieve a flow from remote storage

You can retrieve flows from remote storage with the flow.from_source method. flow.from_source accepts a git repository URL and an entrypoint pointing to the flow to load from the repository:
load_from_url.py
A flow entrypoint is the path to the file where the flow is located, and the name of the flow function separated by a colon. For additional configuration, such as specifying a private repository, provide a GitRepository instead of URL:
load_from_storage.py
You can serve loaded flowsYou can serve flows loaded from remote storage with the same serve method as local flows:
serve_loaded_flow.py
When you serve a flow loaded from remote storage, the serving process periodically polls your remote storage for updates to the flow’s code. This pattern allows you to update your flow code without restarting the serving process.