Skip to main content

WorkflowOptions

Struct WorkflowOptions 

Source
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: bool

Tolerate a failed child run instead of failing the parent.

Implementations§

Source§

impl WorkflowOptions

Source

pub fn new() -> Self

Create options with every flag off.

§Examples
use ironflow_engine::config::WorkflowOptions;

assert_eq!(WorkflowOptions::new(), WorkflowOptions::default());
Source

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);
Source

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("  ");
Source

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"));
Source

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);
Source

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));
Source

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(" ");
Source

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);
Source

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");
Source

pub fn labels<K, V>(self, labels: impl IntoIterator<Item = (K, V)>) -> Self
where K: Into<String>, V: Into<String>,

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);
Source

pub fn labels_ref(&self) -> &HashMap<String, String>

The labels set on the child run.

§Examples
use ironflow_engine::config::WorkflowOptions;

assert!(WorkflowOptions::new().labels_ref().is_empty());

Trait Implementations§

Source§

impl Clone for WorkflowOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WorkflowOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WorkflowOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for WorkflowOptions

Source§

impl PartialEq for WorkflowOptions

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for WorkflowOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more