It looks like both methods offer distinct functionalities regarding managing flow code in remote storage:
*
Deployment.build_from_flow:
- This method does handle the pushing of flow code to remote storage, ensuring that the code is uploaded to a specified location (like an S3 bucket) during deployment.
- There's evidence from GitHub issues that when using
Deployment.build_from_flow
, the current working directory is uploaded to the remote storage, which includes all relevant files unless specified otherwise.
*
Flow.from_source().deploy():
- This method appears to pull flow code from remote storage but does not inherently push or upload the flow code to remote storage during deployment.
- It seems optimized for running flows that have been defined and are stored in a remote repository, where it pulls the necessary code to run the flow.
For more information, check out:
- Official documentation on Prefect Deployments:
Prefect Deploy Documentation
- GitHub issue detailing remote storage behavior for `Deployment.build_from_flow`:
GitHub Issue #13140
- GitHub discussions on `Flow.from_source().deploy()`:
GitHub Issue #11546
If you need to ensure both uploading and pulling of flow code in a seamless manner,
Deployment.build_from_flow seems to be the more robust choice.