<!-- # hard line break macro for HTML -->

# fiftyone.operators.delegated

FiftyOne delegated operations.

Copyright 2017-2026, Voxel51, Inc.
<br/>
[voxel51.com](https://voxel51.com/)
<br/>
<br/>

**Classes:**

| [`DelegatedOperationService`](#fiftyone.operators.delegated.DelegatedOperationService)([repo])   | Service for executing delegated operations.   |
|--------------------------------------------------------------------------------------------------|-----------------------------------------------|

### *class* fiftyone.operators.delegated.DelegatedOperationService(repo=None)

Bases: `object`

Service for executing delegated operations.

**Methods:**

| [`queue_operation`](#fiftyone.operators.delegated.DelegatedOperationService.queue_operation)(operator[, label, ...])                 | Queues the given delegated operation for execution.                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
|--------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`set_progress`](#fiftyone.operators.delegated.DelegatedOperationService.set_progress)(doc_id, progress)                             | Sets the progress of the given delegated operation.                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [`set_running`](#fiftyone.operators.delegated.DelegatedOperationService.set_running)(doc_id[, progress, run_link, ...])              | Sets the given delegated operation to running state.                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [`set_scheduled`](#fiftyone.operators.delegated.DelegatedOperationService.set_scheduled)(doc_id[, required_state])                   | Sets the given delegated operation to scheduled state. :param doc_id: the ID of the delegated operation :param required_state: an optional                        [`fiftyone.operators.executor.ExecutionRunState`](fiftyone.operators.executor.md#fiftyone.operators.executor.ExecutionRunState) required                        state of the operation. If provided, the update will only be                        performed if the referenced operation matches this state. :type required_state: None. |
| [`set_queued`](#fiftyone.operators.delegated.DelegatedOperationService.set_queued)(doc_id[, required_state])                         | Sets the given delegated operation to queued state.                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [`set_completed`](#fiftyone.operators.delegated.DelegatedOperationService.set_completed)(doc_id[, result, progress, ...])            | Sets the given delegated operation to completed state.                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [`set_failed`](#fiftyone.operators.delegated.DelegatedOperationService.set_failed)(doc_id[, result, progress, ...])                  | Sets the given delegated operation to failed state.                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [`set_pinned`](#fiftyone.operators.delegated.DelegatedOperationService.set_pinned)(doc_id[, pinned])                                 | Sets the pinned flag for the given delegated operation.                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| [`set_label`](#fiftyone.operators.delegated.DelegatedOperationService.set_label)(doc_id, label)                                      | Sets the pinned flag for the given delegated operation.                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| [`archive_operation`](#fiftyone.operators.delegated.DelegatedOperationService.archive_operation)(doc_id)                             | Archives the given delegated operation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| [`unarchive_operation`](#fiftyone.operators.delegated.DelegatedOperationService.unarchive_operation)(doc_id)                         | Unarchives the given delegated operation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [`delete_operation`](#fiftyone.operators.delegated.DelegatedOperationService.delete_operation)(doc_id)                               | Deletes the given delegated operation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [`delete_for_dataset`](#fiftyone.operators.delegated.DelegatedOperationService.delete_for_dataset)(dataset_id)                       | Deletes all delegated operations associated with the given dataset.                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [`rerun_operation`](#fiftyone.operators.delegated.DelegatedOperationService.rerun_operation)(doc_id)                                 | Reruns the specified delegated operation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [`get_queued_operations`](#fiftyone.operators.delegated.DelegatedOperationService.get_queued_operations)([operator, dataset_name])   | Returns all queued delegated operations.                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [`get_scheduled_operations`](#fiftyone.operators.delegated.DelegatedOperationService.get_scheduled_operations)([operator, ...])      | Returns all scheduled delegated operations. :param operator: the optional name of the operator to return all                  the scheduled delegated operations for :type operator: None :param dataset_name: the optional name of the dataset to return all                      the scheduled delegated operations for :type dataset_name: None.                                                                                                                                                         |
| [`get_running_operations`](#fiftyone.operators.delegated.DelegatedOperationService.get_running_operations)([operator, dataset_name]) | Returns all running delegated operations. :param operator: the optional name of the operator to return all                  the running delegated operations for :type operator: None :param dataset_name: the optional name of the dataset to return all                      the running delegated operations for :type dataset_name: None.                                                                                                                                                               |
| [`get`](#fiftyone.operators.delegated.DelegatedOperationService.get)(doc_id)                                                         | Returns the delegated operation with the given ID.                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [`list_operations`](#fiftyone.operators.delegated.DelegatedOperationService.list_operations)([operator, dataset_name, ...])          | Lists the delegated operations matching the given criteria.                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [`execute_queued_operations`](#fiftyone.operators.delegated.DelegatedOperationService.execute_queued_operations)([operator, ...])    | Executes queued delegated operations matching the given criteria.                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| [`count`](#fiftyone.operators.delegated.DelegatedOperationService.count)([filters, search])                                          | Counts the delegated operations matching the given criteria.                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [`execute_operation`](#fiftyone.operators.delegated.DelegatedOperationService.execute_operation)(operation[, log, ...])              | Executes the given delegated operation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

#### queue_operation(operator, label=None, delegation_target=None, context=None, metadata=None, pipeline=None, rerunnable=True)

Queues the given delegated operation for execution.

* **Parameters:**
  * **operator** – the operator name
  * **delegation_target** (*None*) – an optional delegation target
  * **label** (*None*) – an optional label for the operation (will default to
    the operator if not supplied)
  * **context** (*None*) – an
    [`fiftyone.operators.executor.ExecutionContext`](fiftyone.operators.executor.md#fiftyone.operators.executor.ExecutionContext)
  * **metadata** (*None*) – an optional metadata dict containing properties below:
    - inputs_schema: the schema of the operator’s inputs
    - outputs_schema: the schema of the operator’s outputs
  * **pipeline** (*None*) – an optional
    [`fiftyone.operators.types.Pipeline`](fiftyone.operators.types.md#fiftyone.operators.types.Pipeline) to use for
    the operation, if this is a pipeline operator
  * **rerunnable** (*True*) – whether the operation can be rerun
* **Returns:**
  a `fiftyone.factory.repos.DelegatedOperationDocument`

#### set_progress(doc_id, progress)

Sets the progress of the given delegated operation.

* **Parameters:**
  * **doc_id** – the ID of the delegated operation
  * **progress** – the
    [`fiftyone.operators.executor.ExecutionProgress`](fiftyone.operators.executor.md#fiftyone.operators.executor.ExecutionProgress) of the
    operation
* **Returns:**
  a `fiftyone.factory.repos.DelegatedOperationDocument`

#### set_running(doc_id, progress=None, run_link=None, required_state=None, monitored=False)

Sets the given delegated operation to running state.

* **Parameters:**
  * **doc_id** – the ID of the delegated operation
  * **progress** (*None*) – an optional
    [`fiftyone.operators.executor.ExecutionProgress`](fiftyone.operators.executor.md#fiftyone.operators.executor.ExecutionProgress) of the
    operation
  * **run_link** (*None*) – an optional link to orchestrator-specific
    information about the operation
  * **required_state** (*None*) – an optional
    [`fiftyone.operators.executor.ExecutionRunState`](fiftyone.operators.executor.md#fiftyone.operators.executor.ExecutionRunState) required
    state of the operation. If provided, the update will only be
    performed if the referenced operation matches this state.
  * **monitored** (*False*) – whether the operation is being monitored by
    an external process
* **Returns:**
  a `fiftyone.factory.repos.DelegatedOperationDocument` if the
  : update was performed, else `None`.

#### set_scheduled(doc_id, required_state=None)

Sets the given delegated operation to scheduled state.
:param doc_id: the ID of the delegated operation
:param required_state: an optional

> [`fiftyone.operators.executor.ExecutionRunState`](fiftyone.operators.executor.md#fiftyone.operators.executor.ExecutionRunState) required
> state of the operation. If provided, the update will only be
> performed if the referenced operation matches this state.
* **Returns:**
  a `fiftyone.factory.repos.DelegatedOperationDocument` if the
  : update was performed, else `None`.

#### set_queued(doc_id, required_state=None)

Sets the given delegated operation to queued state.

* **Parameters:**
  * **doc_id** – the ID of the delegated operation
  * **required_state** (*None*) – an optional
    [`fiftyone.operators.executor.ExecutionRunState`](fiftyone.operators.executor.md#fiftyone.operators.executor.ExecutionRunState) required
    state of the operation. If provided, the update will only be
    performed if the referenced operation matches this state.
* **Returns:**
  a `fiftyone.factory.repos.DelegatedOperationDocument` if the
  : update was performed, else `None`.

#### set_completed(doc_id, result=None, progress=None, run_link=None, required_state=None)

Sets the given delegated operation to completed state.

* **Parameters:**
  * **doc_id** – the ID of the delegated operation
  * **result** (*None*) – the
    [`fiftyone.operators.executor.ExecutionResult`](fiftyone.operators.executor.md#fiftyone.operators.executor.ExecutionResult) of the
    operation
  * **progress** (*None*) – an optional
    [`fiftyone.operators.executor.ExecutionProgress`](fiftyone.operators.executor.md#fiftyone.operators.executor.ExecutionProgress) of the
    operation
  * **run_link** (*None*) – an optional link to orchestrator-specific
    information about the operation
  * **required_state** (*None*) – an optional
    [`fiftyone.operators.executor.ExecutionRunState`](fiftyone.operators.executor.md#fiftyone.operators.executor.ExecutionRunState) required
    state of the operation. If provided, the update will only be
    performed if the referenced operation matches this state.
* **Returns:**
  a `fiftyone.factory.repos.DelegatedOperationDocument` if the
  : update was performed, else `None`.

#### set_failed(doc_id, result=None, progress=None, run_link=None, required_state=None, update_pipeline=None)

Sets the given delegated operation to failed state.

* **Parameters:**
  * **doc_id** – the ID of the delegated operation
  * **result** (*None*) – the
    [`fiftyone.operators.executor.ExecutionResult`](fiftyone.operators.executor.md#fiftyone.operators.executor.ExecutionResult) of the
    operation
  * **progress** (*None*) – an optional
    [`fiftyone.operators.executor.ExecutionProgress`](fiftyone.operators.executor.md#fiftyone.operators.executor.ExecutionProgress) of the
    operation
  * **run_link** (*None*) – an optional link to orchestrator-specific
    information about the operation
  * **required_state** (*None*) – an optional
    [`fiftyone.operators.executor.ExecutionRunState`](fiftyone.operators.executor.md#fiftyone.operators.executor.ExecutionRunState) required
    state of the operation. If provided, the update will only be
    performed if the referenced operation matches this state.
  * **update_pipeline** (*None*) – an optional ID of the parent
    operation to update with this failure message, applicable only
    for pipeline children. If provided, the parent operation will
    NOT be marked as failed, but the error message will be recorded
    in its pipeline run info.
* **Returns:**
  a `fiftyone.factory.repos.DelegatedOperationDocument` if the
  : update was performed, else `None`.

#### set_pinned(doc_id, pinned=True)

Sets the pinned flag for the given delegated operation.

* **Parameters:**
  * **doc_id** – the ID of the delegated operation
  * **pinned** (*True*) – the boolean pinned flag
* **Returns:**
  a `fiftyone.factory.repos.DelegatedOperationDocument`

#### set_label(doc_id, label)

Sets the pinned flag for the given delegated operation.

* **Parameters:**
  * **doc_id** – the ID of the delegated operation
  * **label** – the label to set
* **Returns:**
  a `fiftyone.factory.repos.DelegatedOperationDocument`

#### archive_operation(doc_id)

Archives the given delegated operation.

* **Parameters:**
  **doc_id** – the ID of the delegated operation
* **Returns:**
  a `fiftyone.factory.repos.DelegatedOperationDocument`

#### unarchive_operation(doc_id)

Unarchives the given delegated operation.

* **Parameters:**
  **doc_id** – the ID of the delegated operation
* **Returns:**
  a `fiftyone.factory.repos.DelegatedOperationDocument`

#### delete_operation(doc_id)

Deletes the given delegated operation.

* **Parameters:**
  **doc_id** – the ID of the delegated operation
* **Returns:**
  a `fiftyone.factory.repos.DelegatedOperationDocument`

#### delete_for_dataset(dataset_id)

Deletes all delegated operations associated with the given dataset.

* **Parameters:**
  **dataset_id** – the ID of the dataset

#### rerun_operation(doc_id)

Reruns the specified delegated operation.

* **Parameters:**
  **doc_id** – the ID of the delegated operation
* **Returns:**
  a `fiftyone.factory.repos.DelegatedOperationDocument`

#### get_queued_operations(operator=None, dataset_name=None)

Returns all queued delegated operations.

* **Parameters:**
  * **operator** (*None*) – the optional name of the operator to return all
    the queued delegated operations for
  * **dataset_name** (*None*) – the optional name of the dataset to return all
    the queued delegated operations for
* **Returns:**
  a list of `fiftyone.factory.repos.DelegatedOperationDocument`

#### get_scheduled_operations(operator=None, dataset_name=None)

Returns all scheduled delegated operations.
:param operator: the optional name of the operator to return all

> the scheduled delegated operations for
* **Parameters:**
  **dataset_name** (*None*) – the optional name of the dataset to return all
  the scheduled delegated operations for
* **Returns:**
  a list of `fiftyone.factory.repos.DelegatedOperationDocument`

#### get_running_operations(operator=None, dataset_name=None)

Returns all running delegated operations.
:param operator: the optional name of the operator to return all

> the running delegated operations for
* **Parameters:**
  **dataset_name** (*None*) – the optional name of the dataset to return all
  the running delegated operations for
* **Returns:**
  a list of `fiftyone.factory.repos.DelegatedOperationDocument`

#### get(doc_id)

Returns the delegated operation with the given ID.

* **Parameters:**
  **doc_id** – the ID of the delegated operation
* **Returns:**
  a `fiftyone.factory.repos.DelegatedOperationDocument`

#### list_operations(operator=None, dataset_name=None, dataset_id=None, run_state=None, delegation_target=None, paging=None, search=None, include_archived=False, \*\*kwargs)

Lists the delegated operations matching the given criteria.

* **Parameters:**
  * **operator** (*None*) – the optional name of the operator to return all
    the delegated operations for
  * **dataset_name** (*None*) – the optional name of the dataset to return all
    the delegated operations for
  * **dataset_id** (*None*) – the optional id of the dataset to return all the
    delegated operations for
  * **run_state** (*None*) – the optional run state of the delegated
    operations to return
  * **delegation_target** (*None*) – the optional delegation target of the
    delegated operations to return
  * **paging** (*None*) – optional
    [`fiftyone.factory.DelegatedOperationPagingParams`](fiftyone.factory.md#fiftyone.factory.DelegatedOperationPagingParams)
  * **search** (*None*) – optional search term dict
  * **include_archived** (*False*) – whether to include archived operations
* **Returns:**
  a list of `fiftyone.factory.repos.DelegatedOperationDocument`

#### execute_queued_operations(operator=None, delegation_target=None, dataset_name=None, limit=None, log=False, monitor=False, check_interval_seconds=60, \*\*kwargs)

Executes queued delegated operations matching the given criteria.

* **Parameters:**
  * **operator** (*None*) – the optional name of the operator to execute all
    the queued delegated operations for
  * **delegation_target** (*None*) – the optional delegation target of the
    delegated operations to execute
  * **dataset_name** (*None*) – the optional name of the dataset to execute
    all the queued delegated operations for
  * **limit** (*None*) – the optional limit of the number of delegated
    operations to execute
  * **log** (*False*) – the optional boolean flag to log the execution of the
    delegated operations
  * **monitor** (*False*) – if we should monitor the state of the operator in a subprocess.
  * **check_interval_seconds** (*60*) – how many seconds to wait between polling operator status.

#### count(filters=None, search=None)

Counts the delegated operations matching the given criteria.

* **Parameters:**
  * **filters** (*None*) – a filter dict
  * **search** (*None*) – a search term dict
* **Returns:**
  the number of matching operations

#### execute_operation(operation, log=False, run_link=None, monitor=False, check_interval_seconds=60)

Executes the given delegated operation.

* **Parameters:**
  * **operation** – the
    `fiftyone.factory.repos.DelegatedOperationDocument`
  * **log** (*False*) – the optional boolean flag to log the execution of the
    delegated operations
  * **run_link** (*None*) – an optional link to orchestrator-specific
    information about the operation
  * **monitor** (*False*) – if we should monitor the state of the operator in a subprocess.
  * **check_interval_seconds** (*60*) – how many seconds to wait between polling operator status.
