Skip to content

Commit d6be87c

Browse files
authored
fix: remove unused environment variable (#424)
* fix: remove unused environment variable * fix: handle nil workers in GetAllocationReqByNodeName to prevent panics
1 parent bb8ddd5 commit d6be87c

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

internal/constants/env.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ const (
6868
ConnectionSharedMemSize = "256"
6969
ConnectionSharedMemName = "tf_shm"
7070

71-
RealNvmlLibPathEnv = "TF_NVML_LIB_PATH"
72-
RealCUDALibPathEnv = "TF_CUDA_LIB_PATH"
7371
RealNvmlLibPathValue = "/lib/x86_64-linux-gnu/libnvidia-ml.so.1"
7472
RealCUDALibPathValue = "/lib/x86_64-linux-gnu/libcuda.so"
7573

internal/gpuallocator/gpuallocator.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,11 @@ func (s *GpuAllocator) DeallocByPodIdentifier(ctx context.Context, podIdentifier
642642

643643
func (s *GpuAllocator) GetAllocationReqByNodeName(nodeName string) []*tfv1.AllocRequest {
644644
allocRequests := make([]*tfv1.AllocRequest, 0, 8)
645-
for workerName := range s.nodeWorkerStore[nodeName] {
645+
workers, exists := s.nodeWorkerStore[nodeName]
646+
if !exists || workers == nil {
647+
return allocRequests
648+
}
649+
for workerName := range workers {
646650
podUID := s.podNamespaceNsToPodUID[workerName.String()]
647651
if podUID == "" {
648652
continue

internal/utils/compose.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,12 +377,6 @@ func AddTFDefaultClientConfBeforePatch(
377377
}
378378

379379
envList = append(envList, v1.EnvVar{
380-
Name: constants.RealNvmlLibPathEnv,
381-
Value: constants.RealNvmlLibPathValue,
382-
}, v1.EnvVar{
383-
Name: constants.RealCUDALibPathEnv,
384-
Value: constants.RealCUDALibPathValue,
385-
}, v1.EnvVar{
386380
Name: constants.HypervisorIPEnv,
387381
ValueFrom: &v1.EnvVarSource{
388382
FieldRef: &v1.ObjectFieldSelector{

0 commit comments

Comments
 (0)