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

# fiftyone.operators.executor

FiftyOne operator execution.

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

**Classes:**

| [`ExecutionRunState`](#fiftyone.operators.executor.ExecutionRunState)()                                 | Enumeration of the available operator run states.      |
|---------------------------------------------------------------------------------------------------------|--------------------------------------------------------|
| [`InvocationRequest`](#fiftyone.operators.executor.InvocationRequest)(operator_uri[, params])           | Represents a request to invoke an operator.            |
| [`ExecutionProgress`](#fiftyone.operators.executor.ExecutionProgress)([progress, label])                | Represents the status of an operator execution.        |
| [`Executor`](#fiftyone.operators.executor.Executor)([requests, logs])                                   | Handles the execution phase of the operator lifecycle. |
| [`ExecutionContext`](#fiftyone.operators.executor.ExecutionContext)([request_params, executor, ...])    | Represents the execution context of an operator.       |
| [`ExecutionResult`](#fiftyone.operators.executor.ExecutionResult)([result, executor, error, ...])       | Represents the result of an operator execution.        |
| [`PipelineExecutionContext`](#fiftyone.operators.executor.PipelineExecutionContext)(active, ...[, ...]) | Represents the execution context of a pipeline.        |
| [`ValidationError`](#fiftyone.operators.executor.ValidationError)(reason, property, path[, custom])     | A validation error.                                    |
| [`ValidationContext`](#fiftyone.operators.executor.ValidationContext)(ctx, inputs_property, operator)   | Represents the validation context of an operator.      |
| [`ExecutionOptions`](#fiftyone.operators.executor.ExecutionOptions)([...])                              | Represents the execution options of an operation.      |

**Functions:**

| [`execute_operator`](#fiftyone.operators.executor.execute_operator)(operator_uri[, ctx])                       | Executes the operator with the given name.                                       |
|----------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|
| [`execute_or_delegate_operator`](#fiftyone.operators.executor.execute_or_delegate_operator)(operator_uri, ...) | Executes the operator with the given name.                                       |
| [`prepare_operator_executor`](#fiftyone.operators.executor.prepare_operator_executor)(operator_uri, ...)       |                                                                                  |
| [`do_execute_operator`](#fiftyone.operators.executor.do_execute_operator)(operator, ctx[, exhaust])            |                                                                                  |
| [`do_execute_pipeline`](#fiftyone.operators.executor.do_execute_pipeline)(pipeline, ctx)                       | Executes the given pipeline in sequence.                                         |
| [`resolve_type`](#fiftyone.operators.executor.resolve_type)(registry, operator_uri, ...)                       | Resolves the inputs property type of the operator with the given name.           |
| [`resolve_type_with_context`](#fiftyone.operators.executor.resolve_type_with_context)(operator, context)       | Resolves the "inputs" or "outputs" schema of an operator with the given context. |
| [`resolve_execution_options`](#fiftyone.operators.executor.resolve_execution_options)(registry, ...)           | Resolves the execution options of the operator with the given name.              |
| [`resolve_placement`](#fiftyone.operators.executor.resolve_placement)(operator, request_params)                | Resolves the placement of the operator with the given name.                      |

**Exceptions:**

| [`ExecutionError`](#fiftyone.operators.executor.ExecutionError)   | An error that occurs while executing an operator.   |
|-------------------------------------------------------------------|-----------------------------------------------------|

### *class* fiftyone.operators.executor.ExecutionRunState

Bases: `object`

Enumeration of the available operator run states.

**Attributes:**

| [`SCHEDULED`](#fiftyone.operators.executor.ExecutionRunState.SCHEDULED)             |    |
|-------------------------------------------------------------------------------------|----|
| [`QUEUED`](#fiftyone.operators.executor.ExecutionRunState.QUEUED)                   |    |
| [`RUNNING`](#fiftyone.operators.executor.ExecutionRunState.RUNNING)                 |    |
| [`PROCESSING`](#fiftyone.operators.executor.ExecutionRunState.PROCESSING)           |    |
| [`COMPLETED`](#fiftyone.operators.executor.ExecutionRunState.COMPLETED)             |    |
| [`FAILED`](#fiftyone.operators.executor.ExecutionRunState.FAILED)                   |    |
| [`TERMINAL_STATES`](#fiftyone.operators.executor.ExecutionRunState.TERMINAL_STATES) |    |

#### SCHEDULED *= 'scheduled'*

#### QUEUED *= 'queued'*

#### RUNNING *= 'running'*

#### PROCESSING *= 'processing'*

#### COMPLETED *= 'completed'*

#### FAILED *= 'failed'*

#### TERMINAL_STATES *= {'completed', 'failed'}*

### *class* fiftyone.operators.executor.InvocationRequest(operator_uri, params=None)

Bases: `object`

Represents a request to invoke an operator.

* **Parameters:**
  * **operator_uri** – the URI of the operator to invoke
  * **params** (*None*) – an optional dictionary of parameters

**Methods:**

| [`to_json`](#fiftyone.operators.executor.InvocationRequest.to_json)()   |    |
|-------------------------------------------------------------------------|----|

#### to_json()

### *class* fiftyone.operators.executor.ExecutionProgress(progress=None, label=None)

Bases: `object`

Represents the status of an operator execution.

* **Parameters:**
  * **progress** (*None*) – an optional float between 0 and 1 (0% to 100%)
  * **label** (*None*) – an optional label to display

### *class* fiftyone.operators.executor.Executor(requests=None, logs=None)

Bases: `object`

Handles the execution phase of the operator lifecycle.

* **Parameters:**
  * **requests** (*None*) – an optional list of InvocationRequest objects
  * **logs** (*None*) – an optional list of log messages

**Methods:**

| [`trigger`](#fiftyone.operators.executor.Executor.trigger)(operator_name[, params])   | Triggers an invocation of the operator with the given name.   |
|---------------------------------------------------------------------------------------|---------------------------------------------------------------|
| [`log`](#fiftyone.operators.executor.Executor.log)(message)                           | Logs a message.                                               |
| [`to_json`](#fiftyone.operators.executor.Executor.to_json)()                          |                                                               |

#### trigger(operator_name, params=None)

Triggers an invocation of the operator with the given name.

* **Parameters:**
  * **operator_name** – the name of the operator
  * **params** (*None*) – a dictionary of parameters for the operator
* **Returns:**
  a [`fiftyone.operators.message.GeneratedMessage`](fiftyone.operators.message.md#fiftyone.operators.message.GeneratedMessage) containing
  instructions for the FiftyOne App to invoke the operator

#### log(message)

Logs a message.

#### to_json()

### fiftyone.operators.executor.execute_operator(operator_uri, ctx=None, \*\*kwargs)

Executes the operator with the given name.

* **Parameters:**
  * **operator_uri** – the URI of the operator
  * **ctx** (*None*) – 

    a dictionary of parameters defining the execution context.
    The supported keys are:
    - `dataset`: a [`fiftyone.core.dataset.Dataset`](fiftyone.core.dataset.md#fiftyone.core.dataset.Dataset) or the
      name of a dataset to process. This is required unless a
      `view` is provided
    - `view` (None): an optional
      [`fiftyone.core.view.DatasetView`](fiftyone.core.view.md#fiftyone.core.view.DatasetView) to process
    - `selected` ([]): an optional list of selected sample IDs
    - `selected_labels` ([]): an optional list of selected labels
      in the format returned by
      [`fiftyone.core.session.Session.selected_labels`](fiftyone.core.session.md#fiftyone.core.session.Session.selected_labels)
    - `current_sample` (None): an optional ID of the current sample
      being processed
    - `extended_selection` (None): an optional extended selection
      of the view.
    - `params`: a dictionary of parameters for the operator.
      Consult the operator’s documentation for details
    - `request_delegation` (False): whether to request delegated
      execution, if supported by the operator
    - `delegation_target` (None): an optional orchestrator on which
      to schedule the operation, if it is delegated
    - `active_fields` ([]): a list of active field names
    - `workspace_name` (None): an optional name of the workspace
      to use for the operation
    - `spaces` (None): an optional dictionary defining spaces to
      use for the operation
    - `group_slice` (None): an optional group slice to use for the
      operation’s view. This is only applicable to group datasets
    - `query_performance` (None): whether to enable query
      performance

    > - `num_distributed_tasks` (None): the number of tasks to split

    > > the operation into, if it is delegated.
  * **\*\*kwargs** – you can optionally provide any of the supported `ctx` keys
    as keyword arguments rather than including them in `ctx`
* **Returns:**
  an [`ExecutionResult`](#fiftyone.operators.executor.ExecutionResult), or an `asyncio.Task` if you run this
  method in a notebook context
* **Raises:**
  [**ExecutionError**](#fiftyone.operators.executor.ExecutionError) – if an error occurred while immediately executing an
      operation or scheduling a delegated operation

### *async* fiftyone.operators.executor.execute_or_delegate_operator(operator_uri, request_params, exhaust=False)

Executes the operator with the given name.

* **Parameters:**
  * **operator_uri** – the URI of the operator
  * **request_params** – a dictionary of parameters for the operator
  * **exhaust** (*False*) – whether to immediately exhaust generator operators
* **Returns:**
  an [`ExecutionResult`](#fiftyone.operators.executor.ExecutionResult)

### *async* fiftyone.operators.executor.prepare_operator_executor(operator_uri, request_params, set_progress=None, delegated_operation_id=None, pipeline_ctx=None)

### *async* fiftyone.operators.executor.do_execute_operator(operator, ctx, exhaust=False)

### *async* fiftyone.operators.executor.do_execute_pipeline(pipeline, ctx)

Executes the given pipeline in sequence.

* **Parameters:**
  * **pipeline** – a [`fiftyone.operators.types.Pipeline`](fiftyone.operators.types.md#fiftyone.operators.types.Pipeline)
  * **ctx** – the [`ExecutionContext`](#fiftyone.operators.executor.ExecutionContext) of the pipeline
* **Returns:**
  a tuple of (error, error message string) if an error occurred, or None.
  Pipelines do not return results directly

### *async* fiftyone.operators.executor.resolve_type(registry, operator_uri, request_params)

Resolves the inputs property type of the operator with the given name.

* **Parameters:**
  * **registry** – an [`fiftyone.operators.OperatorRegistry`](fiftyone.operators.md#fiftyone.operators.OperatorRegistry)
  * **operator_uri** – the URI of the operator
  * **request_params** – a dictionary of request parameters
* **Returns:**
  the type of the inputs [`fiftyone.operators.types.Property`](fiftyone.operators.types.md#fiftyone.operators.types.Property) of
  the operator, or None

### *async* fiftyone.operators.executor.resolve_type_with_context(operator, context)

Resolves the “inputs” or “outputs” schema of an operator with the given
context.

* **Parameters:**
  * **operator** – the [`fiftyone.operators.Operator`](fiftyone.operators.md#fiftyone.operators.Operator)
  * **context** – the [`ExecutionContext`](#fiftyone.operators.executor.ExecutionContext) of an operator
* **Returns:**
  the “inputs” or “outputs” schema
  [`fiftyone.operators.types.Property`](fiftyone.operators.types.md#fiftyone.operators.types.Property) of an operator, or None

### *async* fiftyone.operators.executor.resolve_execution_options(registry, operator_uri, request_params)

Resolves the execution options of the operator with the given name.

* **Parameters:**
  * **registry** – an [`fiftyone.operators.registry.OperatorRegistry`](fiftyone.operators.registry.md#fiftyone.operators.registry.OperatorRegistry)
  * **operator_uri** – the URI of the operator
  * **request_params** – a dictionary of request parameters
* **Returns:**
  a [`fiftyone.operators.executor.ExecutionOptions`](#fiftyone.operators.executor.ExecutionOptions) or None

### fiftyone.operators.executor.resolve_placement(operator, request_params)

Resolves the placement of the operator with the given name.

* **Parameters:**
  * **operator** – the [`fiftyone.operators.operator.Operator`](fiftyone.operators.operator.md#fiftyone.operators.operator.Operator)
  * **request_params** – a dictionary of request parameters
* **Returns:**
  the placement of the operator or `None`

### *class* fiftyone.operators.executor.ExecutionContext(request_params=None, executor=None, set_progress=None, delegated_operation_id=None, operator_uri=None, required_secrets=None, pipeline=None)

Bases: `AbstractContextManager`

Represents the execution context of an operator.

Operators can use the execution context to access the view, dataset, and
selected samples, as well as to trigger other operators.

* **Parameters:**
  * **request_params** (*None*) – an optional dictionary of request parameters
  * **executor** (*None*) – an optional [`Executor`](#fiftyone.operators.executor.Executor) instance
  * **set_progress** (*None*) – an optional function to set the progress of the
    current operation
  * **delegated_operation_id** (*None*) – an optional ID of the delegated
    operation
  * **operator_uri** (*None*) – the unique id of the operator
  * **required_secrets** (*None*) – the list of required secrets from the
    plugin’s definition
  * **pipeline** (*None*) – an optional [`PipelineExecutionContext`](#fiftyone.operators.executor.PipelineExecutionContext) with
    information about the current pipeline execution, if this operator
    is being executed as part of a pipeline

**Attributes:**

| [`dataset`](#fiftyone.operators.executor.ExecutionContext.dataset)                                               | The [`fiftyone.core.dataset.Dataset`](fiftyone.core.dataset.md#fiftyone.core.dataset.Dataset) being operated on.                                                                                          |
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`dataset_name`](#fiftyone.operators.executor.ExecutionContext.dataset_name)                                     | The name of the [`fiftyone.core.dataset.Dataset`](fiftyone.core.dataset.md#fiftyone.core.dataset.Dataset) being operated on.                                                                              |
| [`dataset_id`](#fiftyone.operators.executor.ExecutionContext.dataset_id)                                         | The ID of the [`fiftyone.core.dataset.Dataset`](fiftyone.core.dataset.md#fiftyone.core.dataset.Dataset) being operated on.                                                                                |
| [`view`](#fiftyone.operators.executor.ExecutionContext.view)                                                     | The [`fiftyone.core.view.DatasetView`](fiftyone.core.view.md#fiftyone.core.view.DatasetView) being operated on.                                                                                           |
| [`has_custom_view`](#fiftyone.operators.executor.ExecutionContext.has_custom_view)                               | Whether the operator has a custom view.                                                                                                                                                                   |
| [`spaces`](#fiftyone.operators.executor.ExecutionContext.spaces)                                                 | The current spaces layout in the FiftyOne App.                                                                                                                                                            |
| [`selected`](#fiftyone.operators.executor.ExecutionContext.selected)                                             | The list of selected IDs (if any).                                                                                                                                                                        |
| [`selected_samples`](#fiftyone.operators.executor.ExecutionContext.selected_samples)                             | A list of selected sample dicts, if any.                                                                                                                                                                  |
| [`sample_selection_style`](#fiftyone.operators.executor.ExecutionContext.sample_selection_style)                 | The current sample grid selection style config, if any.                                                                                                                                                   |
| [`label_selection_style`](#fiftyone.operators.executor.ExecutionContext.label_selection_style)                   | The current label selection style config (if any).                                                                                                                                                        |
| [`selected_labels`](#fiftyone.operators.executor.ExecutionContext.selected_labels)                               | A list of selected labels (if any).                                                                                                                                                                       |
| [`extended_selection`](#fiftyone.operators.executor.ExecutionContext.extended_selection)                         | The extended selection of the view (if any).                                                                                                                                                              |
| [`current_sample`](#fiftyone.operators.executor.ExecutionContext.current_sample)                                 | The ID of the current sample being processed (if any).                                                                                                                                                    |
| [`active_fields`](#fiftyone.operators.executor.ExecutionContext.active_fields)                                   | The list of currently active fields in the FiftyOne App sidebar.                                                                                                                                          |
| [`active_media_type`](#fiftyone.operators.executor.ExecutionContext.active_media_type)                           | The media type being processed, accounting for the active group slice of grouped datasets.                                                                                                                |
| [`user_id`](#fiftyone.operators.executor.ExecutionContext.user_id)                                               | The ID of the user executing the operation, if known.                                                                                                                                                     |
| [`user_request_token`](#fiftyone.operators.executor.ExecutionContext.user_request_token)                         | The request token authenticating the user executing the operation, if known.                                                                                                                              |
| [`panel_id`](#fiftyone.operators.executor.ExecutionContext.panel_id)                                             | The ID of the panel that invoked the operator, if any.                                                                                                                                                    |
| [`panel_state`](#fiftyone.operators.executor.ExecutionContext.panel_state)                                       | The current panel state.                                                                                                                                                                                  |
| [`panel`](#fiftyone.operators.executor.ExecutionContext.panel)                                                   | A [`fiftyone.operators.panel.PanelRef`](fiftyone.operators.panel.md#fiftyone.operators.panel.PanelRef) instance that you can use to read and write the state and data of the current panel.               |
| [`delegated`](#fiftyone.operators.executor.ExecutionContext.delegated)                                           | Whether the operation was delegated.                                                                                                                                                                      |
| [`requesting_delegated_execution`](#fiftyone.operators.executor.ExecutionContext.requesting_delegated_execution) | Whether delegated execution was requested for the operation.                                                                                                                                              |
| [`delegation_target`](#fiftyone.operators.executor.ExecutionContext.delegation_target)                           | The orchestrator to which the operation was delegated (if any).                                                                                                                                           |
| [`results`](#fiftyone.operators.executor.ExecutionContext.results)                                               | A `dict` of results for the current operation.                                                                                                                                                            |
| [`secrets`](#fiftyone.operators.executor.ExecutionContext.secrets)                                               | A read-only mapping of keys to their resolved values.                                                                                                                                                     |
| [`ops`](#fiftyone.operators.executor.ExecutionContext.ops)                                                       | A [`fiftyone.operators.operations.Operations`](fiftyone.operators.operations.md#fiftyone.operators.operations.Operations) instance that you can use to trigger builtin operations on the current context. |
| [`group_slice`](#fiftyone.operators.executor.ExecutionContext.group_slice)                                       | The current group slice of the view (if any).                                                                                                                                                             |
| [`num_distributed_tasks`](#fiftyone.operators.executor.ExecutionContext.num_distributed_tasks)                   | The number of tasks this job should be split into.                                                                                                                                                        |
| [`query_performance`](#fiftyone.operators.executor.ExecutionContext.query_performance)                           | Whether query performance is enabled.                                                                                                                                                                     |
| [`prompt_id`](#fiftyone.operators.executor.ExecutionContext.prompt_id)                                           | An identifier for the prompt, unique to each instance of a user opening a prompt in the FiftyOne App.                                                                                                     |
| [`operator_uri`](#fiftyone.operators.executor.ExecutionContext.operator_uri)                                     | The URI of the target operator.                                                                                                                                                                           |

**Methods:**

| [`target_view`](#fiftyone.operators.executor.ExecutionContext.target_view)([param_name, require_flat])                       | The target view for the operator being executed.                                                                                                                                               |
|------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`get_unavailable_view_targets`](#fiftyone.operators.executor.ExecutionContext.get_unavailable_view_targets)([require_flat]) | The view targets that this operation cannot process, mapped to the reason why.                                                                                                                 |
| [`view_target`](#fiftyone.operators.executor.ExecutionContext.view_target)([param_name, require_flat])                       | The target view for the operator being executed.                                                                                                                                               |
| [`flatten_group_slices`](#fiftyone.operators.executor.ExecutionContext.flatten_group_slices)([sample_collection, ...])       | Flattens the given grouped collection to the requested slices, or to the active group slice if none are requested.                                                                             |
| [`get_group_slice_scopes`](#fiftyone.operators.executor.ExecutionContext.get_group_slice_scopes)([sample_collection, ...])   | Returns short descriptions of the slice(s) that view-based targets and the dataset target resolve to, so that operator forms and panels can surface the default behavior for grouped datasets. |
| [`prompt`](#fiftyone.operators.executor.ExecutionContext.prompt)(operator_uri[, params, on_success, ...])                    | Prompts the user to execute the operator with the given URI.                                                                                                                                   |
| [`secret`](#fiftyone.operators.executor.ExecutionContext.secret)(key)                                                        | Retrieves the secret with the given key.                                                                                                                                                       |
| [`resolve_secret_values`](#fiftyone.operators.executor.ExecutionContext.resolve_secret_values)(keys, \*\*kwargs)             | Resolves the values of the given secrets keys.                                                                                                                                                 |
| [`trigger`](#fiftyone.operators.executor.ExecutionContext.trigger)(operator_name[, params])                                  | Triggers an invocation of the operator with the given name.                                                                                                                                    |
| [`log`](#fiftyone.operators.executor.ExecutionContext.log)(message)                                                          | Logs a message to the browser console.                                                                                                                                                         |
| [`set_progress`](#fiftyone.operators.executor.ExecutionContext.set_progress)([progress, label])                              | Sets the progress of the current operation.                                                                                                                                                    |
| [`store`](#fiftyone.operators.executor.ExecutionContext.store)(store_name)                                                   | Retrieves the execution store with the given name.                                                                                                                                             |
| [`serialize`](#fiftyone.operators.executor.ExecutionContext.serialize)()                                                     | Serializes the execution context.                                                                                                                                                              |
| [`to_dict`](#fiftyone.operators.executor.ExecutionContext.to_dict)()                                                         | Returns the properties of the execution context as a dict.                                                                                                                                     |

#### *property* dataset

The [`fiftyone.core.dataset.Dataset`](fiftyone.core.dataset.md#fiftyone.core.dataset.Dataset) being operated on.

#### *property* dataset_name

The name of the [`fiftyone.core.dataset.Dataset`](fiftyone.core.dataset.md#fiftyone.core.dataset.Dataset) being
operated on.

#### *property* dataset_id

The ID of the [`fiftyone.core.dataset.Dataset`](fiftyone.core.dataset.md#fiftyone.core.dataset.Dataset) being operated
on.

#### *property* view

The [`fiftyone.core.view.DatasetView`](fiftyone.core.view.md#fiftyone.core.view.DatasetView) being operated on.

#### target_view(param_name='view_target', require_flat=False)

The target view for the operator being executed.

* **Parameters:**
  * **param_name** ( *"view_target"*) – the name of the enum parameter defining
    the target view choice
  * **require_flat** (*False*) – whether the operation requires a flattened
    (non-grouped) collection. When `False`, grouped collections
    are returned as-is. When `True`, grouped collections are
    flattened to the current active slice
* **Returns:**
  a [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection)

#### get_unavailable_view_targets(require_flat=False)

The view targets that this operation cannot process, mapped to the
reason why.

Targets that resolve to a grouped collection are unavailable to
operations that require a flattened one, so that panels and operator
forms can offer them with an explanation rather than fail at execution.

Every known target is considered, so the result may name targets that
the caller does not offer.

* **Parameters:**
  **require_flat** (*False*) – whether the operation requires a flattened
  (non-grouped) collection
* **Returns:**
  a dict mapping view targets to reasons

#### view_target(param_name='view_target', require_flat=False)

The target view for the operator being executed.

* **Parameters:**
  * **param_name** ( *"view_target"*) – the name of the enum parameter defining
    the target view choice
  * **require_flat** (*False*) – whether the operation requires a flattened
    (non-grouped) collection. When `False`, grouped collections
    are returned as-is. When `True`, grouped collections are
    flattened to the current active slice
* **Returns:**
  a [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection)

#### flatten_group_slices(sample_collection=None, slices=None, media_type=None)

Flattens the given grouped collection to the requested slices, or
to the active group slice if none are requested.

Non-grouped collections and views that already select slices are
returned as-is.

* **Parameters:**
  * **sample_collection** (*None*) – the
    [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection) to flatten.
    By default, the dataset is used
  * **slices** (*None*) – the group slice(s) to flatten to, as accepted by
    [`select_group_slices()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.select_group_slices)
  * **media_type** (*None*) – the group slice media type(s) to flatten to, as
    accepted by [`select_group_slices()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.select_group_slices)
* **Returns:**
  a [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection)

#### get_group_slice_scopes(sample_collection=None, require_flat=False)

Returns short descriptions of the slice(s) that view-based
targets and the dataset target resolve to, so that operator forms
and panels can surface the default behavior for grouped datasets.

* **Parameters:**
  * **sample_collection** (*None*) – the
    [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection) to
    describe. By default, the current view is used
  * **require_flat** (*False*) – whether the operation requires a
    flattened (non-grouped) collection
* **Returns:**
  a `(view_scope, dataset_scope)` tuple of descriptions, or
  `(None, None)` if the collection is not grouped or already
  selects its own slices

#### *property* has_custom_view

Whether the operator has a custom view.

#### *property* spaces

The current spaces layout in the FiftyOne App.

#### *property* selected

The list of selected IDs (if any).

Derived from [`selected_samples`](#fiftyone.operators.executor.ExecutionContext.selected_samples) when available, otherwise
falls back to `request_params["selected"]`.

#### *property* selected_samples

A list of selected sample dicts, if any.

Each dict has `id` and `type` (`"default"` or `"alt"`),
where type corresponds to a key in [`sample_selection_style`](#fiftyone.operators.executor.ExecutionContext.sample_selection_style).

Despite its name, `selected_samples` represents whatever sample grid
items are in the current view: samples, patches, clips, or frames.

#### *property* sample_selection_style

The current sample grid selection style config, if any.

A dict with a `default` key and optional `alt` key specifying
icon styles.

#### *property* label_selection_style

The current label selection style config (if any).

A dict with a `default` key and optional `alt` key specifying
label selection visual styles.

#### *property* selected_labels

A list of selected labels (if any).

Items are dictionaries with the following keys:

- `label_id`: the ID of the label
- `sample_id`: the ID of the sample containing the label
- `field`: the field name containing the label
- `frame_number`: the frame number containing the label (only
  applicable to video samples)
- `type`: the selection type (`"default"` or `"alt"`)

#### *property* extended_selection

The extended selection of the view (if any).

#### *property* current_sample

The ID of the current sample being processed (if any).

When executed via the FiftyOne App, this is set when the user opens a
sample in the modal.

#### *property* active_fields

The list of currently active fields in the FiftyOne App sidebar.

#### *property* active_media_type

The media type being processed, accounting for the active group
slice of grouped datasets.

#### *property* user_id

The ID of the user executing the operation, if known.

#### *property* user_request_token

The request token authenticating the user executing the operation,
if known.

#### *property* panel_id

The ID of the panel that invoked the operator, if any.

#### *property* panel_state

The current panel state.

Only available when the operator is invoked from a panel.

#### *property* panel

A [`fiftyone.operators.panel.PanelRef`](fiftyone.operators.panel.md#fiftyone.operators.panel.PanelRef) instance that you can
use to read and write the state and data of the current panel.

Only available when the operator is invoked from a panel.

#### *property* delegated

Whether the operation was delegated.

#### *property* requesting_delegated_execution

Whether delegated execution was requested for the operation.

#### *property* delegation_target

The orchestrator to which the operation was delegated (if any).

#### *property* results

A `dict` of results for the current operation.

#### *property* secrets

A read-only mapping of keys to their resolved values.

#### *property* ops

A [`fiftyone.operators.operations.Operations`](fiftyone.operators.operations.md#fiftyone.operators.operations.Operations) instance that
you can use to trigger builtin operations on the current context.

#### *property* group_slice

The current group slice of the view (if any).

#### *property* num_distributed_tasks

The number of tasks this job should be split into.

#### *property* query_performance

Whether query performance is enabled.

#### *property* prompt_id

An identifier for the prompt, unique to each instance of a user
opening a prompt in the FiftyOne App.

#### *property* operator_uri

The URI of the target operator.

#### prompt(operator_uri, params=None, on_success=None, on_error=None, skip_prompt=False)

Prompts the user to execute the operator with the given URI.

* **Parameters:**
  * **operator_uri** – the URI of the operator
  * **params** (*None*) – a dictionary of parameters for the operator
  * **on_success** (*None*) – a callback to invoke if the user successfully
    executes the operator
  * **on_error** (*None*) – a callback to invoke if the execution fails
  * **skip_prompt** (*False*) – whether to skip the prompt
* **Returns:**
  a [`fiftyone.operators.message.GeneratedMessage`](fiftyone.operators.message.md#fiftyone.operators.message.GeneratedMessage) containing
  instructions for the FiftyOne App to prompt the user

#### secret(key)

Retrieves the secret with the given key.

* **Parameters:**
  **key** – a secret key
* **Returns:**
  the secret value

#### *async* resolve_secret_values(keys, \*\*kwargs)

Resolves the values of the given secrets keys.

* **Parameters:**
  * **keys** – a list of secret keys
  * **\*\*kwargs** – additional keyword arguments to pass to the secrets
    client for authentication if required

#### trigger(operator_name, params=None)

Triggers an invocation of the operator with the given name.

This method is only available when the operator is invoked via the
FiftyOne App. You can check this via `ctx.executor`.

Example:

```default
def execute(self, ctx):
    # Trigger the `reload_dataset` operator after this operator
    # finishes executing
    ctx.trigger("reload_dataset")

    # Immediately trigger the `reload_dataset` operator while a
    # generator operator is executing
    yield ctx.trigger("reload_dataset")
```

* **Parameters:**
  * **operator_name** – the name of the operator
  * **params** (*None*) – a dictionary of parameters for the operator
* **Returns:**
  a [`fiftyone.operators.message.GeneratedMessage`](fiftyone.operators.message.md#fiftyone.operators.message.GeneratedMessage) containing
  instructions for the FiftyOne App to invoke the operator

#### log(message)

Logs a message to the browser console.

#### NOTE
This method is only available to non-delegated operators. You can
only use this method during the execution of an operator.

* **Parameters:**
  **message** – a message to log
* **Returns:**
  a [`fiftyone.operators.message.GeneratedMessage`](fiftyone.operators.message.md#fiftyone.operators.message.GeneratedMessage) containing
  instructions for the FiftyOne App to invoke the operator

#### set_progress(progress=None, label=None)

Sets the progress of the current operation.

* **Parameters:**
  * **progress** (*None*) – an optional float between 0 and 1 (0% to 100%)
  * **label** (*None*) – an optional label to display

#### store(store_name)

Retrieves the execution store with the given name.

The store is automatically created if necessary.

* **Parameters:**
  **store_name** – the name of the store
* **Returns:**
  a [`fiftyone.operators.store.ExecutionStore`](fiftyone.operators.store.md#fiftyone.operators.store.ExecutionStore)

#### serialize()

Serializes the execution context.

* **Returns:**
  a JSON dict

#### to_dict()

Returns the properties of the execution context as a dict.

### *class* fiftyone.operators.executor.ExecutionResult(result=None, executor=None, error=None, error_message=None, validation_ctx=None, delegated=False, outputs_schema=None, is_sse=False)

Bases: `object`

Represents the result of an operator execution.

* **Parameters:**
  * **result** (*None*) – the execution result
  * **executor** (*None*) – an [`Executor`](#fiftyone.operators.executor.Executor)
  * **error** (*None*) – an error traceback, if an error occurred
  * **error_message** (*None*) – an error message, if an error occurred
  * **validation_ctx** (*None*) – a [`ValidationContext`](#fiftyone.operators.executor.ValidationContext)
  * **delegated** (*False*) – whether execution was delegated
  * **outputs_schema** (*None*) – a JSON dict representing the output schema of
    the operator
  * **is_sse** (*False*) – whether execution was from an operator handling
    server-sent events (SSE)

**Attributes:**

| [`is_generator`](#fiftyone.operators.executor.ExecutionResult.is_generator)   | Whether the result is a generator or an async generator.   |
|-------------------------------------------------------------------------------|------------------------------------------------------------|

**Methods:**

| [`raise_exceptions`](#fiftyone.operators.executor.ExecutionResult.raise_exceptions)()   | Raises an [`ExecutionError`](#fiftyone.operators.executor.ExecutionError) (only) if the operation failed.          |
|-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------|
| [`to_exception`](#fiftyone.operators.executor.ExecutionResult.to_exception)()           | Returns an [`ExecutionError`](#fiftyone.operators.executor.ExecutionError) representing a failed execution result. |
| [`to_json`](#fiftyone.operators.executor.ExecutionResult.to_json)()                     | Returns a JSON dict representation of the result.                                                                  |

#### *property* is_generator

Whether the result is a generator or an async generator.

#### raise_exceptions()

Raises an [`ExecutionError`](#fiftyone.operators.executor.ExecutionError) (only) if the operation failed.

#### to_exception()

Returns an [`ExecutionError`](#fiftyone.operators.executor.ExecutionError) representing a failed execution
result.

* **Returns:**
  a [`ExecutionError`](#fiftyone.operators.executor.ExecutionError), or None if the execution did not fail

#### to_json()

Returns a JSON dict representation of the result.

* **Returns:**
  a JSON dict

### *class* fiftyone.operators.executor.PipelineExecutionContext(active, curr_stage_index, total_stages, pipeline_errors=None, num_distributed_tasks=0, \*\*\_)

Bases: `object`

Represents the execution context of a pipeline.

Operators can use the pipeline execution context to access information
about the current pipeline execution, if they are a child operation in a
pipeline.

**Attributes:**

| [`active`](#fiftyone.operators.executor.PipelineExecutionContext.active)                               | Whether the pipeline is currently active, i.e., having no failures in prior stages   |
|--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|
| [`curr_stage_index`](#fiftyone.operators.executor.PipelineExecutionContext.curr_stage_index)           | Index of the pipeline's current execution stage                                      |
| [`total_stages`](#fiftyone.operators.executor.PipelineExecutionContext.total_stages)                   | The total number of stages in the pipeline                                           |
| [`pipeline_errors`](#fiftyone.operators.executor.PipelineExecutionContext.pipeline_errors)             | Mapping from past pipeline child operation str IDs to error messages, if available   |
| [`num_distributed_tasks`](#fiftyone.operators.executor.PipelineExecutionContext.num_distributed_tasks) | The number of distributed tasks in the current stage                                 |

#### active *: [bool](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)*

Whether the pipeline is currently active, i.e., having no failures in
prior stages

#### curr_stage_index *: int*

Index of the pipeline’s current execution stage

#### total_stages *: int*

The total number of stages in the pipeline

#### pipeline_errors *: dict[str, str] | None* *= None*

Mapping from past pipeline child operation str IDs to error messages,
if available

#### num_distributed_tasks *: int* *= 0*

The number of distributed tasks in the current stage

### *exception* fiftyone.operators.executor.ExecutionError

Bases: `Exception`

An error that occurs while executing an operator.

**Methods:**

| [`add_note`](#fiftyone.operators.executor.ExecutionError.add_note)(object, /)             | Exception.add_note(note) -- add a note to the exception                         |
|-------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [`with_traceback`](#fiftyone.operators.executor.ExecutionError.with_traceback)(object, /) | Exception.with_traceback(tb) -- set self._\_traceback_\_ to tb and return self. |

**Attributes:**

| [`args`](#fiftyone.operators.executor.ExecutionError.args)   |    |
|--------------------------------------------------------------|----|

#### add_note(object,)

Exception.add_note(note) –
add a note to the exception

#### args

#### with_traceback(object,)

Exception.with_traceback(tb) –
set self._\_traceback_\_ to tb and return self.

### *class* fiftyone.operators.executor.ValidationError(reason, property, path, custom=False)

Bases: `object`

A validation error.

* **Parameters:**
  * **reason** – the reason
  * **property** – the property
  * **path** – the path

**Methods:**

| [`to_json`](#fiftyone.operators.executor.ValidationError.to_json)()   | Returns a JSON dict representation of the error.   |
|-----------------------------------------------------------------------|----------------------------------------------------|

#### to_json()

Returns a JSON dict representation of the error.

* **Returns:**
  a JSON dict

### *class* fiftyone.operators.executor.ValidationContext(ctx, inputs_property, operator)

Bases: `object`

Represents the validation context of an operator.

* **Parameters:**
  * **ctx** – the [`ExecutionContext`](#fiftyone.operators.executor.ExecutionContext)
  * **inputs_property** – the [`fiftyone.operators.types.Property`](fiftyone.operators.types.md#fiftyone.operators.types.Property) of the
    operator inputs
  * **operator** – the [`fiftyone.operators.operator.Operator`](fiftyone.operators.operator.md#fiftyone.operators.operator.Operator)

**Methods:**

| [`to_json`](#fiftyone.operators.executor.ValidationContext.to_json)()                                              | Returns a JSON dict representation of the context.   |
|--------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|
| [`add_error`](#fiftyone.operators.executor.ValidationContext.add_error)(error)                                     | Adds a validation error.                             |
| [`validate_enum`](#fiftyone.operators.executor.ValidationContext.validate_enum)(path, property, value)             | Validates an enum value.                             |
| [`validate_list`](#fiftyone.operators.executor.ValidationContext.validate_list)(path, property, value)             | Validates a list value.                              |
| [`validate_property`](#fiftyone.operators.executor.ValidationContext.validate_property)(path, property, value)     | Validates a property value.                          |
| [`validate_object`](#fiftyone.operators.executor.ValidationContext.validate_object)(path, property, value)         | Validates an object value.                           |
| [`validate_primitive`](#fiftyone.operators.executor.ValidationContext.validate_primitive)(path, property, value)   | Validates a primitive value.                         |
| [`exists_or_non_required`](#fiftyone.operators.executor.ValidationContext.exists_or_non_required)(property, value) |                                                      |

#### to_json()

Returns a JSON dict representation of the context.

* **Returns:**
  a JSON dict

#### add_error(error)

Adds a validation error.

* **Parameters:**
  **error** – a [`ValidationError`](#fiftyone.operators.executor.ValidationError)

#### validate_enum(path, property, value)

Validates an enum value.

* **Parameters:**
  * **path** – the path to the property
  * **property** – the [`fiftyone.operators.types.Property`](fiftyone.operators.types.md#fiftyone.operators.types.Property)
  * **value** – the value to validate
* **Returns:**
  a [`ValidationError`](#fiftyone.operators.executor.ValidationError), if the value is invalid

#### validate_list(path, property, value)

Validates a list value.

* **Parameters:**
  * **path** – the path to the property
  * **property** – the [`fiftyone.operators.types.Property`](fiftyone.operators.types.md#fiftyone.operators.types.Property)
  * **value** – the value to validate
* **Returns:**
  a [`ValidationError`](#fiftyone.operators.executor.ValidationError), if the value is invalid

#### validate_property(path, property, value)

Validates a property value.

* **Parameters:**
  * **path** – the path to the property
  * **property** – the [`fiftyone.operators.types.Property`](fiftyone.operators.types.md#fiftyone.operators.types.Property)
  * **value** – the value to validate
* **Returns:**
  a [`ValidationError`](#fiftyone.operators.executor.ValidationError), if the value is invalid

#### validate_object(path, property, value)

Validates an object value.

* **Parameters:**
  * **path** – the path to the property
  * **property** – the [`fiftyone.operators.types.Property`](fiftyone.operators.types.md#fiftyone.operators.types.Property)
  * **value** – the value to validate
* **Returns:**
  a [`ValidationError`](#fiftyone.operators.executor.ValidationError), if the value is invalid

#### validate_primitive(path, property, value)

Validates a primitive value.

* **Parameters:**
  * **path** – the path to the property
  * **property** – the [`fiftyone.operators.types.Property`](fiftyone.operators.types.md#fiftyone.operators.types.Property)
  * **value** – the value to validate
* **Returns:**
  a [`ValidationError`](#fiftyone.operators.executor.ValidationError), if the value is invalid

#### exists_or_non_required(property, value)

### *class* fiftyone.operators.executor.ExecutionOptions(allow_immediate_execution=True, allow_delegated_execution=False, default_choice_to_delegated=False, allow_distributed_execution=False, min_distributed_tasks=2, max_distributed_tasks=None, recommended_distributed_tasks=None, \*\*\_)

Bases: `object`

Represents the execution options of an operation.

* **Parameters:**
  * **allow_immediate_execution** (*True*) – whether the operation can be executed
    immediately
  * **allow_delegated_execution** (*False*) – whether the operation can be
    delegated to an orchestrator
  * **default_choice_to_delegated** (*False*) – whether to default to delegated
    execution, if allowed
  * **allow_distributed_execution** (*False*) – whether the operator supports
    distributing delegated execution across parallel workers. Only
    valid for delegated operations.
  * **min_distributed_tasks** (*2*) – the minimum number of tasks that a distributed
    delegated operation can be split into. None means no limit.
    Only valid for distributed and delegated operations.
  * **max_distributed_tasks** (*None*) – the maximum number of tasks that a distributed
    delegated operation can be split into. None means no limit.
    Only valid for distributed and delegated operations.
  * **recommended_distributed_tasks** (*None*) – the recommended number of tasks
    that a distributed delegated operation should be split into. None
    means no recommendation. Only valid for distributed and delegated
    operations.

**Attributes:**

| [`allow_immediate_execution`](#fiftyone.operators.executor.ExecutionOptions.allow_immediate_execution)                 |    |
|------------------------------------------------------------------------------------------------------------------------|----|
| [`allow_delegated_execution`](#fiftyone.operators.executor.ExecutionOptions.allow_delegated_execution)                 |    |
| [`allow_distributed_execution`](#fiftyone.operators.executor.ExecutionOptions.allow_distributed_execution)             |    |
| [`default_choice_to_delegated`](#fiftyone.operators.executor.ExecutionOptions.default_choice_to_delegated)             |    |
| [`min_distributed_tasks`](#fiftyone.operators.executor.ExecutionOptions.min_distributed_tasks)                         |    |
| [`max_distributed_tasks`](#fiftyone.operators.executor.ExecutionOptions.max_distributed_tasks)                         |    |
| [`recommended_distributed_tasks`](#fiftyone.operators.executor.ExecutionOptions.recommended_distributed_tasks)         |    |
| [`available_orchestrators`](#fiftyone.operators.executor.ExecutionOptions.available_orchestrators)                     |    |
| [`orchestrator_registration_enabled`](#fiftyone.operators.executor.ExecutionOptions.orchestrator_registration_enabled) |    |

**Methods:**

| [`update`](#fiftyone.operators.executor.ExecutionOptions.update)([available_orchestrators])   |    |
|-----------------------------------------------------------------------------------------------|----|
| [`to_dict`](#fiftyone.operators.executor.ExecutionOptions.to_dict)()                          |    |

#### *property* allow_immediate_execution

#### *property* allow_delegated_execution

#### *property* allow_distributed_execution

#### *property* default_choice_to_delegated

#### *property* min_distributed_tasks

#### *property* max_distributed_tasks

#### *property* recommended_distributed_tasks

#### *property* available_orchestrators

#### *property* orchestrator_registration_enabled

#### update(available_orchestrators=None)

#### to_dict()
