-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from QIUZHILEI/dev
Dev
- Loading branch information
Showing
41 changed files
with
957 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,60 @@ | ||
[package] | ||
name = "dagrs" | ||
authors = ["Quanyi Ma <[email protected]>", "Zhilei Qiu <[email protected]>"] | ||
version = "0.2.0" | ||
version = "0.3.0" | ||
edition = "2021" | ||
license = "MIT OR Apache-2.0" | ||
description = "The DAG engine, named dagrs, is designed to execute multiple tasks with graph-like dependencies. It offers high performance and asynchronous execution, providing a convenient programming interface for Rust developers." | ||
readme = "README.md" | ||
repository = "https://github.com/open-rust-initiative/dagrs" | ||
keywords = ["DAG", "task", "async", "parallel", "concurrent"] | ||
|
||
[dependencies] | ||
yaml-rust = "0.4.5" | ||
bimap = "0.6.1" | ||
clap = { version = "4.2.2", features = ["derive"] } | ||
anymap2 = "0.13.0" | ||
thiserror = "1.0.30" | ||
tokio = { version = "1.28", features = ["rt", "sync","rt-multi-thread"] } | ||
|
||
[dev-dependencies] | ||
log = "0.4" | ||
simplelog = "0.12" | ||
|
||
[workspace] | ||
members = ["dagrs_derive","dagrs_core"] | ||
|
||
|
||
[dependencies] | ||
dagrs_core = {path = "dagrs_core" , version = "0.3.0"} | ||
dagrs_derive ={ path = "dagrs_derive", version = "0.3.0"} | ||
|
||
[features] | ||
default = ["logger"] | ||
logger = [] | ||
yaml = [] | ||
default = ["dagrs_core/logger"] | ||
yaml = ["dagrs_core/yaml"] | ||
derive = ["dagrs_derive/derive"] | ||
|
||
[[example]] | ||
name = "custom_log" | ||
required-features = ["yaml"] | ||
|
||
[[example]] | ||
name = "custom_parser" | ||
required-features = ["yaml"] | ||
|
||
[[example]] | ||
name = "engine" | ||
required-features = ["yaml"] | ||
|
||
[[example]] | ||
name = "derive_task" | ||
required-features = ["derive"] | ||
|
||
[[example]] | ||
name = "dependencies" | ||
required-features = ["derive"] | ||
|
||
[[example]] | ||
name = "yaml_dag" | ||
required-features = ["yaml"] | ||
|
||
[[test]] | ||
name = "dag_job_test" | ||
required-features = ["yaml"] | ||
|
||
[[test]] | ||
name = "yaml_parser_test" | ||
required-features = ["yaml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[package] | ||
name = "dagrs_core" | ||
version = "0.3.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
yaml-rust = "0.4.5" | ||
bimap = "0.6.1" | ||
clap = { version = "4.2.2", features = ["derive"] } | ||
anymap2 = "0.13.0" | ||
thiserror = "1.0.30" | ||
tokio = { version = "1.28", features = ["rt", "sync","rt-multi-thread"] } | ||
|
||
[features] | ||
default = ["logger"] | ||
logger = [] | ||
yaml = [] | ||
|
||
|
||
[[bin]] | ||
name = "dagrs" | ||
required-features = ["yaml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use std::collections::HashMap; | ||
|
||
use clap::Parser; | ||
use dagrs_core::{log, Dag, LogLevel}; | ||
|
||
#[derive(Parser, Debug)] | ||
#[command(name = "dagrs", version = "0.2.0")] | ||
struct Args { | ||
/// Log output file, the default is to print to the terminal. | ||
#[arg(long)] | ||
log_path: Option<String>, | ||
/// yaml configuration file path. | ||
#[arg(long)] | ||
yaml: String, | ||
/// Log level, the default is Info. | ||
#[arg(long)] | ||
log_level: Option<String>, | ||
} | ||
|
||
fn main() { | ||
let args = Args::parse(); | ||
let log_level = args | ||
.log_level | ||
.map_or(LogLevel::Info, |level| match level.as_str() { | ||
"debug" => LogLevel::Debug, | ||
"info" => LogLevel::Info, | ||
"warn" => LogLevel::Warn, | ||
"error" => LogLevel::Error, | ||
"off" => LogLevel::Off, | ||
_ => { | ||
println!("The logging level can only be [debug,info,warn,error,off]"); | ||
std::process::abort(); | ||
} | ||
}); | ||
let _initialized = match args.log_path { | ||
None => log::init_logger(log_level, None), | ||
Some(path) => log::init_logger(log_level, Some(std::fs::File::create(path).unwrap())), | ||
}; | ||
let yaml_path = args.yaml; | ||
let mut dag = Dag::with_yaml(yaml_path.as_str(), HashMap::new()).unwrap(); | ||
assert!(dag.start().unwrap()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
extern crate anymap2; | ||
extern crate bimap; | ||
extern crate clap; | ||
extern crate proc_macro; | ||
extern crate tokio; | ||
#[cfg(feature = "yaml")] | ||
extern crate yaml_rust; | ||
|
||
pub use engine::{Dag, DagError, Engine}; | ||
pub use parser::*; | ||
pub use task::{alloc_id, Action, DefaultTask, Input, NopAction, Output, RunningError, Task}; | ||
#[cfg(feature = "yaml")] | ||
pub use task::{CommandAction, YamlTask}; | ||
pub use utils::{gen_macro, log, EnvVar, LogLevel, Logger}; | ||
mod engine; | ||
mod parser; | ||
mod task; | ||
mod utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,4 +53,3 @@ impl From<YamlTaskError> for ParserError { | |
ParserError::YamlTaskError(value) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.