Skip to content

Commit

Permalink
Server stream stats removed
Browse files Browse the repository at this point in the history
  • Loading branch information
spirali committed Sep 16, 2024
1 parent dc1607e commit 84ac448
Show file tree
Hide file tree
Showing 13 changed files with 6 additions and 69 deletions.
29 changes: 2 additions & 27 deletions crates/hyperqueue/src/client/output/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use crate::server::job::{JobTaskCounters, JobTaskInfo, JobTaskState};
use crate::stream::reader::streamdir::Summary;
use crate::transfer::messages::{
AutoAllocListResponse, JobDetail, JobInfo, JobTaskDescription, PinMode, QueueData, QueueState,
ServerInfo, StatsResponse, TaskDescription, TaskKind, TaskKindProgram, WaitForJobsResponse,
WorkerExitInfo, WorkerInfo,
ServerInfo, TaskDescription, TaskKind, TaskKindProgram, WaitForJobsResponse, WorkerExitInfo,
WorkerInfo,
};
use crate::{JobId, JobTaskCount, WorkerId};

Expand Down Expand Up @@ -394,31 +394,6 @@ impl Output for CliOutput {
self.print_vertical_table(rows);
}

fn print_server_stats(&self, stats: StatsResponse) {
let rows = vec![
vec![
"Stream connections".cell().bold(true),
stats.stream_stats.connections.join("\n").cell(),
],
vec![
"Stream registrations".cell().bold(true),
stats
.stream_stats
.registrations
.iter()
.map(|(job_id, path)| format!("{}: {}", job_id, path.display()))
.collect::<Vec<_>>()
.join("\n")
.cell(),
],
vec![
"Open files".cell().bold(true),
stats.stream_stats.files.join("\n").cell(),
],
];
self.print_vertical_table(rows);
}

fn print_job_submitted(&self, job: JobDetail) {
println!(
"Job submitted {}, job ID: {}",
Expand Down
5 changes: 1 addition & 4 deletions crates/hyperqueue/src/client/output/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::server::job::{JobTaskInfo, JobTaskState, StartedTaskData};
use crate::stream::reader::streamdir::Summary;
use crate::transfer::messages::{
AutoAllocListResponse, JobDetail, JobInfo, JobTaskDescription, PinMode, QueueData, ServerInfo,
StatsResponse, TaskDescription, TaskKind, TaskKindProgram, WaitForJobsResponse, WorkerInfo,
TaskDescription, TaskKind, TaskKindProgram, WaitForJobsResponse, WorkerInfo,
};
use crate::{JobId, JobTaskId};

Expand Down Expand Up @@ -64,9 +64,6 @@ impl Output for JsonOutput {
});
self.print(json);
}
fn print_server_stats(&self, stats: StatsResponse) {
self.print(json!(stats));
}

