App
app
¶
Shared Modal app and container image used by all Modal jobs
Modal Container File Transfers
-
When using the server's
modaltranscribe backend, the server needs to perform network file transfers between the local file system and theModalcontainers which run the GPU processing work -
These file transfers include either sending an input media file located under
HOST_MEDIA_PATHin the local file system for the container to process, or receiving a processed file from the container and saving it underHOST_MEDIA_PATH -
Since these files are often large, multi-GB media files, the server creates a transient ephemeral
Modal Volumefor every job, which exists only for the duration of the job and can be accessed either inside the container or locally via a unique identifier -
For this reason, Jobs receive both the volume's ID and the path in which the local runtime saved the input file inside the volume so that the container can find that file during the job
Modal Volume Lifecycle
-
Before the job starts, the local runtime creates the volume and uploads the input media file to it
-
The container then locates the volume via its ID, saves the file to its local storage, does any necessary GPU processing, and writes the resulting processed file (if any) back to that same volume
-
If there are any resulting processed files, the local runtime then accesses the volume again, saves them to the local file system and serves it to the user
-
Finally, the job is completed and the ephemeral volume is deleted
ModalRuntime
dataclass
¶
Bundle of the ephemeral Modal app and its registered job handles
Attributes:
| Name | Type | Description |
|---|---|---|
app |
App
|
The fully-configured ephemeral |
transcribe |
Function
|
Handle for the transcription job |
convert |
Function
|
Handle for the video-conversion job |
setup_modal()
¶
Configures the Mirumoji Modal App
Setup Steps
-
Defines the pre-built
Docker Imagethat theModalcontainer will run for every registered function (MIRUMOJI_MODAL_IMAGEpassed to modal'sfrom_registry) -
Creates the ephemeral
mirumoji-gpuModal Appand registers all jobs
Returns:
| Type | Description |
|---|---|
ModalRuntime
|
A |