This repository was archived by the owner on Sep 4, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,9 @@ ENV PATH=$VIRTUAL_ENV/bin/:$PATH
180
180
RUN microdnf install -y gcc \
181
181
&& microdnf clean all
182
182
183
+ # Custom cache manager (fix for https://issues.redhat.com/browse/RHOAIENG-8043)
184
+ COPY extras/custom_cache_manager.py /opt/vllm/lib/python3.11/site-packages/custom_cache_manager.py
185
+
183
186
# install vllm wheel first, so that torch etc will be installed
184
187
RUN --mount=type=bind,from=build,src=/workspace/dist,target=/workspace/dist \
185
188
--mount=type=cache,target=/root/.cache/pip \
@@ -189,7 +192,8 @@ ENV HF_HUB_OFFLINE=1 \
189
192
PORT=8000 \
190
193
HOME=/home/vllm \
191
194
VLLM_USAGE_SOURCE=production-docker-image \
192
- VLLM_WORKER_MULTIPROC_METHOD=fork
195
+ VLLM_WORKER_MULTIPROC_METHOD=fork \
196
+ TRITON_CACHE_MANAGER="custom_cache_manager:CustomCacheManager"
193
197
194
198
# setup non-root user for OpenShift
195
199
RUN umask 002 \
Original file line number Diff line number Diff line change
1
+ import os
2
+
3
+ from triton .runtime .cache import (FileCacheManager , default_cache_dir ,
4
+ default_dump_dir , default_override_dir )
5
+
6
+
7
+ class CustomCacheManager (FileCacheManager ):
8
+
9
+ def __init__ (self , key , override = False , dump = False ):
10
+ self .key = key
11
+ self .lock_path = None
12
+ if dump :
13
+ self .cache_dir = default_dump_dir ()
14
+ self .cache_dir = os .path .join (self .cache_dir , self .key )
15
+ self .lock_path = os .path .join (self .cache_dir , "lock" )
16
+ os .makedirs (self .cache_dir , exist_ok = True )
17
+ elif override :
18
+ self .cache_dir = default_override_dir ()
19
+ self .cache_dir = os .path .join (self .cache_dir , self .key )
20
+ else :
21
+ # create cache directory if it doesn't exist
22
+ self .cache_dir = os .getenv ("TRITON_CACHE_DIR" ,
23
+ "" ).strip () or default_cache_dir ()
24
+ if self .cache_dir :
25
+ self .cache_dir = f"{ self .cache_dir } _{ os .getpid ()} "
26
+ self .cache_dir = os .path .join (self .cache_dir , self .key )
27
+ self .lock_path = os .path .join (self .cache_dir , "lock" )
28
+ os .makedirs (self .cache_dir , exist_ok = True )
29
+ else :
30
+ raise RuntimeError ("Could not create or locate cache dir" )
31
+
32
+ print (f"Triton cache dir: { self .cache_dir = } " )
You can’t perform that action at this time.
0 commit comments