Krystal
02/07/2024, 11:26 AMflow.from_source but pull from a different branch other than master?Marvin
02/07/2024, 11:26 AMflow.from_source function by providing additional configuration in the source parameter to specify the branch.
Here's a step-by-step guide:
1. Import the flow module from prefect.
2. Use flow.from_source, and specify the git repository URL.
3. For a different branch, append #branch_name to the end of the repository URL.
4. Define the entrypoint, pointing to the file and function name where the flow is defined.
python
from prefect import flow
my_flow = flow.from_source(
source="<https://github.com/org/repo.git#branch_name>",
entrypoint="flows.py:my_flow"
)
if __name__ == "__main__":
my_flow()
Replace branch_name with the name of the branch from which you want to pull the flow.