pub struct TaskFlow {
pub id: Uuid,
pub graph_id: Uuid,
pub project_id: Uuid,
pub base_revision: Option<String>,
pub state: FlowState,
pub task_executions: HashMap<Uuid, TaskExecution>,
pub created_at: DateTime<Utc>,
pub started_at: Option<DateTime<Utc>>,
pub completed_at: Option<DateTime<Utc>>,
pub updated_at: DateTime<Utc>,
}Expand description
A TaskFlow - runtime instance of a TaskGraph.
Fields§
§id: UuidUnique flow ID.
graph_id: UuidAssociated TaskGraph ID.
project_id: UuidAssociated project ID.
base_revision: Option<String>§state: FlowStateCurrent flow state.
task_executions: HashMap<Uuid, TaskExecution>Task execution states.
created_at: DateTime<Utc>Creation timestamp.
started_at: Option<DateTime<Utc>>Start timestamp.
completed_at: Option<DateTime<Utc>>Completion timestamp.
updated_at: DateTime<Utc>Last update timestamp.
Implementations§
Source§impl TaskFlow
impl TaskFlow
Sourcepub fn new(graph_id: Uuid, project_id: Uuid, task_ids: &[Uuid]) -> Self
pub fn new(graph_id: Uuid, project_id: Uuid, task_ids: &[Uuid]) -> Self
Creates a new TaskFlow from a graph.
Sourcepub fn get_task_execution(&self, task_id: Uuid) -> Option<&TaskExecution>
pub fn get_task_execution(&self, task_id: Uuid) -> Option<&TaskExecution>
Gets the execution state for a task.
Sourcepub fn get_task_execution_mut(
&mut self,
task_id: Uuid,
) -> Option<&mut TaskExecution>
pub fn get_task_execution_mut( &mut self, task_id: Uuid, ) -> Option<&mut TaskExecution>
Gets mutable execution state for a task.
Sourcepub fn transition_task(
&mut self,
task_id: Uuid,
new_state: TaskExecState,
) -> Result<(), FlowError>
pub fn transition_task( &mut self, task_id: Uuid, new_state: TaskExecState, ) -> Result<(), FlowError>
Transitions a task to a new state.
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Checks if the flow is in a terminal state.
Sourcepub fn tasks_in_state(&self, state: TaskExecState) -> Vec<Uuid>
pub fn tasks_in_state(&self, state: TaskExecState) -> Vec<Uuid>
Gets tasks in a particular state.
Sourcepub fn task_state_counts(&self) -> HashMap<TaskExecState, usize>
pub fn task_state_counts(&self) -> HashMap<TaskExecState, usize>
Counts tasks by state.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TaskFlow
impl<'de> Deserialize<'de> for TaskFlow
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TaskFlow
impl RefUnwindSafe for TaskFlow
impl Send for TaskFlow
impl Sync for TaskFlow
impl Unpin for TaskFlow
impl UnwindSafe for TaskFlow
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.