최영범
07/22/2025, 8:41 AMMarvin
07/22/2025, 8:41 AMMarvin
07/22/2025, 8:42 AMbash
# Create a Cloud Run work pool
prefect work-pool create "cloud-run-pool" \
--type cloud-run
4. Deploy the Worker:
bash
# Create a Dockerfile for the worker
FROM prefecthq/prefect:3-latest
ENV PREFECT_API_URL="YOUR-SERVER-URL"
CMD ["prefect", "worker", "start", "--pool", "cloud-run-pool"]
5. Deploy flows:
python
from prefect import flow
@flow
def my_flow():
# Your flow code here
pass
if __name__ == "__main__":
my_flow.from_source(
source="<https://github.com/your-repo/your-flows>",
entrypoint="flows/my_flow.py:my_flow"
).deploy(
name="my-deployment",
work_pool_name="cloud-run-pool"
)
Important Considerations:
1. Scaling: Cloud Run automatically scales based on demand
2. Costs: You only pay for actual execution time
3. Security: Use IAM roles and Secret Manager for sensitive data
4. Monitoring: Set up Cloud Monitoring for both server and workers
5. Networking: Configure VPC connector if needed for private network access
Would you like me to elaborate on any of these components or provide more specific details about any part of the setup?