Function timely::execute::execute_from

source ยท
pub fn execute_from<A, T, F>(
    builders: Vec<A>,
    others: Box<dyn Any + Send>,
    worker_config: WorkerConfig,
    func: F,
) -> Result<WorkerGuards<T>, String>
where A: AllocateBuilder + 'static, T: Send + 'static, F: Fn(&mut Worker<<A as AllocateBuilder>::Allocator>) -> T + Send + Sync + 'static,
Expand description

Executes a timely dataflow from supplied allocators and logging.

Refer to execute for more details.

use timely::dataflow::operators::{ToStream, Inspect};
use timely::WorkerConfig;

// execute a timely dataflow using command line parameters
let (builders, other) = timely::CommunicationConfig::Process(3).try_build().unwrap();
timely::execute::execute_from(builders, other, WorkerConfig::default(), |worker| {
    worker.dataflow::<(),_,_>(|scope| {
        (0..10).to_stream(scope)
               .inspect(|x| println!("seen: {:?}", x));
    })
}).unwrap();