pub struct TaskClient { /* private fields */ }Expand description
Client for task operations (polling and updates).
Implementations§
Source§impl TaskClient
impl TaskClient
Sourcepub async fn poll_task(
&self,
task_type: &str,
worker_id: Option<&str>,
domain: Option<&str>,
) -> Result<Option<Task>>
pub async fn poll_task( &self, task_type: &str, worker_id: Option<&str>, domain: Option<&str>, ) -> Result<Option<Task>>
Poll for a single task.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn batch_poll(
&self,
task_type: &str,
worker_id: Option<&str>,
domain: Option<&str>,
count: usize,
timeout: Duration,
) -> Result<Vec<Task>>
pub async fn batch_poll( &self, task_type: &str, worker_id: Option<&str>, domain: Option<&str>, count: usize, timeout: Duration, ) -> Result<Vec<Task>>
Batch poll for multiple tasks.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn update_task(&self, result: &TaskResult) -> Result<String>
pub async fn update_task(&self, result: &TaskResult) -> Result<String>
Update a task result.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn update_task_with_retry(
&self,
result: &TaskResult,
max_attempts: u32,
) -> Result<String>
pub async fn update_task_with_retry( &self, result: &TaskResult, max_attempts: u32, ) -> Result<String>
Update task with retry logic.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn get_task(&self, task_id: &str) -> Result<Task>
pub async fn get_task(&self, task_id: &str) -> Result<Task>
Get task by ID.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn get_tasks_in_progress(
&self,
task_type: &str,
start_key: Option<&str>,
count: Option<i32>,
) -> Result<Vec<Task>>
pub async fn get_tasks_in_progress( &self, task_type: &str, start_key: Option<&str>, count: Option<i32>, ) -> Result<Vec<Task>>
Get tasks in progress for a task type.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn add_task_log(&self, task_id: &str, log: &str) -> Result<()>
pub async fn add_task_log(&self, task_id: &str, log: &str) -> Result<()>
Add a log to a task.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn get_task_logs(&self, task_id: &str) -> Result<Vec<TaskExecLog>>
pub async fn get_task_logs(&self, task_id: &str) -> Result<Vec<TaskExecLog>>
Get logs for a task.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn get_queue_sizes(
&self,
task_types: &[&str],
) -> Result<HashMap<String, i64>>
pub async fn get_queue_sizes( &self, task_types: &[&str], ) -> Result<HashMap<String, i64>>
Get task queue sizes.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, or an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status.
Sourcepub async fn remove_task_from_queue(
&self,
task_type: &str,
task_id: &str,
) -> Result<()>
pub async fn remove_task_from_queue( &self, task_type: &str, task_id: &str, ) -> Result<()>
Remove task from queue.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, or an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status.
Sourcepub async fn update_task_by_ref_name(
&self,
workflow_id: &str,
task_ref_name: &str,
status: TaskResultStatus,
output: Value,
worker_id: Option<&str>,
) -> Result<String>
pub async fn update_task_by_ref_name( &self, workflow_id: &str, task_ref_name: &str, status: TaskResultStatus, output: Value, worker_id: Option<&str>, ) -> Result<String>
Update task by reference name.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn update_task_sync(
&self,
workflow_id: &str,
task_ref_name: &str,
status: TaskResultStatus,
output: Value,
worker_id: Option<&str>,
) -> Result<Workflow>
pub async fn update_task_sync( &self, workflow_id: &str, task_ref_name: &str, status: TaskResultStatus, output: Value, worker_id: Option<&str>, ) -> Result<Workflow>
Update task synchronously and return the updated workflow.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn get_queue_size_for_task(&self, task_type: &str) -> Result<i64>
pub async fn get_queue_size_for_task(&self, task_type: &str) -> Result<i64>
Get queue size for a specific task type.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn get_task_poll_data(&self, task_type: &str) -> Result<Vec<PollData>>
pub async fn get_task_poll_data(&self, task_type: &str) -> Result<Vec<PollData>>
Get poll data for a task type.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn get_all_poll_data(&self) -> Result<Vec<PollData>>
pub async fn get_all_poll_data(&self) -> Result<Vec<PollData>>
Get all poll data.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn get_poll_data(&self, task_type: &str) -> Result<Vec<PollData>>
pub async fn get_poll_data(&self, task_type: &str) -> Result<Vec<PollData>>
Get poll data (alias for get_task_poll_data).
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn search_tasks(
&self,
query: Option<&str>,
free_text: Option<&str>,
start: i32,
size: i32,
) -> Result<SearchResult<Task>>
pub async fn search_tasks( &self, query: Option<&str>, free_text: Option<&str>, start: i32, size: i32, ) -> Result<SearchResult<Task>>
Search for tasks.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn search_tasks_v2(
&self,
query: Option<&str>,
free_text: Option<&str>,
start: i32,
size: i32,
) -> Result<SearchResult<Task>>
pub async fn search_tasks_v2( &self, query: Option<&str>, free_text: Option<&str>, start: i32, size: i32, ) -> Result<SearchResult<Task>>
Search for tasks V2 (returns full task objects).
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn requeue_pending_tasks(&self, task_type: &str) -> Result<String>
pub async fn requeue_pending_tasks(&self, task_type: &str) -> Result<String>
Requeue pending tasks.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.