Skip to content

Commit

Permalink
Implement section reporting scheduler state
Browse files Browse the repository at this point in the history
  • Loading branch information
jherbel committed Nov 7, 2023
1 parent 0d11c8b commit 638aafe
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
17 changes: 17 additions & 0 deletions v2/robotmk/src/bin/scheduler/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use clap::Parser;
use log::{debug, info};
use logging::log_and_return_error;
use robotmk::lock::Locker;
use robotmk::section::WriteSection;

fn main() -> Result<()> {
run().map_err(log_and_return_error)?;
Expand Down Expand Up @@ -45,6 +46,7 @@ fn run() -> Result<()> {
bail!("Terminated")
}

write_state(&results::SchedulerState::Setup, &global_config)?;
let suites = setup::setup(&global_config, suites)?;
debug!("Setup completed");

Expand All @@ -53,6 +55,10 @@ fn run() -> Result<()> {
}

info!("Starting environment building");
write_state(
&results::SchedulerState::EnvironmentBuilding,
&global_config,
)?;
let suites = environment::build_environments(&global_config, suites)?;
info!("Environment building finished");

Expand All @@ -61,5 +67,16 @@ fn run() -> Result<()> {
}

info!("Starting suite scheduling");
write_state(&results::SchedulerState::Scheduling, &global_config)?;
scheduling::scheduler::run_suites_and_cleanup(&global_config, &suites)
}

fn write_state(
state: &results::SchedulerState,
global_config: &internal_config::GlobalConfig,
) -> Result<()> {
state.write(
global_config.results_directory.join("scheduler_state.json"),
&global_config.results_directory_locker,
)
}
13 changes: 13 additions & 0 deletions v2/robotmk/src/bin/scheduler/results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ pub fn suite_results_directory(results_directory: &Utf8Path) -> Utf8PathBuf {
results_directory.join("suites")
}

#[derive(Serialize)]
pub enum SchedulerState {
Setup,
EnvironmentBuilding,
Scheduling,
}

impl WriteSection for SchedulerState {
fn name() -> &'static str {
"robotmk_scheduler_state"
}
}

#[derive(Serialize)]
pub struct RCCSetupFailures {
pub telemetry_disabling: Vec<String>,
Expand Down

0 comments on commit 638aafe

Please sign in to comment.