Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure files to be more appropriate #1131

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion nativelink-scheduler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ tokio = { version = "1.37.0", features = ["sync", "rt", "parking_lot"] }
tokio-stream = { version = "0.1.15", features = ["sync"] }
tonic = { version = "0.11.0", features = ["gzip", "tls"] }
tracing = "0.1.40"
bitflags = "2.5.0"
redis = { version = "0.25.2", features = ["aio", "tokio", "json"] }
serde = "1.0.203"
redis-macros = "0.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ use nativelink_config::schedulers::WorkerAllocationStrategy;
use nativelink_error::{error_if, make_err, make_input_err, Code, Error, ResultExt};
use nativelink_util::action_messages::{ActionInfo, ActionStage, OperationId, WorkerId};
use nativelink_util::metrics_utils::Registry;
use nativelink_util::operation_state_manager::WorkerStateManager;
use nativelink_util::platform_properties::PlatformProperties;
use tokio::sync::Notify;
use tonic::async_trait;
use tracing::{event, Level};

use crate::operation_state_manager::WorkerStateManager;
use crate::platform_property_manager::PlatformPropertyManager;
use crate::worker::{Worker, WorkerTimestamp, WorkerUpdate};
use crate::worker_scheduler::WorkerScheduler;
Expand All @@ -45,7 +45,7 @@ struct ApiWorkerSchedulerImpl {

impl ApiWorkerSchedulerImpl {
/// Refreshes the lifetime of the worker with the given timestamp.
pub(crate) fn refresh_lifetime(
fn refresh_lifetime(
&mut self,
worker_id: &WorkerId,
timestamp: WorkerTimestamp,
Expand All @@ -68,7 +68,7 @@ impl ApiWorkerSchedulerImpl {

/// Adds a worker to the pool.
/// Note: This function will not do any task matching.
pub(crate) fn add_worker(&mut self, worker: Worker) -> Result<(), Error> {
fn add_worker(&mut self, worker: Worker) -> Result<(), Error> {
let worker_id = worker.id;
self.workers.put(worker_id, worker);

Expand All @@ -94,14 +94,14 @@ impl ApiWorkerSchedulerImpl {
/// Removes worker from pool.
/// Note: The caller is responsible for any rescheduling of any tasks that might be
/// running.
pub(crate) fn remove_worker(&mut self, worker_id: &WorkerId) -> Option<Worker> {
fn remove_worker(&mut self, worker_id: &WorkerId) -> Option<Worker> {
let result = self.workers.pop(worker_id);
self.worker_change_notify.notify_one();
result
}

/// Sets if the worker is draining or not.
pub async fn set_drain_worker(
async fn set_drain_worker(
&mut self,
worker_id: &WorkerId,
is_draining: bool,
Expand Down Expand Up @@ -134,7 +134,7 @@ impl ApiWorkerSchedulerImpl {
workers_iter.map(|(_, w)| &w.id).copied()
}

pub async fn update_action(
async fn update_action(
&mut self,
worker_id: &WorkerId,
operation_id: &OperationId,
Expand Down Expand Up @@ -245,7 +245,7 @@ impl ApiWorkerSchedulerImpl {
}

/// Evicts the worker from the pool and puts items back into the queue if anything was being executed on it.
pub async fn immediate_evict_worker(
async fn immediate_evict_worker(
&mut self,
worker_id: &WorkerId,
err: Error,
Expand Down
4 changes: 2 additions & 2 deletions nativelink-scheduler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
// limitations under the License.

pub mod action_scheduler;
pub mod api_worker_scheduler;
pub mod cache_lookup_scheduler;
pub mod default_action_listener;
pub mod default_scheduler_factory;
pub mod grpc_scheduler;
pub mod operation_state_manager;
pub mod memory_scheduler_state;
pub mod platform_property_manager;
pub mod property_modifier_scheduler;
pub mod redis_action_stage;
pub mod redis_operation_state;
pub mod scheduler_state;
pub mod simple_scheduler;
pub mod worker;
pub mod worker_scheduler;
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ impl AwaitedAction {
/// Sets the current state of the action and notifies subscribers.
/// Returns true if the state was set, false if there are no subscribers.
#[must_use]
// TODO(allada) IMPORTANT: This function should only be visible to ActionActionDb.
pub(crate) fn set_current_state(&self, state: Arc<ActionState>) -> bool {
pub fn set_current_state(&self, state: Arc<ActionState>) -> bool {
self.update_worker_timestamp();
// Note: Use `send_replace()`. Using `send()` will not change the value if
// there are no subscribers.
Expand Down
Loading