fn print_job_submitted(&self, job: JobDetail) {
self.print(json!({
Expand Down
4 changes: 1 addition & 3 deletions crates/hyperqueue/src/client/output/outputs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::transfer::messages::{
AutoAllocListResponse, JobDetail, JobInfo, ServerInfo, StatsResponse, WaitForJobsResponse,
WorkerInfo,
AutoAllocListResponse, JobDetail, JobInfo, ServerInfo, WaitForJobsResponse, WorkerInfo,
};

use crate::client::job::WorkerMap;
Expand Down Expand Up @@ -40,7 +39,6 @@ pub trait Output {

// Server
fn print_server_description(&self, server_dir: Option<&Path>, record: &ServerInfo);
fn print_server_stats(&self, stats: StatsResponse);

// Jobs
fn print_job_submitted(&self, job: JobDetail);
Expand Down
5 changes: 2 additions & 3 deletions crates/hyperqueue/src/client/output/quiet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use crate::server::autoalloc::Allocation;
use crate::server::job::JobTaskInfo;
use crate::stream::reader::streamdir::Summary;
use crate::transfer::messages::{
AutoAllocListResponse, JobDetail, JobInfo, ServerInfo, StatsResponse, WaitForJobsResponse,
WorkerExitInfo, WorkerInfo,
AutoAllocListResponse, JobDetail, JobInfo, ServerInfo, WaitForJobsResponse, WorkerExitInfo,
WorkerInfo,
};
use crate::JobId;

Expand Down Expand Up @@ -64,7 +64,6 @@ impl Output for Quiet {
println!("{}", dir.display());
}
}
fn print_server_stats(&self, _stats: StatsResponse) {}

// Jobs
fn print_job_submitted(&self, job: JobDetail) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ fn create_rows(worker_info: &WorkerConfiguration) -> Vec<WorkerConfigDataRow> {
.unwrap_or(missing_data_str.as_str())
.to_string()),
},
WorkerConfigDataRow {
label: "Log Dir: ",
data: worker_info
.log_dir
.to_str()
.unwrap_or(missing_data_str.as_str())
.to_string(),
},
WorkerConfigDataRow {
label: "Heartbeat Interval: ",
data: humantime::format_duration(worker_info.heartbeat_interval).to_string(),
Expand Down
13 changes: 0 additions & 13 deletions crates/hyperqueue/src/transfer/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ pub enum ToClientMessage {
SubmitResponse(SubmitResponse),
WorkerListResponse(WorkerListResponse),
WorkerInfoResponse(Option<WorkerInfo>),
StatsResponse(StatsResponse),
StopWorkerResponse(Vec<(WorkerId, StopWorkerResponse)>),
CancelJobResponse(Vec<(JobId, CancelJobResponse)>),
ForgetJobResponse(ForgetJobResponse),
Expand Down Expand Up @@ -374,18 +373,6 @@ pub enum StopWorkerResponse {
Failed(String),
}

#[derive(Serialize, Deserialize, Debug)]
pub struct StreamStats {
pub connections: Vec<String>,
pub registrations: Vec<(JobId, PathBuf)>,
pub files: Vec<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct StatsResponse {
pub stream_stats: StreamStats,
}

#[derive(Serialize, Deserialize, Debug)]
#[allow(clippy::large_enum_variant)]
pub enum SubmitResponse {
Expand Down
2 changes: 0 additions & 2 deletions crates/pyhq/src/cluster/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ impl RunningWorker {

let worker_dir = server_dir.join("worker");
let work_dir = worker_dir.join("workdir");
let log_dir = worker_dir.join("logs");
let mut configuration = WorkerConfiguration {
resources: ResourceDescriptor::new(vec![ResourceDescriptorItem {
name: CPU_RESOURCE_NAME.to_string(),
Expand All @@ -44,7 +43,6 @@ impl RunningWorker {
hostname: get_hostname(None),
group: "default".to_string(),
work_dir,
log_dir,
heartbeat_interval: Duration::from_secs(10),
overview_configuration: None,
idle_timeout: None,
Expand Down
1 change: 0 additions & 1 deletion crates/tako/benches/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ pub fn create_worker(id: u64) -> Worker {
hostname: "".to_string(),
group: "default".to_string(),
work_dir: Default::default(),
log_dir: Default::default(),
heartbeat_interval: Default::default(),
overview_configuration: None,
idle_timeout: None,
Expand Down
3 changes: 0 additions & 3 deletions crates/tako/src/internal/tests/integration/utils/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ pub(super) fn create_worker_configuration(
hostname: "".to_string(),
group: "".to_string(),
work_dir: Default::default(),
log_dir: Default::default(),
heartbeat_interval,
overview_configuration: send_overview_interval.map(|send_interval| {
OverviewConfiguration {
Expand Down Expand Up @@ -154,8 +153,6 @@ pub(super) async fn start_worker(

configuration.work_dir.clone_from(&workdir);
std::fs::create_dir_all(&configuration.work_dir).unwrap();
configuration.log_dir.clone_from(&logdir);
std::fs::create_dir_all(&configuration.log_dir).unwrap();

let server_address: SocketAddr = SocketAddr::new(Ipv4Addr::LOCALHOST.into(), port);

Expand Down
2 changes: 0 additions & 2 deletions crates/tako/src/internal/tests/test_reactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ fn test_worker_add() {
listen_address: "test1:123".into(),
hostname: "test1".to_string(),
work_dir: Default::default(),
log_dir: Default::default(),
heartbeat_interval: Duration::from_millis(1000),
overview_configuration: Some(OverviewConfiguration {
send_interval: Duration::from_millis(1000),
Expand Down Expand Up @@ -99,7 +98,6 @@ fn test_worker_add() {
hostname: "test2".to_string(),
group: "default".to_string(),
work_dir: Default::default(),
log_dir: Default::default(),
heartbeat_interval: Duration::from_millis(1000),
overview_configuration: Some(OverviewConfiguration {
send_interval: Duration::from_millis(1000),
Expand Down
1 change: 0 additions & 1 deletion crates/tako/src/internal/tests/test_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ fn create_test_worker_config() -> WorkerConfiguration {
hostname: "test1".to_string(),
group: "default".to_string(),
work_dir: Default::default(),
log_dir: Default::default(),
heartbeat_interval: Duration::from_millis(1000),
overview_configuration: Some(OverviewConfiguration {
send_interval: Duration::from_millis(1000),
Expand Down
1 change: 0 additions & 1 deletion crates/tako/src/internal/tests/utils/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ impl TestEnv {
hostname: format!("test{}", i),
group: "default".to_string(),
work_dir: Default::default(),
log_dir: Default::default(),
heartbeat_interval: Duration::from_millis(1000),
overview_configuration: Some(OverviewConfiguration {
send_interval: Duration::from_millis(1000),
Expand Down
1 change: 0 additions & 1 deletion crates/tako/src/internal/tests/utils/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ pub fn create_test_worker_config(
hostname: format!("test{}", worker_id),
group: "default".to_string(),
work_dir: Default::default(),
log_dir: Default::default(),
heartbeat_interval: Duration::from_millis(1000),
overview_configuration: Some(OverviewConfiguration {
send_interval: Duration::from_millis(1000),
Expand Down

0 comments on commit 84ac448

Please sign in to comment.