[−][src]Struct timely::worker::Worker
A Worker
is the entry point to a timely dataflow computation. It wraps a Allocate
,
and has a list of dataflows that it manages.
Methods
impl<A: Allocate> Worker<A>
[src]
pub fn new(c: A) -> Worker<A>
[src]
Allocates a new Worker
bound to a channel allocator.
pub fn step(&mut self) -> bool
[src]
Performs one step of the computation.
A step gives each dataflow operator a chance to run, and is the main way to ensure that a computation proceeds.
Examples
timely::execute_from_args(::std::env::args(), |worker| { use timely::dataflow::operators::{ToStream, Inspect}; worker.dataflow::<usize,_,_>(|scope| { (0 .. 10) .to_stream(scope) .inspect(|x| println!("{:?}", x)); }); worker.step(); });
pub fn step_while<F: FnMut() -> bool>(&mut self, func: F)
[src]
Calls self.step()
as long as func
evaluates to true.
Examples
timely::execute_from_args(::std::env::args(), |worker| { use timely::dataflow::operators::{ToStream, Inspect, Probe}; let probe = worker.dataflow::<usize,_,_>(|scope| { (0 .. 10) .to_stream(scope) .inspect(|x| println!("{:?}", x)) .probe() }); worker.step_while(|| probe.less_than(&0)); });
pub fn index(&self) -> usize
[src]
The index of the worker out of its peers.
Examples
timely::execute_from_args(::std::env::args(), |worker| { let index = worker.index(); let peers = worker.peers(); let timer = worker.timer(); println!("{:?}\tWorker {} of {}", timer.elapsed(), index, peers); });
pub fn peers(&self) -> usize
[src]
The total number of peer workers.
Examples
timely::execute_from_args(::std::env::args(), |worker| { let index = worker.index(); let peers = worker.peers(); let timer = worker.timer(); println!("{:?}\tWorker {} of {}", timer.elapsed(), index, peers); });
pub fn timer(&self) -> Instant
[src]
A timer started at the initiation of the timely computation.
Examples
timely::execute_from_args(::std::env::args(), |worker| { let index = worker.index(); let peers = worker.peers(); let timer = worker.timer(); println!("{:?}\tWorker {} of {}", timer.elapsed(), index, peers); });
pub fn new_identifier(&mut self) -> usize
[src]
Allocate a new worker-unique identifier.
This method is public, though it is not expected to be widely used outside of the timely dataflow system.
pub fn log_register(&self) -> RefMut<Registry<WorkerIdentifier>>
[src]
Access to named loggers.
Examples
timely::execute_from_args(::std::env::args(), |worker| { worker.log_register() .insert::<timely::logging::TimelyEvent,_>("timely", |time, data| println!("{:?}\t{:?}", time, data) ); });
pub fn dataflow<T, R, F>(&mut self, func: F) -> R where
T: Refines<()>,
F: FnOnce(&mut Child<Self, T>) -> R,
[src]
T: Refines<()>,
F: FnOnce(&mut Child<Self, T>) -> R,
Construct a new dataflow.
Examples
timely::execute_from_args(::std::env::args(), |worker| { // We must supply the timestamp type here, although // it would generally be determined by type inference. worker.dataflow::<usize,_,_>(|scope| { // uses of `scope` to build dataflow }); });
pub fn dataflow_core<T, R, F, V>(
&mut self,
name: &str,
logging: Option<TimelyLogger>,
resources: V,
func: F
) -> R where
T: Refines<()>,
F: FnOnce(&mut V, &mut Child<Self, T>) -> R,
V: Any + 'static,
[src]
&mut self,
name: &str,
logging: Option<TimelyLogger>,
resources: V,
func: F
) -> R where
T: Refines<()>,
F: FnOnce(&mut V, &mut Child<Self, T>) -> R,
V: Any + 'static,
Construct a new dataflow with specific configurations.
This method constructs a new dataflow, using a name, logger, and additional resources specified as argument. The name is cosmetic, the logger is used to handle events generated by the dataflow, and the additional resources are kept alive for as long as the dataflow is alive (use case: shared library bindings).
Examples
timely::execute_from_args(::std::env::args(), |worker| { // We must supply the timestamp type here, although // it would generally be determined by type inference. worker.dataflow_core::<usize,_,_,_>( "dataflow X", // Dataflow name None, // Optional logger 37, // Any resources |resources, scope| { // Closure // uses of `resources`, `scope`to build dataflow } ); });
Trait Implementations
impl<A: Allocate> AsWorker for Worker<A>
[src]
fn index(&self) -> usize
[src]
fn peers(&self) -> usize
[src]
fn allocate<D: Data>(
&mut self,
identifier: usize,
address: &[usize]
) -> (Vec<Box<dyn Push<Message<D>>>>, Box<dyn Pull<Message<D>>>)
[src]
&mut self,
identifier: usize,
address: &[usize]
) -> (Vec<Box<dyn Push<Message<D>>>>, Box<dyn Pull<Message<D>>>)
fn pipeline<T: 'static>(
&mut self,
identifier: usize,
address: &[usize]
) -> (ThreadPusher<Message<T>>, ThreadPuller<Message<T>>)
[src]
&mut self,
identifier: usize,
address: &[usize]
) -> (ThreadPusher<Message<T>>, ThreadPuller<Message<T>>)
fn new_identifier(&mut self) -> usize
[src]
fn log_register(&self) -> RefMut<Registry<WorkerIdentifier>>
[src]
fn logging(&self) -> Option<TimelyLogger>
[src]
Provides access to the timely logging stream.
impl<A: Allocate> ScopeParent for Worker<A>
[src]
impl<A: Allocate> Scheduler for Worker<A>
[src]
fn activations(&self) -> Rc<RefCell<Activations>>
[src]
fn activator_for(&self, path: &[usize]) -> Activator
[src]
impl<A: Allocate> Clone for Worker<A>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Data for T where
T: 'static + Clone,
[src]
T: 'static + Clone,
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,