fiftyone.operators.delegated#
FiftyOne delegated operations.
Classes:
|
Service for executing delegated operations. |
- class fiftyone.operators.delegated.DelegatedOperationService(repo=None)#
Bases:
objectService 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.ExecutionRunStaterequired 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.ExecutionContextmetadata (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.Pipelineto 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:
doc_id β the ID of the delegated operation
progress β the
fiftyone.operators.executor.ExecutionProgressof the operation
- 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.ExecutionProgressof the operationrun_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.ExecutionRunStaterequired state of the operation. If provided, the update will only be performed if the referenced operation matches this state.
- Returns:
- a
fiftyone.factory.repos.DelegatedOperationDocumentif 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.ExecutionRunStaterequired state of the operation. If provided, the update will only be performed if the referenced operation matches this state.- Returns:
- a
fiftyone.factory.repos.DelegatedOperationDocumentif 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.ExecutionRunStaterequired state of the operation. If provided, the update will only be performed if the referenced operation matches this state.
- Returns:
- a
fiftyone.factory.repos.DelegatedOperationDocumentif the update was performed, else
None.
- a
- 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:
doc_id β the ID of the delegated operation
result (None) β the
fiftyone.operators.executor.ExecutionResultof the operationprogress (None) β an optional
fiftyone.operators.executor.ExecutionProgressof the operationrun_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.ExecutionRunStaterequired state of the operation. If provided, the update will only be performed if the referenced operation matches this state.
- Returns:
- a
fiftyone.factory.repos.DelegatedOperationDocumentif the update was performed, else
None.
- a
- 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.ExecutionResultof the operationprogress (None) β an optional
fiftyone.operators.executor.ExecutionProgressof the operationrun_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.ExecutionRunStaterequired 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.DelegatedOperationDocumentif 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
- 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.DelegatedOperationPagingParamssearch (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.DelegatedOperationDocumentlog (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.