-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.py
More file actions
136 lines (115 loc) · 3.06 KB
/
Copy pathconfig.py
File metadata and controls
136 lines (115 loc) · 3.06 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
"""
Configuration constants for DevBox Launcher.
This module centralizes all configuration constants, resource allocations,
and global settings used across DevBox
Author: GoodieHART
"""
# Container will shut down if no one is connected via SSH for this many seconds.
# All Time Values are in seconds
IDLE_TIMEOUT_SECONDS = 300 # 5 minutes
# Version constants
LLAMACPP_VERSION = "b9058" # this will be made dynamic in future
STARSHIP_VERSION = "v1.22.1"
# Resource configurations for different DevBox types
# CPU-only DevBox resource arguments
CPU_DEVBOX_ARGS = {
"secrets": None,
"volumes": None,
"cpu": 0.5,
"memory": 1024,
"timeout": 3600,
}
# Standard GPU DevBox resource arguments
GPU_DEVBOX_ARGS = {
"secrets": None,
"volumes": None,
"cpu": 1.0,
"memory": 2048,
"timeout": 18000,
}
# RDP-specific resource arguments (higher resources for desktop environment)
CPU_DEVBOX_ARGS_RDP = {
"secrets": None,
"volumes": None,
"cpu": 1.0,
"memory": 2048,
"timeout": 10800,
}
# RDP GPU resource arguments (highest resources)
GPU_DEVBOX_ARGS_RDP = {
"secrets": None,
"volumes": None,
"cpu": 1.5,
"memory": 4096,
"timeout": 18000,
}
# llama.cpp Research Center resource arguments
LLAMACPP_DEVBOX_ARGS = {
"secrets": None,
"volumes": None,
"cpu": 2.0,
"memory": 8192, # 8GB for 7B models
"timeout": 14400, # 4 hours max runtime
}
# GPU llama.cpp Research Center resource arguments
LLAMACPP_GPU_DEVBOX_ARGS = {
"secrets": None,
"volumes": None,
"cpu": 2.0,
"memory": 16384, # 16GB for Gemma4-26B-A4B
"timeout": 14400, # 4 hours max runtime
"gpu": "t4",
}
# llama.cpp idle timeout (separate from container timeout)
LLAMACPP_IDLE_TIMEOUT = 3600 # 1 hour idle
# Package groups for reusable configurations
CORE_DEV_PACKAGES = [
"openssh-server",
"git",
"nano",
"neovim",
"curl",
"wget",
"unzip",
"procps",
]
EXTENDED_DEV_PACKAGES = [
"clang",
"cmake",
"htop",
"zlib1g-dev",
"build-essential",
"pkg-config",
"python3-dev",
]
# Download tool packages for all DevBox images
DOWNLOAD_APT_PACKAGES = [
"megatools",
"p7zip-full",
]
DOWNLOAD_PIP_PACKAGES = [
"gdown",
"tgdl",
"terabox-downloader",
]
# Function to fill in runtime modal objects
def get_resource_config(config_type="cpu", is_rdp=False, secrets=None, volume=None):
"""
Get complete resource configuration for DevBox type.
Args:
config_type: "cpu" or "gpu"
gpu_type: GPU type if config_type="gpu" (t4, l4, a10g, l40s)
is_rdp: Whether this is for RDP environment
Returns:
dict: Complete configuration with Modal objects
"""
if config_type == "cpu":
base_config = CPU_DEVBOX_ARGS_RDP if is_rdp else CPU_DEVBOX_ARGS
elif config_type == "gpu":
base_config = GPU_DEVBOX_ARGS_RDP if is_rdp else GPU_DEVBOX_ARGS
else:
raise ValueError(f"Unknown config_type: {config_type}")
config = base_config.copy()
config["secrets"] = secrets
config["volumes"] = {"/data": volume}
return config