Skip to content

Commit 3140610

Browse files
committed
Refactor configmap, switch to watchfiles to detect symbolic link target changes, pull dynamically from configmap
Signed-off-by: Kunjan Patel <[email protected]>
1 parent cb3c9b2 commit 3140610

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

examples/dynamic-lora-sidecar/deployment.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ spec:
7575
volumeMounts:
7676
- name: config-volume
7777
mountPath: /config
78-
# subPath: configmap.yaml
7978
volumes:
8079
- name: dshm
8180
emptyDir:

examples/dynamic-lora-sidecar/sidecar/configmap.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ vLLMLoRAConfig:
77
- base-model: meta-llama/Llama-2-7b-hf
88
id: sql-lora-v1
99
source: yard1/llama-2-7b-sql-lora-test
10+
- base-model: meta-llama/Llama-2-7b-hf
11+
id: sql-lora-v5
12+
source: yard1/llama-2-7b-sql-lora-test
13+
- base-model: meta-llama/Llama-2-7b-hf
14+
id: sql-lora-v6
15+
source: yard1/llama-2-7b-sql-lora-test
1016
ensureNotExist:
1117
models:
1218
- base-model: meta-llama/Llama-2-7b-hf

examples/dynamic-lora-sidecar/sidecar/sidecar.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import datetime
88
import os
99

10-
CONFIG_MAP_FILE = os.environ.get("DYNAMIC_LORA_ROLLOUT_CONFIG", "configmap.yaml")
10+
CONFIG_MAP_FILE = os.environ.get("DYNAMIC_LORA_ROLLOUT_CONFIG", "/config/configmap.yaml")
1111
BASE_FIELD = "vLLMLoRAConfig"
1212
logging.basicConfig(
1313
level=logging.INFO, format="%(asctime)s - %(levelname)s - %(filename)s:%(lineno)d - %(message)s",
@@ -165,11 +165,16 @@ def reconcile(self):
165165
if not self.is_server_healthy:
166166
logging.error(f"vllm server at {self.model_server} not healthy")
167167
return
168+
invalid_adapters = ", ".join(str(a.id) for a in self.ensure_exist_adapters & self.ensure_not_exist_adapters)
169+
logging.warning(f"skipped adapters found in both `ensureExist` and `ensureNotExist` {invalid_adapters}")
168170
adapters_to_load = self.ensure_exist_adapters - self.ensure_not_exist_adapters
169-
logging.info(f"adapter to load {len(adapters_to_load)}, adapters_to_load")
171+
adapters_to_load_id = ", ".join(str(a.id) for a in adapters_to_load)
172+
logging.info(f"adapter to load {adapters_to_load_id}")
170173
for adapter in adapters_to_load:
171174
self.load_adapter(adapter)
172175
adapters_to_unload = self.ensure_not_exist_adapters - self.ensure_exist_adapters
176+
adapters_to_unload_id = ", ".join(str(a.id) for a in adapters_to_unload)
177+
logging.info(f"adapters to unload {adapters_to_unload_id}")
173178
for adapter in adapters_to_unload:
174179
self.unload_adapter(adapter)
175180

@@ -184,7 +189,7 @@ async def main():
184189
reconcilerInstance.reconcile()
185190
# observer = Observer()
186191
logging.info(f"beginning watching of configmap {CONFIG_MAP_FILE}")
187-
async for changes in awatch('/config'):
192+
async for _ in awatch('/config/configmap.yaml'):
188193
logging.info(f"Config '{CONFIG_MAP_FILE}' modified!'" )
189194
reconcilerInstance.reconcile()
190195

0 commit comments

Comments
 (0)