Function timely::execute::execute_logging [] [src]

pub fn execute_logging<T, F>(
    config: Configuration,
    logging_config: LoggerConfig,
    func: F
) -> Result<WorkerGuards<T>, String> where
    T: Send + 'static,
    F: Fn(&mut Root<Allocator>) -> T + Send + Sync + 'static, 

Executes a timely dataflow from a configuration and per-communicator logic.

Refer to execute for more details. This function additionally supports providing a logging configuration.

use timely::dataflow::operators::{ToStream, Inspect};
use timely::logging::{LoggerConfig, EventPusherTee};

let logger_config = LoggerConfig::new(
    |_setup| EventPusherTee::new() /* setup logging destinations */,
    |_setup| EventPusherTee::new() /* setup logging destinations */);

// execute a timely dataflow using command line parameters
timely::execute_logging(timely::Configuration::Process(3), logger_config, |worker| {
    worker.dataflow::<(),_,_>(|scope| {
        (0..10).to_stream(scope)
               .inspect(|x| println!("seen: {:?}", x));
    })
}).unwrap();