pub struct Job {
pub nodes: Vec<Arc<Box<dyn Node>>>,
/* private fields */
}
Expand description
Job represents the workflow whilst it is running.
When a job is created from a workflow, all of the nodes are converted from a generic Node struct to specific structs which represent only the data required for each node and each struct has it’s own implementation of what it should do when it is run.
Fields§
§nodes: Vec<Arc<Box<dyn Node>>>
A list of all the nodes within the job, each node shown in a workflow will appear
exactly once
These nodes are wrapped in Arc
so they can be sent across thread boundaries safely
Implementations§
Source§impl Job
impl Job
Sourcepub fn new(
wf: &Workflow,
reactor_tx: &Sender<Event>,
) -> (Self, Receiver<Message>)
pub fn new( wf: &Workflow, reactor_tx: &Sender<Event>, ) -> (Self, Receiver<Message>)
Creates a new Job struct from a Workflow. Also requires the sender to the reactor for any activity nodes that this will create as part of the Job struct. Will also own the Receiver to the executor channel so nodes can send data to it. Need to add position as property to each node Flatten pointer map to quickly scan for a nodes dependencies
Sourcepub fn next_node(
&self,
pointer: Option<usize>,
) -> Option<Vec<Arc<Box<dyn Node>>>>
pub fn next_node( &self, pointer: Option<usize>, ) -> Option<Vec<Arc<Box<dyn Node>>>>
This will return the next nodes being pointed to by the one that has just completed
This takes an optional pointer to the node which has just completed and then based off that will return the nodes which are pointed to from the one that has just completed.
If we are at the start of the job then we can pass in None
to signify this and it will
return the Start node.
This will return more than one node in the cases where multiple nodes are pointed to from the node that just completed. This covers cases such as opening parallel nodes and exclusives which can point to multiple nodes.
This will return None when it has reached an End node to signify there are no more nodes to be run.