diff --git a/Cargo.toml b/Cargo.toml index bd360fcd..e28ccfde 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ members = [ "bastion", "bastion-executor", + "bastion-utils", "lightproc" ] diff --git a/bastion-executor/Cargo.toml b/bastion-executor/Cargo.toml index 2e480440..96436575 100644 --- a/bastion-executor/Cargo.toml +++ b/bastion-executor/Cargo.toml @@ -23,6 +23,7 @@ maintenance = { status = "actively-developed" } unstable = ["numanji", "allocator-suite", "jemallocator"] [dependencies] +bastion-utils = { version = "0.3.2", path = "../bastion-utils" } crossbeam-utils = "0.7" crossbeam-channel = "0.4" crossbeam-epoch = "0.8" diff --git a/bastion-executor/src/blocking.rs b/bastion-executor/src/blocking.rs index 0978ec3b..2fe269a5 100644 --- a/bastion-executor/src/blocking.rs +++ b/bastion-executor/src/blocking.rs @@ -52,25 +52,24 @@ //! to even out the load. use std::collections::VecDeque; - +use std::future::Future; +use std::io::ErrorKind; +use std::iter::Iterator; use std::sync::atomic::{AtomicU64, Ordering}; +use std::sync::Mutex; use std::time::Duration; use std::{env, thread}; use crossbeam_channel::{bounded, Receiver, Sender}; -use lazy_static::lazy_static; -use crate::{load_balancer, placement, utils}; +use bastion_utils::math; +use lazy_static::lazy_static; use lightproc::lightproc::LightProc; use lightproc::proc_stack::ProcStack; use lightproc::recoverable_handle::RecoverableHandle; -use std::future::Future; -use std::io::ErrorKind; -use std::iter::Iterator; use crate::placement::CoreId; - -use std::sync::Mutex; +use crate::{load_balancer, placement}; /// If low watermark isn't configured this is the default scaler value. /// This value is used for the heuristics of the scaler @@ -264,7 +263,7 @@ fn create_blocking_thread() { // // Generate a simple random number of milliseconds let rand_sleep_ms = 1000_u64 - .checked_add(u64::from(utils::random(10_000))) + .checked_add(u64::from(math::random(10_000))) .expect("shouldn't overflow"); let _ = thread::Builder::new() diff --git a/bastion-executor/src/lib.rs b/bastion-executor/src/lib.rs index 0a53e8de..a40ca772 100644 --- a/bastion-executor/src/lib.rs +++ b/bastion-executor/src/lib.rs @@ -43,8 +43,6 @@ pub mod run_queue; pub mod sleepers; pub mod worker; -mod utils; - /// /// Prelude of Bastion Executor pub mod prelude {