class documentation

Executes map_samples using multiprocessing.

Class Method create Create a new mapper instance
Method _map_samples_multiple_workers of the results.

Inherited from LocalMapper:

Method _map_samples of the results.

Inherited from Mapper (via LocalMapper):

Method __init__ Undocumented
Method map_samples Applies map function to each sample and returns an iterator of the results.
Property batch_size Number of samples per worker batch
Property num_workers Number of workers to use
Static Method _handle_map_error Common error handling when a map error occurs
Instance Variable _batch_cls Undocumented
Instance Variable _batch_size Undocumented
Instance Variable _num_workers Undocumented
@classmethod
def create(cls, *, config: focc.FiftyOneConfig, batch_cls: type[fomb.SampleBatch], num_workers: int | None = None, batch_size: int | None = None, **__): (source)

Create a new mapper instance

def _map_samples_multiple_workers(self, sample_collection: SampleCollection[T], map_fcn: Callable[[T], R], *, progress: bool | Literal['workers'] | None, save: bool, skip_failures: bool) -> Iterator[tuple[bson.ObjectId, R]]: (source)

Applies map function to each sample batch and returns an iterator
of the results.

Parameters
sample_collection:SampleCollection[T]The sample collection to map.
map_fcn:Callable[[T], R]The map function to apply to each sample.
progress:Union[bool, Literal["workers"]]Whether or not and how to render progress.
save:bool, optionalWhether to save mutated samples mutated in the map function. Defaults to False.
skip_failures:bool, optionalWhether to gracefully continue without raising an error if the map function raises an exception for a sample. Defaults to True.
Returns
Iterator[tuple[bson.ObjectId, R]]Undocumented
Yields
MapSampleBatchesReturnType
The sample ID, the exception raised
(if any), and the result of the map function for the sample (if no exception).