Chris
03/26/2024, 6:04 PMChris
03/26/2024, 6:11 PMSerina
03/26/2024, 6:32 PMdeployments:
- name: my-deployment
version: null
tags: []
description: null
entrypoint: my_flow.py:multiply
parameters: {}
work_pool:
name: my-modal-work-pool
work_queue_name: null
job_variables: {}
schedules: []
I just used prefect deploy
after creating a Modal push work pool to create a deployment to this work pool and saved the configuration to my prefect.yaml
Chris
03/26/2024, 6:42 PMimport modal
from prefect import flow
APP_NAME = f"{ENVIRONMENT}-prefect-modal-test"
stub = modal.Stub(APP_NAME)
stub.image = get_image() # custom image
@stub.function(timeout=3600, cloud="aws")
async def test_app():
return "Success"
@flow
async def run_app():
await test_app()
and a deployment script like this
modal deploy modal_apps/test_modal_app.py
prefect deploy modal_apps/test_modal_app.py -n $ENVIRONMENT-modal-test-app -p $modal_pool_name
Jake Kaplan
03/26/2024, 6:54 PMdeployments:
...
work_pool:
job_variables:
image:
tag: ... <- AWS ECR TAG
secret: ... <- modal secret for your AWS creds
Jake Kaplan
03/26/2024, 6:55 PMChris
03/26/2024, 6:56 PMJake Kaplan
03/26/2024, 6:57 PMChris
03/26/2024, 6:57 PMJake Kaplan
03/26/2024, 7:01 PMAlexander Azzam
03/26/2024, 7:21 PMThat would have a fresh container each time which is somewhat extra overheadIIRC @Jake Kaplan the way the modal sandbox API works there's some intelligent caching in their build steps so not a tremendous amount of overhead
Jake Kaplan
03/26/2024, 7:22 PMChris
03/26/2024, 8:23 PMJake Kaplan
03/26/2024, 8:58 PMChris
03/26/2024, 8:59 PM