From 4dea51999e50280e9e6aa5e2fada09f499aca572 Mon Sep 17 00:00:00 2001 From: Kinesin Data Technologies Incorporated <93931750+kinesintech@users.noreply.github.com> Date: Tue, 4 Oct 2022 15:43:43 -0300 Subject: [PATCH] adding wf utility --- Cargo.toml | 2 ++ src/bin/wf/main.rs | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/bin/wf/main.rs diff --git a/Cargo.toml b/Cargo.toml index 214f3e9..c64e877 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,3 +18,5 @@ users = { version = "0.11", optional = true } psutil = { version = "3.2", features = ["process"] } sysinfo = "0.23" redis = { version = "*", features = ["aio", "tokio-comp"] } +clap = { version = "3.1", features = ["derive"] } +env_logger = "0.9" diff --git a/src/bin/wf/main.rs b/src/bin/wf/main.rs new file mode 100644 index 0000000..b2784b9 --- /dev/null +++ b/src/bin/wf/main.rs @@ -0,0 +1,40 @@ +use clap::Parser; +use serde::Serialize; + +use waterfall::executors::local_executor; +use waterfall::runner::Runner; +use waterfall::storage::redis_store; +use waterfall::world::WorldDefinition; + +#[derive(Parser, Debug)] +#[clap(author, version, about)] +struct Args { + /// Configuration File + #[clap(short, long, default_value = "")] + config: String, + + /// Configuration File + #[clap(short, long, default_value = "")] + world: String, + + /// Enable verbose logging + #[clap(short, long)] + verbose: bool, +} + +#[tokio::main] +async fn main() -> std::io::Result<()> { + let args = Args::parse(); + env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); + + let json = std::fs::read_to_string(&args.config) + .expect(&format!("Unable to open {} for reading", args.config)); + + // Some Deserializer. + let world_def: WorldDefinition = + serde_json::from_str(&json).expect("Unable to parse world definition"); + + let tasks = world_def.taskset().unwrap(); + + Ok(()) +}