fiftyone.operators.delegated#

FiftyOne delegated operations.

Copyright 2017-2025, Voxel51, Inc.

Classes:

DelegatedOperationService([repo])

Service for executing delegated operations.

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

Bases: object

Service for executing delegated operations.

Methods:

queue_operation(operator[,Β label,Β ...])

Queues the given delegated operation for execution.

set_progress(doc_id,Β progress)

Sets the progress of the given delegated operation.

set_running(doc_id[,Β progress,Β run_link,Β ...])

Sets the given delegated operation to running state.

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 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(doc_id[,Β required_state])

Sets the given delegated operation to queued state.

set_completed(doc_id[,Β result,Β progress,Β ...])

Sets the given delegated operation to completed state.

set_failed(doc_id[,Β result,Β progress,Β ...])

Sets the given delegated operation to failed state.

set_pinned(doc_id[,Β pinned])

Sets the pinned flag for the given delegated operation.

set_label(doc_id,Β label)

Sets the pinned flag for the given delegated operation.

set_log_upload_error(doc_id,Β log_upload_error)

Sets the log upload error for the given delegated operation.

set_log_size(doc_id,Β log_size)

Sets the log size for the given delegated operation.

delete_operation(doc_id)

Deletes the given delegated operation.

delete_for_dataset(dataset_id)

Deletes all delegated operations associated with the given dataset.

rerun_operation(doc_id)

Reruns the specified delegated operation.

get_queued_operations([operator,Β dataset_name])

Returns all queued delegated operations.

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([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(doc_id)

Returns the delegated operation with the given ID.

list_operations([operator,Β dataset_name,Β ...])

Lists the delegated operations matching the given criteria.

execute_queued_operations([operator,Β ...])

Executes queued delegated operations matching the given criteria.

count([filters,Β search])

Counts the delegated operations matching the given criteria.

execute_operation(operation[,Β log,Β ...])

Executes the given delegated operation.

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

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

  • 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 to use for the operation, if this is a pipeline operator

Returns:

a fiftyone.factory.repos.DelegatedOperationDocument

set_progress(doc_id, progress)#

Sets the progress of the given delegated operation.

Parameters:
Returns:

a fiftyone.factory.repos.DelegatedOperationDocument

set_running(doc_id, progress=None, run_link=None, log_path=None, required_state=None)#

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 of the operation

  • run_link (None) – an optional link to orchestrator-specific information about the operation

  • log_path (None) – an optional path to the log file for the operation

  • required_state (None) – an optional 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_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 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 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, log_path=None, required_state=None)#

Sets the given delegated operation to completed state.

Parameters:
Returns:

a fiftyone.factory.repos.DelegatedOperationDocument if the

update was performed, else None.

set_failed(doc_id, result=None, progress=None, run_link=None, log_path=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 of the operation

  • progress (None) – an optional fiftyone.operators.executor.ExecutionProgress of the operation

  • run_link (None) – an optional link to orchestrator-specific information about the operation

  • log_path (None) – an optional path to the log file for the operation

  • required_state (None) – an optional 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

set_log_upload_error(doc_id, log_upload_error)#

Sets the log upload error for the given delegated operation.

Parameters:
  • doc_id – the ID of the delegated operation

  • error (log upload) – the error message if we failed to upload

  • operation. (logs for the given delegated)

Returns:

a fiftyone.factory.repos.DelegatedOperationDocument

set_log_size(doc_id, log_size)#

Sets the log size for the given delegated operation.

Parameters:
  • doc_id – the ID of the delegated operation

  • size (log) – the size of the log file for the given 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, **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

  • search (None) – optional search term dict

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, log_path=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

  • log_path (None) – an optional path to the log file for 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.