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

Refactor the dashboard #775

Merged
merged 31 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
dc8a55d
Bring dashboard into a compilable state
Kobzol Oct 14, 2024
32aa5e7
Update ratatui to 0.28
Kobzol Oct 14, 2024
18125ad
Replace termion with crossterm
Kobzol Oct 14, 2024
82f35f1
Refactor dashboard initialization and event streaming
Kobzol Oct 17, 2024
befb7c7
Add `stream` subcommand to `hq dashboard` and make it the default
Kobzol Oct 18, 2024
b5c8526
Rename `get_*` worker timeline methods to `query_*`
Kobzol Oct 18, 2024
93fe46a
Set time mode based on the input data (fixed for replay and live for …
Kobzol Oct 18, 2024
dead5f3
Send remaining events in data fetching
Kobzol Oct 18, 2024
97e54c0
Remove unused method and only compile helper function in `TimeBasedVe…
Kobzol Oct 18, 2024
3e9bcb8
Improve layout of root screen and make worker screen the default
Kobzol Oct 18, 2024
99e7979
Remove unused module
Kobzol Oct 18, 2024
f5e0181
Rename `overview_screen` to `worker_overview_screen`
Kobzol Oct 18, 2024
d84fc79
Move and rename stuff around
Kobzol Oct 18, 2024
d5d6c2d
Improve default timeline window for replayed visualizations
Kobzol Oct 18, 2024
3e201af
Only allow switching to live view if the dashboard is streaming
Kobzol Oct 18, 2024
7155ed2
Display if the dashboard is in stream or replay mode
Kobzol Oct 18, 2024
9be9bcd
Fix worker table column order
Kobzol Oct 18, 2024
5c94653
Re-enable job queries and update design of worker detail
Kobzol Oct 18, 2024
ffb95b7
Send event updates every half a second, instead of every second
Kobzol Oct 18, 2024
5b5505f
Hide useless legend
Kobzol Oct 18, 2024
2df64d0
Improve visualization of worker detail
Kobzol Oct 18, 2024
b9a05c8
Add zoom in and zoom out functionality
Kobzol Oct 18, 2024
6d2d935
Improve timeline offsetting
Kobzol Oct 18, 2024
9f2819c
Improve job overview
Kobzol Oct 18, 2024
58c7fbb
Improve chart abstractions
Kobzol Oct 19, 2024
e34dcc9
Fix style applied to job overview tables
Kobzol Oct 19, 2024
011f65f
Move autoalloc screen to a separate module
Kobzol Oct 21, 2024
9603057
Move autoalloc fragments to its screen module
Kobzol Oct 21, 2024
200a4ca
Inline autoalloc fragment into its screen
Kobzol Oct 21, 2024
ae316a4
Resolve warnings
Kobzol Oct 21, 2024
f9dc2e6
Remove event sort
Kobzol Oct 26, 2024
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
143 changes: 59 additions & 84 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions crates/hyperqueue/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ itertools = "0.13.0"
lru = "0.12"

# Dashboard
ratatui = { version = "0.26", default-features = false, features = ["termion"], optional = true }
termion = { version = "1.5", optional = true }
ratatui = { version = "0.28", default-features = false, features = ["crossterm"], optional = true }
crossterm = { version = "0.28", features = ["event-stream"], optional = true }
unicode-width = { version = "0.1.5", optional = true }

# Tako
Expand All @@ -79,7 +79,7 @@ zero-worker = []
# Use the jemalloc allocator
jemalloc = ["jemallocator"]
# Enable the dashboard
dashboard = ["dep:ratatui", "dep:termion", "dep:unicode-width"]
dashboard = ["dep:ratatui", "dep:crossterm", "dep:unicode-width"]

[[bench]]
name = "benchmark"
Expand Down
23 changes: 20 additions & 3 deletions crates/hyperqueue/src/bin/hq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,30 @@ async fn command_worker_address(
}

#[cfg(feature = "dashboard")]
///Starts the hq Dashboard
/// Starts the hq dashboard
async fn command_dashboard_start(
gsettings: &GlobalSettings,
_opts: hyperqueue::common::cli::DashboardOpts,
opts: hyperqueue::common::cli::DashboardOpts,
) -> anyhow::Result<()> {
use hyperqueue::common::cli::DashboardCommand;
use hyperqueue::dashboard::start_ui_loop;
start_ui_loop(gsettings).await?;
use hyperqueue::server::event::log::JournalReader;
use hyperqueue::server::event::Event;

match opts.subcmd.unwrap_or_default() {
DashboardCommand::Replay { journal, stream } => {
println!("Loading journal {}", journal.display());
let mut journal = JournalReader::open(&journal)?;
let events: Vec<Event> = journal.collect::<Result<_, _>>()?;
println!("Loaded {} events", events.len());

start_ui_loop(gsettings, events, stream).await?;
}
DashboardCommand::Stream => {
start_ui_loop(gsettings, vec![], true).await?;
}
}

Ok(())
}

Expand Down
27 changes: 22 additions & 5 deletions crates/hyperqueue/src/common/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,6 @@ pub struct RootOptions {
pub subcmd: SubCommand,
}

/// HyperQueue Dashboard
#[allow(clippy::large_enum_variant)]
#[derive(Parser)]
pub struct DashboardOpts {}

#[allow(clippy::large_enum_variant)]
#[derive(Parser)]
pub enum SubCommand {
Expand Down Expand Up @@ -212,6 +207,28 @@ pub enum SubCommand {
GenerateCompletion(GenerateCompletionOpts),
}

/// HyperQueue Dashboard
#[derive(Parser)]
pub struct DashboardOpts {
#[clap(subcommand)]
pub subcmd: Option<DashboardCommand>,
}

#[derive(Parser, Default)]
pub enum DashboardCommand {
/// Stream events from a server.
#[default]
Stream,
/// Replay events from a recorded journal file.
Replay {
/// Path to a journal file created via `hq server start --journal=<path>`.
journal: PathBuf,
/// Also stream new events from a server after replaying events from the journal.
#[clap(long)]
stream: bool,
},
}

// Worker CLI options

#[derive(Parser)]
Expand Down
Loading
Loading