Skip to main content

Task

Struct Task 

Source
pub struct Task {
Show 30 fields pub task_id: String, pub task_type: String, pub reference_task_name: String, pub status: TaskStatus, pub input_data: HashMap<String, Value>, pub output_data: HashMap<String, Value>, pub workflow_instance_id: String, pub workflow_type: String, pub task_def_name: String, pub retry_count: i32, pub poll_count: i32, pub worker_id: Option<String>, pub domain: Option<String>, pub scheduled_time: i64, pub start_time: i64, pub end_time: i64, pub update_time: i64, pub queue_wait_time: i64, pub callback_after_seconds: i64, pub response_timeout_seconds: i64, pub execution_name_space: Option<String>, pub isolation_group_id: Option<String>, pub correlation_id: Option<String>, pub reason_for_incompletion: Option<String>, pub external_input_payload_storage_path: Option<String>, pub external_output_payload_storage_path: Option<String>, pub logs: Vec<TaskExecLog>, pub sub_workflow_id: Option<String>, pub iteration: i32, pub runtime_metadata: HashMap<String, String>,
}
Expand description

A task in a Conductor workflow.

Fields§

§task_id: String

Unique task ID.

§task_type: String

Task type/definition name.

§reference_task_name: String

Reference name within the workflow.

§status: TaskStatus

Task status.

§input_data: HashMap<String, Value>

Input data for the task.

§output_data: HashMap<String, Value>

Output data from the task.

§workflow_instance_id: String

Workflow instance ID this task belongs to.

§workflow_type: String

Workflow type/name.

§task_def_name: String

Task definition name.

§retry_count: i32

Current retry count.

§poll_count: i32

Poll count (for long-running tasks).

§worker_id: Option<String>

Worker that picked up this task.

§domain: Option<String>

Domain the task is running in.

§scheduled_time: i64

Scheduled time (epoch ms or ISO 8601 string).

§start_time: i64

Start time (epoch ms or ISO 8601 string).

§end_time: i64

End time (epoch ms or ISO 8601 string).

§update_time: i64

Update time (epoch ms or ISO 8601 string).

§queue_wait_time: i64

Queue wait time (ms).

§callback_after_seconds: i64

Callback after seconds (for IN_PROGRESS tasks).

§response_timeout_seconds: i64

Response timeout seconds.

§execution_name_space: Option<String>

Execution namespace ID.

§isolation_group_id: Option<String>

Isolation group ID.

§correlation_id: Option<String>

Correlation ID.

§reason_for_incompletion: Option<String>

Reason for failure (if failed).

§external_input_payload_storage_path: Option<String>

External input payload storage path.

§external_output_payload_storage_path: Option<String>

External output payload storage path.

§logs: Vec<TaskExecLog>

Task execution logs.

§sub_workflow_id: Option<String>

Subworkflow ID (if this is a subworkflow task).

§iteration: i32

Iteration count (for loop tasks).

§runtime_metadata: HashMap<String, String>

Server-resolved credential values for this poll, keyed by declared name. Read via [crate::agents::Credentials::from_task] rather than directly. May contain secrets – see the manual std::fmt::Debug impl below, which redacts values.

Implementations§

Source§

impl Task

Source

pub fn get_input<T>(&self, key: &str) -> Option<T>

Get a typed input value.

Source

pub fn get_input_string(&self, key: &str) -> Option<String>

Get input as string.

Source

pub fn is_terminal(&self) -> bool

Check if task is terminal (completed, failed, etc.)

Source

pub fn context(&self) -> TaskContext

Get task context for accessing task metadata.

Provides convenient access to task ID, workflow ID, poll count, etc.

§Example
use conductor::models::Task;

fn process_task(task: &Task) {
    let ctx = task.context();
     
    println!("Task ID: {}", ctx.task_id());
    println!("Workflow ID: {}", ctx.workflow_instance_id());
    println!("Poll count: {}", ctx.poll_count());
     
    if ctx.is_first_poll() {
        println!("This is the first poll");
    }
}
Source

pub fn task_id(&self) -> &str

Get the task ID.

Source

pub fn workflow_instance_id(&self) -> &str

Get the workflow instance ID.

Source

pub fn poll_count(&self) -> i32

Get the poll count.

Source

pub fn retry_count(&self) -> i32

Get the retry count.

Source

pub fn is_first_poll(&self) -> bool

Check if this is the first poll (poll_count == 0).

Source

pub fn is_retry(&self) -> bool

Check if this is a retry (retry_count > 0).

Trait Implementations§

Source§

impl Clone for Task

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 Task

Source§

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

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

impl Default for Task

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Task

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Task

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Task

§

impl RefUnwindSafe for Task

§

impl Send for Task

§

impl Sync for Task

§

impl Unpin for Task

§

impl UnsafeUnpin for Task

§

impl UnwindSafe for Task

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<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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

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

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> 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<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