class documentation

Base class for methods that can be run on a dataset.

Subclasses will typically declare an interface method that handles performing the actual run. The function of this base class is to declare how to validate that a run is valid and how to cleanup after a run.

Parameters
configa BaseRunConfig
Class Method delete_run Deletes the results associated with the given run key from the collection.
Class Method delete_runs Deletes all runs from the collection.
Class Method get_run_info Gets the BaseRunInfo for the given key on the collection.
Class Method has_cached_run_results Determines whether BaseRunResults for the given key are cached on the collection.
Class Method list_runs Returns the list of run keys on the given collection.
Class Method load_run_results Loads the BaseRunResults for the given key on the collection.
Class Method load_run_view Loads the fiftyone.core.view.DatasetView on which the specified run was performed.
Class Method run_info_cls The BaseRunInfo class associated with this class.
Class Method save_run_info Saves the run information on the collection.
Class Method save_run_results Saves the run results on the collection.
Class Method update_run_config Updates the BaseRunConfig for the given run on the collection.
Class Method update_run_key Replaces the key for the given run with a new key.
Method cleanup Cleans up the results of the run with the given key from the collection.
Method ensure_requirements Ensures that any necessary packages to execute this run are installed.
Method ensure_usage_requirements Ensures that any necessary packages to use existing results for this run are installed.
Method get_fields Gets the fields that were involved in the given run.
Method register_run Registers a run of this method under the given key on the given collection.
Method rename Performs any necessary operations required to rename this run's key.
Method validate_run Validates that the collection can accept this run.
Class Method _get_run_doc Undocumented
Class Method _get_run_docs Undocumented
Class Method _get_run_fields Undocumented
Class Method _patch_function A function that can patch any ReferenceField issues with a dataset's runs.
Class Method _results_cache_field The fiftyone.core.dataset.Dataset field that stores the results cache for these runs.
Class Method _run_str A string to use when referring to these runs in log messages.
Class Method _runs_field The fiftyone.core.odm.dataset.DatasetDocument field in which these runs are stored.
Method _validate_fields_match Undocumented
Method _validate_run Subclass-specific validation when a run with the given key already exists.

Inherited from Configurable:

Method __init__ Undocumented
Instance Variable config Undocumented
@classmethod
def delete_run(cls, samples, key, cleanup=True): (source)

Deletes the results associated with the given run key from the collection.

Parameters
samplesa fiftyone.core.collections.SampleCollection
keya run key
cleanup:Truewhether to execute the run's BaseRun.cleanup method
@classmethod
def delete_runs(cls, samples, cleanup=True): (source)

Deletes all runs from the collection.

Parameters
samplesa fiftyone.core.collections.SampleCollection
cleanup:Truewhether to execute the run's BaseRun.cleanup methods
@classmethod
def get_run_info(cls, samples, key): (source)

Gets the BaseRunInfo for the given key on the collection.

Parameters
samplesa fiftyone.core.collections.SampleCollection
keya run key
Returns
a BaseRunInfo
@classmethod
def has_cached_run_results(cls, samples, key): (source)

Determines whether BaseRunResults for the given key are cached on the collection.

Parameters
samplesa fiftyone.core.collections.SampleCollection
keya run key
Returns
True/False
@classmethod
def list_runs(cls, samples, type=None, method=None, **kwargs): (source)

Returns the list of run keys on the given collection.

Parameters
samplesa fiftyone.core.collections.SampleCollection
type:None

a specific run type to match, which can be:

method:Nonea specific fiftyone.core.runs.BaseRunConfig.method string to match
**kwargsoptional config parameters to match
Returns
a list of run keys
@classmethod
def load_run_results(cls, samples, key, cache=True, load_view=True, **kwargs): (source)

Loads the BaseRunResults for the given key on the collection.

Parameters
samplesa fiftyone.core.collections.SampleCollection
keya run key
cache:Truewhether to cache the results on the collection
load_view:Truewhether to load the run view in the results (True) or the full dataset (False)
**kwargskeyword arguments for the run's BaseRunConfig.load_credentials method
Returns
a BaseRunResults, or None if the run did not save results
@classmethod
def load_run_view(cls, samples, key, select_fields=False): (source)

Loads the fiftyone.core.view.DatasetView on which the specified run was performed.

Parameters
samplesa fiftyone.core.collections.SampleCollection
keya run key
select_fields:Falsewhether to exclude fields involved in other runs of the same type
Returns
a fiftyone.core.view.DatasetView
@classmethod
def save_run_info(cls, samples, run_info, overwrite=True, cleanup=True): (source)

Saves the run information on the collection.

Parameters
samplesa fiftyone.core.collections.SampleCollection
run_infoa BaseRunInfo
overwrite:Truewhether to overwrite an existing run with the same key
cleanup:Truewhether to execute an existing run's BaseRun.cleanup method when overwriting it
@classmethod
def save_run_results(cls, samples, key, run_results, overwrite=True, cache=True): (source)

Saves the run results on the collection.

Parameters
samplesa fiftyone.core.collections.SampleCollection
keya run key
run_resultsa BaseRunResults, or None
overwrite:Truewhether to overwrite an existing result with the same key
cache:Truewhether to cache the results on the collection
@classmethod
def update_run_config(cls, samples, key, config): (source)

Updates the BaseRunConfig for the given run on the collection.

Parameters
samplesa fiftyone.core.collections.SampleCollection
keya run key
configa BaseRunConfig
@classmethod
def update_run_key(cls, samples, key, new_key): (source)

Replaces the key for the given run with a new key.

Parameters
samplesa fiftyone.core.collections.SampleCollection
keya run key
new_keya new run key
def ensure_requirements(self): (source)

Ensures that any necessary packages to execute this run are installed.

Runs should respect fiftyone.config.requirement_error_level when handling errors.

def ensure_usage_requirements(self): (source)

Ensures that any necessary packages to use existing results for this run are installed.

Runs should respect fiftyone.config.requirement_error_level when handling errors.

def register_run(self, samples, key, overwrite=True, cleanup=True): (source)

Registers a run of this method under the given key on the given collection.

Parameters
samplesa fiftyone.core.collections.SampleCollection
keya run key
overwrite:Truewhether to allow overwriting an existing run of the same type
cleanup:Truewhether to execute an existing run's BaseRun.cleanup method when overwriting it
def validate_run(self, samples, key, overwrite=True): (source)

Validates that the collection can accept this run.

The run may be invalid if, for example, a run of a different type has already been run under the same key and thus overwriting it would cause ambiguity on how to cleanup the results.

Parameters
samplesa fiftyone.core.collections.SampleCollection
keya run key
overwrite:Truewhether to allow overwriting an existing run of the same type
Raises
ValueErrorif the run is invalid
@classmethod
def _get_run_doc(cls, samples, key): (source)

Undocumented

@classmethod
def _get_run_docs(cls, samples): (source)

Undocumented

@classmethod
def _get_run_fields(cls, samples, key): (source)

Undocumented

@classmethod
def _patch_function(cls): (source)

A function that can patch any ReferenceField issues with a dataset's runs.

def _validate_fields_match(self, key, field_name, existing_info): (source)

Undocumented

def _validate_run(self, samples, key, existing_info): (source)