13
13
# permissions and limitations under the License.
14
14
"""Modal orchestrator flavor."""
15
15
16
+ from enum import Enum
16
17
from typing import TYPE_CHECKING , Optional , Type
17
18
18
19
from pydantic import SecretStr
26
27
MODAL_ORCHESTRATOR_FLAVOR = "modal"
27
28
28
29
30
+ class ModalExecutionMode (str , Enum ):
31
+ """Execution modes for the Modal orchestrator.
32
+
33
+ Attributes:
34
+ PIPELINE: Execute entire pipeline in one Modal function (fastest, default).
35
+ PER_STEP: Execute each step in a separate Modal function (granular control).
36
+ """
37
+
38
+ PIPELINE = "pipeline"
39
+ PER_STEP = "per_step"
40
+
41
+
29
42
class ModalOrchestratorSettings (BaseSettings ):
30
43
"""Modal orchestrator settings.
31
44
@@ -38,7 +51,7 @@ class ModalOrchestratorSettings(BaseSettings):
38
51
timeout: Maximum execution time in seconds (default 24h).
39
52
min_containers: Minimum containers to keep warm (replaces keep_warm).
40
53
max_containers: Maximum concurrent containers (replaces concurrency_limit).
41
- execution_mode: Execution mode - "pipeline" (default, fastest) or "per_step" (granular control).
54
+ execution_mode: Execution mode - PIPELINE (default, fastest) or PER_STEP (granular control).
42
55
synchronous: Wait for completion (True) or fire-and-forget (False).
43
56
app_warming_window_hours: Hours for app name window to enable container reuse.
44
57
Apps are reused within this time window for efficiency. Default 2 hours.
@@ -53,7 +66,9 @@ class ModalOrchestratorSettings(BaseSettings):
53
66
1 # Keep 1 container warm for sequential execution
54
67
)
55
68
max_containers : Optional [int ] = 10 # Allow up to 10 concurrent containers
56
- execution_mode : str = "pipeline" # Default to fastest mode
69
+ execution_mode : ModalExecutionMode = (
70
+ ModalExecutionMode .PIPELINE
71
+ ) # Default to fastest mode
57
72
synchronous : bool = (
58
73
True # Wait for completion (True) or fire-and-forget (False)
59
74
)
0 commit comments