File size: 2,001 Bytes
6764104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# All possible @app.function() parameters
@app.function(
    # Resource Configuration
    cpu=float,                              # CPU cores (e.g., 4.0)
    cpu=(float, float),                     # (request, limit) tuple
    memory=int,                             # Memory in MB
    memory=(int, int),                      # (request, limit) tuple
    gpu="T4" | "L4" | "A10G" | "A100-40GB" | "A100-80GB" | "L40S" | "H100" | "H200" | "B200",
    gpu="GPU_TYPE:count",                   # Multiple GPUs
    gpu=["GPU_TYPE", "GPU_TYPE:count"],     # GPU fallback list
    ephemeral_disk=int,                     # Ephemeral disk in MB
    
    # Container Configuration
    image=modal.Image,                      # Container image
    secrets=[modal.Secret],                 # List of secrets
    volumes={"/path": modal.Volume},        # Volume mounts
    cloud_bucket_mounts={},                 # Cloud storage mounts
    
    # Networking & Concurrency
    allow_concurrent_inputs=int,            # Concurrent requests per container
    concurrency_limit=int,                  # Max concurrent containers
    container_idle_timeout=int,             # Idle timeout in seconds
    timeout=int,                            # Function timeout in seconds
    
    # Scheduling & Retry
    schedule=modal.Cron | modal.Period,     # Scheduling
    retries=int,                            # Retry attempts
    retry=modal.Retry,                      # Custom retry policy
    
    # Environment & Runtime
    environment=dict,                       # Environment variables
    keep_warm=int,                          # Warm containers count
    architecture="x86_64" | "arm64",        # CPU architecture
    cloud="aws" | "gcp",                    # Cloud provider
    
    # Batch Processing
    batch_max_size=int,                     # Max batch size
    
    # Metadata
    name=str,                               # Function name
    is_generator=bool,                      # Generator function flag
)