Skip to content

Commit

Permalink
fix(ds, mm): hard code disk per core (#1134)
Browse files Browse the repository at this point in the history
<!-- Please make sure there is an issue that this PR is correlated to. -->
Fixes RVTEE-583
## Changes

<!-- If there are frontend changes, please include screenshots. -->
  • Loading branch information
MasterPtato committed Sep 28, 2024
1 parent 437494a commit 5ee2809
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
16 changes: 3 additions & 13 deletions svc/pkg/ds/src/workflows/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ async fn submit_job(ctx: &ActivityCtx, input: &SubmitJobInput) -> GlobalResult<S
// Nomad configures CPU based on MHz, not millicores. We havel to calculate the CPU share
// by knowing how many MHz are on the client.
CPU: if tier.rivet_cores_numerator < tier.rivet_cores_denominator {
Some((tier.cpu - util_job::TASK_CLEANUP_CPU as u64).try_into()?)
Some(tier.cpu.try_into()?)
} else {
None
},
Expand All @@ -482,20 +482,10 @@ async fn submit_job(ctx: &ActivityCtx, input: &SubmitJobInput) -> GlobalResult<S
} else {
None
},
memory_mb: Some(
(TryInto::<i64>::try_into(memory)? / (1024 * 1024)
- util_job::TASK_CLEANUP_MEMORY as i64)
.try_into()?,
),
memory_mb: Some(tier.memory.try_into()?),
// Allow oversubscribing memory by 50% of the reserved
// memory if using less than the node's total memory
memory_max_mb: None,
// Some(
// (TryInto::<i64>::try_into(memory_max)? / (1024 * 1024)
// - util_job::TASK_CLEANUP_MEMORY as i64)
// .try_into()?,
// ),
disk_mb: Some(tier.disk as i32), // TODO: Is this deprecated?
memory_max_mb: Some(tier.memory_max.try_into()?),
..Resources::new()
};

Expand Down
3 changes: 2 additions & 1 deletion svc/pkg/linode/src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const RESERVE_LB_MEMORY: u64 = 512;
const RESERVE_MEMORY: u64 = RESERVE_SYSTEM_MEMORY + RESERVE_LB_MEMORY;

const CPU_PER_CORE: u64 = 1999;
const DISK_PER_CORE: u64 = 8192;

/// Provider agnostic hardware specs.
#[derive(Debug)]
Expand Down Expand Up @@ -53,7 +54,7 @@ impl JobNodeConfig {
}

pub fn disk_per_core(&self) -> u64 {
self.disk / self.cpu_cores
DISK_PER_CORE
}

pub fn bandwidth_per_core(&self) -> u64 {
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/mm/worker/src/workers/lobby_create/nomad_job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ pub fn gen_lobby_docker_job(
// Allow oversubscribing memory by 50% of the reserved
// memory if using less than the node's total memory
memory_max_mb: Some(tier.memory_max.try_into()?),
disk_mb: Some(tier.disk as i32), // TODO: Is this deprecated?
..Resources::new()
};

Expand Down

0 comments on commit 5ee2809

Please sign in to comment.