class ExecutionContext(object): (source)
Constructor: ExecutionContext(request_params, executor, set_progress, delegated_operation_id, ...)
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 | a optional dictionary of request parameters |
executor | an optional Executor instance |
set | an optional function to set the progress of the current operation |
delegated | an optional ID of the delegated operation |
operator | the unique id of the operator |
required | the list of required secrets from the plugin's definition |
Method | __init__ |
Undocumented |
Method | log |
Logs a message to the browser console. |
Method | prompt |
Prompts the user to execute the operator with the given URI. |
Async Method | resolve |
Resolves the values of the given secrets keys. |
Method | secret |
Retrieves the secret with the given key. |
Method | serialize |
Serializes the execution context. |
Method | set |
Sets the progress of the current operation. |
Method | store |
Retrieves the execution store with the given name. |
Method | target |
The target fiftyone.core.view.DatasetView for the operator being executed. |
Method | to |
Returns the properties of the execution context as a dict. |
Method | trigger |
Triggers an invocation of the operator with the given name. |
Instance Variable | executor |
Undocumented |
Instance Variable | params |
Undocumented |
Instance Variable | request |
Undocumented |
Instance Variable | user |
Undocumented |
Property | current |
The ID of the current sample being processed (if any). |
Property | dataset |
The fiftyone.core.dataset.Dataset being operated on. |
Property | dataset |
The ID of the fiftyone.core.dataset.Dataset being operated on. |
Property | dataset |
The name of the fiftyone.core.dataset.Dataset being operated on. |
Property | delegated |
Whether the operation was delegated. |
Property | delegation |
The orchestrator to which the operation was delegated (if any). |
Property | extended |
The extended selection of the view (if any). |
Property | group |
The current group slice of the view (if any). |
Property | has |
Whether the operator has a custom view. |
Property | ops |
A fiftyone.operators.operations.Operations instance that you can use to trigger builtin operations on the current context. |
Property | panel |
A fiftyone.operators.panel.PanelRef instance that you can use to read and write the state and data of the current panel. |
Property | panel |
The ID of the panel that invoked the operator, if any. |
Property | panel |
The current panel state. |
Property | query |
Whether query performance is enabled. |
Property | requesting |
Whether delegated execution was requested for the operation. |
Property | results |
A dict of results for the current operation. |
Property | secrets |
A read-only mapping of keys to their resolved values. |
Property | selected |
The list of selected sample IDs (if any). |
Property | selected |
A list of selected labels (if any). |
Property | spaces |
The current spaces layout in the FiftyOne App. |
Property | user |
The ID of the user executing the operation, if known. |
Property | user |
The request token authenticating the user executing the operation, if known. |
Property | view |
The fiftyone.core.view.DatasetView being operated on. |
Method | _get |
Undocumented |
Instance Variable | _dataset |
Undocumented |
Instance Variable | _delegated |
Undocumented |
Instance Variable | _operator |
Undocumented |
Instance Variable | _ops |
Undocumented |
Instance Variable | _panel |
Undocumented |
Instance Variable | _panel |
Undocumented |
Instance Variable | _required |
Undocumented |
Instance Variable | _secrets |
Undocumented |
Instance Variable | _secrets |
Undocumented |
Instance Variable | _set |
Undocumented |
Instance Variable | _view |
Undocumented |
Undocumented
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 containing
instructions for the FiftyOne App to invoke the operator |
Prompts the user to execute the operator with the given URI.
Parameters | |
operator | the URI of the operator |
params:None | a dictionary of parameters for the operator |
onNone | a callback to invoke if the user successfully executes the operator |
onNone | a callback to invoke if the execution fails |
skipFalse | whether to skip the prompt |
Returns | |
a fiftyone.operators.message.GeneratedMessage containing
instructions for the FiftyOne App to prompt the user |
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 |
Retrieves the execution store with the given name.
The store is automatically created if necessary.
Parameters | |
store | the name of the store |
Returns | |
a fiftyone.operators.store.ExecutionStore |
The target fiftyone.core.view.DatasetView
for the operator
being executed.
Parameters | |
param | the name of the enum parameter defining the target view choice |
Returns | |
a fiftyone.core.collections.SampleCollection |
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:
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 | the name of the operator |
params:None | a dictionary of parameters for the operator |
Returns | |
a fiftyone.operators.message.GeneratedMessage containing
instructions for the FiftyOne App to invoke the operator |
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.
A fiftyone.operators.operations.Operations
instance that
you can use to trigger builtin operations on the current context.
A 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.
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)