mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-09-23 13:16:27 +00:00
Tag workloads
This commit is contained in:
@ -8,7 +8,7 @@ use tracing_trace::processor::span_stats::CallStats;
|
||||
use uuid::Uuid;
|
||||
|
||||
use super::env_info;
|
||||
use super::workload::Workload;
|
||||
use super::workload::BenchWorkload;
|
||||
use crate::common::client::Client;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@ -89,7 +89,7 @@ impl DashboardClient {
|
||||
pub async fn create_workload(
|
||||
&self,
|
||||
invocation_uuid: Uuid,
|
||||
workload: &Workload,
|
||||
workload: &BenchWorkload,
|
||||
) -> anyhow::Result<Uuid> {
|
||||
let Self::Client(dashboard_client) = self else { return Ok(Uuid::now_v7()) };
|
||||
|
||||
|
@ -5,7 +5,7 @@ use anyhow::{bail, Context as _};
|
||||
use tokio::process::Command;
|
||||
use tokio::time;
|
||||
|
||||
use super::workload::Workload;
|
||||
use super::workload::BenchWorkload;
|
||||
use crate::common::assets::Asset;
|
||||
use crate::common::client::Client;
|
||||
|
||||
@ -68,7 +68,7 @@ pub async fn build() -> anyhow::Result<()> {
|
||||
pub async fn start(
|
||||
client: &Client,
|
||||
master_key: Option<&str>,
|
||||
workload: &Workload,
|
||||
workload: &BenchWorkload,
|
||||
asset_folder: &str,
|
||||
mut command: Command,
|
||||
) -> anyhow::Result<tokio::process::Child> {
|
||||
|
@ -6,13 +6,14 @@ mod workload;
|
||||
|
||||
use crate::common::args::CommonArgs;
|
||||
use crate::common::logs::setup_logs;
|
||||
use crate::common::workload::Workload;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use anyhow::Context;
|
||||
use anyhow::{bail, Context};
|
||||
use clap::Parser;
|
||||
|
||||
use self::workload::Workload;
|
||||
use crate::common::client::Client;
|
||||
pub use workload::BenchWorkload;
|
||||
|
||||
pub fn default_http_addr() -> String {
|
||||
"127.0.0.1:7700".to_string()
|
||||
@ -137,6 +138,10 @@ pub fn run(args: BenchDeriveArgs) -> anyhow::Result<()> {
|
||||
.with_context(|| format!("error opening {}", workload_file.display()))?,
|
||||
)
|
||||
.with_context(|| format!("error parsing {} as JSON", workload_file.display()))?;
|
||||
|
||||
let Workload::Bench(workload) = workload else {
|
||||
bail!("workload file {} is not a bench workload", workload_file.display());
|
||||
};
|
||||
|
||||
let workload_name = workload.name.clone();
|
||||
|
||||
|
@ -20,7 +20,7 @@ use crate::common::client::Client;
|
||||
/// A bench workload.
|
||||
/// Not to be confused with [a test workload](crate::test::workload::Workload).
|
||||
#[derive(Deserialize)]
|
||||
pub struct Workload {
|
||||
pub struct BenchWorkload {
|
||||
pub name: String,
|
||||
pub run_count: u16,
|
||||
pub extra_cli_args: Vec<String>,
|
||||
@ -37,7 +37,7 @@ async fn run_commands(
|
||||
logs_client: &Client,
|
||||
meili_client: &Client,
|
||||
workload_uuid: Uuid,
|
||||
workload: &Workload,
|
||||
workload: &BenchWorkload,
|
||||
args: &BenchDeriveArgs,
|
||||
run_number: u16,
|
||||
) -> anyhow::Result<JoinHandle<anyhow::Result<File>>> {
|
||||
@ -86,7 +86,7 @@ pub async fn execute(
|
||||
meili_client: &Client,
|
||||
invocation_uuid: Uuid,
|
||||
master_key: Option<&str>,
|
||||
workload: Workload,
|
||||
workload: BenchWorkload,
|
||||
args: &BenchDeriveArgs,
|
||||
binary_path: Option<&Path>,
|
||||
) -> anyhow::Result<()> {
|
||||
@ -134,7 +134,7 @@ async fn execute_run(
|
||||
meili_client: &Client,
|
||||
workload_uuid: Uuid,
|
||||
master_key: Option<&str>,
|
||||
workload: &Workload,
|
||||
workload: &BenchWorkload,
|
||||
args: &BenchDeriveArgs,
|
||||
binary_path: Option<&Path>,
|
||||
run_number: u16,
|
||||
|
@ -2,3 +2,4 @@ pub mod args;
|
||||
pub mod assets;
|
||||
pub mod client;
|
||||
pub mod logs;
|
||||
pub mod workload;
|
||||
|
10
crates/xtask/src/common/workload.rs
Normal file
10
crates/xtask/src/common/workload.rs
Normal file
@ -0,0 +1,10 @@
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::{bench::BenchWorkload, test::TestWorkload};
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum Workload {
|
||||
Bench(BenchWorkload),
|
||||
Test(TestWorkload),
|
||||
}
|
@ -4,6 +4,8 @@ use crate::common::{args::CommonArgs, logs::setup_logs};
|
||||
|
||||
mod workload;
|
||||
|
||||
pub use workload::TestWorkload;
|
||||
|
||||
/// Run tests from a workload
|
||||
#[derive(Parser, Debug)]
|
||||
pub struct TestDeriveArgs {
|
||||
|
@ -1,12 +1,12 @@
|
||||
use std::collections::BTreeMap;
|
||||
use serde::Deserialize;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use crate::common::assets::Asset;
|
||||
|
||||
/// A test workload.
|
||||
/// Not to be confused with [a bench workload](crate::bench::workload::Workload).
|
||||
#[derive(Deserialize)]
|
||||
pub struct Workload {
|
||||
pub struct TestWorkload {
|
||||
pub name: String,
|
||||
pub assets: BTreeMap<String, Asset>,
|
||||
}
|
||||
|
Reference in New Issue
Block a user