fiftyone.operators.delegated¶
FiftyOne delegated operations.
Classes:
|
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.
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, run_link])Executes the given delegated operation.
-
queue_operation
(operator, label=None, delegation_target=None, context=None, metadata=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
- 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
of the operation
- Returns
a
fiftyone.factory.repos.DelegatedOperationDocument
-
set_running
(doc_id, progress=None, run_link=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 operationrun_link (None) – an optional link to orchestrator-specific information about 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
.
- a
-
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
.
- a
-
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
.
- a
-
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
of the operationprogress (None) – an optional
fiftyone.operators.executor.ExecutionProgress
of the operationrun_link (None) – an optional link to orchestrator-specific information about 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
.
- a
-
set_failed
(doc_id, result=None, progress=None, run_link=None, required_state=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 operationprogress (None) – an optional
fiftyone.operators.executor.ExecutionProgress
of the operationrun_link (None) – an optional link to orchestrator-specific information about 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
.
- a
-
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
-
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, **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
-
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)¶ 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
-