use acts::{Engine, Vars, Workflow}; mod client; #[tokio::main] async fn main() { let mut store = client::Client::new(); store.init(); let engine = Engine::new(); let (s, sig) = engine.signal(()).double(); let text = include_str!("./model.yml"); let workflow = Workflow::from_yml(text).unwrap(); workflow.print(); let executor = engine.executor().clone(); engine .executor() .model().deploy(&workflow).expect("deploy model"); executor .proc() .start(&workflow.id, &Vars::new()) .expect("start workflow"); engine.channel().on_message(move |e| { let ret = store.process(&executor, e); if ret.is_err() { eprintln!("{}", ret.err().unwrap()); std::process::exit(1); } }); engine.channel().on_complete(move |e| { println!( "on_workflow_complete: pid={} cost={}ms outputs={:?}", e.pid, e.cost(), e.outputs ); s.close(); }); sig.recv().await; }