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: StringUnique task ID.
task_type: StringTask type/definition name.
reference_task_name: StringReference name within the workflow.
status: TaskStatusTask status.
input_data: HashMap<String, Value>Input data for the task.
output_data: HashMap<String, Value>Output data from the task.
workflow_instance_id: StringWorkflow instance ID this task belongs to.
workflow_type: StringWorkflow type/name.
task_def_name: StringTask definition name.
retry_count: i32Current retry count.
poll_count: i32Poll 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: i64Scheduled time (epoch ms or ISO 8601 string).
start_time: i64Start time (epoch ms or ISO 8601 string).
end_time: i64End time (epoch ms or ISO 8601 string).
update_time: i64Update time (epoch ms or ISO 8601 string).
queue_wait_time: i64Queue wait time (ms).
callback_after_seconds: i64Callback after seconds (for IN_PROGRESS tasks).
response_timeout_seconds: i64Response 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: i32Iteration 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
impl Task
Sourcepub fn get_input<T>(&self, key: &str) -> Option<T>where
T: DeserializeOwned,
pub fn get_input<T>(&self, key: &str) -> Option<T>where
T: DeserializeOwned,
Get a typed input value.
Sourcepub fn get_input_string(&self, key: &str) -> Option<String>
pub fn get_input_string(&self, key: &str) -> Option<String>
Get input as string.
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Check if task is terminal (completed, failed, etc.)
Sourcepub fn context(&self) -> TaskContext
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");
}
}Sourcepub fn workflow_instance_id(&self) -> &str
pub fn workflow_instance_id(&self) -> &str
Get the workflow instance ID.
Sourcepub fn poll_count(&self) -> i32
pub fn poll_count(&self) -> i32
Get the poll count.
Sourcepub fn retry_count(&self) -> i32
pub fn retry_count(&self) -> i32
Get the retry count.
Sourcepub fn is_first_poll(&self) -> bool
pub fn is_first_poll(&self) -> bool
Check if this is the first poll (poll_count == 0).