[−][src]Function hm::get_task_batches
pub fn get_task_batches(
nodes: HashMap<String, ManagedObject>
) -> Result<Vec<Vec<ManagedObject>>, HMError>
Create a non-cyclical dependency graph and give it back as a Vec<Vec<ManagedObject>>. Will return a CyclicalDependencyError if the graph is unsolveable. Intended to be used with either mgmt::execute_solution or mgmt::send_tasks_off_to_college.
Example:
extern crate indicatif; use std::sync::mpsc; use std::collections::HashMap; use indicatif::{MultiProgress, ProgressBar}; use hm::config::ManagedObject; use hm::{get_task_batches, send_tasks_off_to_college}; let nodes: HashMap<String, ManagedObject> = HashMap::new(); let (tx, rx) = mpsc::channel(); let mp: MultiProgress = MultiProgress::new(); let v: Vec<Vec<ManagedObject>> = get_task_batches(nodes).unwrap(); for a in v { for b in a { let _p: ProgressBar = mp.add(ProgressBar::new_spinner()); send_tasks_off_to_college(&b, &tx, _p); } }