pub struct WorkflowOptions {
pub allow_failure: bool,
/* private fields */
}Expand description
Options of a sub-workflow step started with
workflow_with or
workflows_with.
§Examples
use ironflow_engine::config::WorkflowOptions;
let options = WorkflowOptions::new().allow_failure();
assert!(options.allow_failure);
assert!(!WorkflowOptions::default().allow_failure);Fields§
§allow_failure: boolTolerate a failed child run instead of failing the parent.
Implementations§
Source§impl WorkflowOptions
impl WorkflowOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Create options with every flag off.
§Examples
use ironflow_engine::config::WorkflowOptions;
assert_eq!(WorkflowOptions::new(), WorkflowOptions::default());Sourcepub fn allow_failure(self) -> Self
pub fn allow_failure(self) -> Self
Tolerate a failed child run: the step completes with the failure in its
output and the parent run ends as Warning. A suspension is never
tolerated.
§Examples
use ironflow_engine::config::WorkflowOptions;
assert!(WorkflowOptions::new().allow_failure().allow_failure);Sourcepub fn concurrency_key(self, key: impl Into<String>) -> Self
pub fn concurrency_key(self, key: impl Into<String>) -> Self
Make the child run exclusive on key.
While another non-terminal run (Pending, Running, Retrying, Sleeping,
AwaitingApproval) holds the same key, no child run is created and the
step completes with a
SubWorkflowOutcome::Conflict.
§Panics
Panics if key is empty or only whitespace, or longer than
MAX_CONCURRENCY_KEY_LEN bytes.
§Examples
use ironflow_engine::config::WorkflowOptions;
let options = WorkflowOptions::new().concurrency_key("issue:12");
assert_eq!(options.concurrency_key_ref(), Some("issue:12"));use ironflow_engine::config::WorkflowOptions;
WorkflowOptions::new().concurrency_key(" ");Sourcepub fn concurrency_key_ref(&self) -> Option<&str>
pub fn concurrency_key_ref(&self) -> Option<&str>
The concurrency key, if one was set.
§Examples
use ironflow_engine::config::WorkflowOptions;
let options = WorkflowOptions::new().concurrency_key("deploy:prod");
assert_eq!(options.concurrency_key_ref(), Some("deploy:prod"));Sourcepub fn priority(self, priority: i16) -> Self
pub fn priority(self, priority: i16) -> Self
Set the queue priority of the child run, overriding the priority of the child handler.
The child executes inside its parent’s worker; the priority is recorded on the child run and orders it whenever it waits in the queue.
§Panics
Panics if priority is outside
MIN_PRIORITY..=MAX_PRIORITY.
§Examples
use ironflow_engine::config::WorkflowOptions;
let options = WorkflowOptions::new().priority(20);
assert_eq!(options.priority_ref(), Some(20));use ironflow_engine::config::WorkflowOptions;
WorkflowOptions::new().priority(101);Sourcepub fn priority_ref(&self) -> Option<i16>
pub fn priority_ref(&self) -> Option<i16>
The priority of the child run, if one was set.
§Examples
use ironflow_engine::config::WorkflowOptions;
assert_eq!(WorkflowOptions::new().priority_ref(), None);
assert_eq!(WorkflowOptions::new().priority(-5).priority_ref(), Some(-5));Sourcepub fn step_name(self, name: impl Into<String>) -> Self
pub fn step_name(self, name: impl Into<String>) -> Self
Name the Workflow step of the parent run.
The step is named after the child handler by default. The name is what the run timeline shows and what identifies the step on resume: a handler that delegates to the same child several times gives each call its own name.
§Panics
Panics if name is empty or only whitespace.
§Examples
use ironflow_engine::config::WorkflowOptions;
let options = WorkflowOptions::new().step_name("delegate-1-alice");
assert_eq!(options.step_name_ref(), Some("delegate-1-alice"));use ironflow_engine::config::WorkflowOptions;
WorkflowOptions::new().step_name(" ");Sourcepub fn step_name_ref(&self) -> Option<&str>
pub fn step_name_ref(&self) -> Option<&str>
The step name, if one was set.
§Examples
use ironflow_engine::config::WorkflowOptions;
assert_eq!(WorkflowOptions::new().step_name_ref(), None);Sourcepub fn label(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn label(self, key: impl Into<String>, value: impl Into<String>) -> Self
Set a label on the child run.
The child inherits the labels of its parent run; a label set here replaces an inherited one with the same key. The last value set for a key wins.
§Panics
Panics if key starts with ironflow.io/: those labels link the child
to its parent and root runs and are set by the engine.
§Examples
use ironflow_engine::config::WorkflowOptions;
let options = WorkflowOptions::new().label("paperflow.io/agent", "alice");
assert_eq!(options.labels_ref()["paperflow.io/agent"], "alice");use ironflow_engine::config::WorkflowOptions;
WorkflowOptions::new().label("ironflow.io/parent-run-id", "x");Sourcepub fn labels<K, V>(self, labels: impl IntoIterator<Item = (K, V)>) -> Self
pub fn labels<K, V>(self, labels: impl IntoIterator<Item = (K, V)>) -> Self
Set several labels on the child run, as label does
for each pair in order.
§Panics
Panics if a key starts with ironflow.io/.
§Examples
use ironflow_engine::config::WorkflowOptions;
let options = WorkflowOptions::new().labels([("tour", "1"), ("agent", "alice")]);
assert_eq!(options.labels_ref().len(), 2);Trait Implementations§
Source§impl Clone for WorkflowOptions
impl Clone for WorkflowOptions
Source§impl Debug for WorkflowOptions
impl Debug for WorkflowOptions
Source§impl Default for WorkflowOptions
impl Default for WorkflowOptions
impl Eq for WorkflowOptions
Source§impl PartialEq for WorkflowOptions
impl PartialEq for WorkflowOptions
impl StructuralPartialEq for WorkflowOptions
Auto Trait Implementations§
impl Freeze for WorkflowOptions
impl RefUnwindSafe for WorkflowOptions
impl Send for WorkflowOptions
impl Sync for WorkflowOptions
impl Unpin for WorkflowOptions
impl UnsafeUnpin for WorkflowOptions
impl UnwindSafe for WorkflowOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.