Skip to content

Commit cafca69

Browse files
authored
[scheduler] Fix memory values on env vars (AcademySoftwareFoundation#2163)
Environment variables should display memory values in KBs
1 parent b46e170 commit cafca69

File tree

1 file changed

+7
-4
lines changed
  • rust/crates/scheduler/src/pipeline/dispatcher

1 file changed

+7
-4
lines changed

rust/crates/scheduler/src/pipeline/dispatcher/actor.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -881,11 +881,14 @@ impl RqdDispatcherService {
881881
let mut environment = proc.frame.env.clone();
882882
environment.insert("CUE3".to_string(), "1".to_string());
883883
environment.insert("CUE_THREADS".to_string(), threads.to_string());
884-
environment.insert("CUE_MEMORY".to_string(), proc.memory_reserved.to_string());
884+
environment.insert(
885+
"CUE_MEMORY".to_string(),
886+
(proc.memory_reserved.as_u64() / KIB).to_string(),
887+
);
885888
environment.insert("CUE_GPUS".to_string(), proc.gpus_reserved.to_string());
886889
environment.insert(
887890
"CUE_GPU_MEMORY".to_string(),
888-
proc.gpu_memory_reserved.to_string(),
891+
(proc.gpu_memory_reserved.as_u64() / KIB).to_string(),
889892
);
890893
environment.insert("CUE_LOG_PATH".to_string(), frame.log_dir.clone());
891894
environment.insert("CUE_RANGE".to_string(), frame.range.clone());
@@ -1020,7 +1023,7 @@ mod tests {
10201023

10211024
use super::*;
10221025
use crate::models::{CoreSize, DispatchFrame, Host};
1023-
use bytesize::ByteSize;
1026+
use bytesize::{ByteSize, KB};
10241027
use opencue_proto::host::ThreadMode;
10251028
use uuid::Uuid;
10261029

@@ -1480,7 +1483,7 @@ mod tests {
14801483
assert_eq!(run_frame.environment.get("CUE_THREADS").unwrap(), "2");
14811484
assert_eq!(
14821485
run_frame.environment.get("CUE_MEMORY").unwrap(),
1483-
&virtual_proc.memory_reserved.to_string()
1486+
&(virtual_proc.memory_reserved.as_u64() / KIB).to_string(),
14841487
);
14851488
assert_eq!(run_frame.environment.get("CUE_GPUS").unwrap(), "1");
14861489
assert_eq!(

0 commit comments

Comments
 (0)