footings.jigs.create_foreach_jig¶
-
create_foreach_jig
(model, *, iterator_name: str, iterator_keys: tuple, mapped_keys: Optional[Tuple] = None, constant_params: Optional[Tuple] = None, pass_iterator_keys: Optional[Tuple] = None, success_wrap: Optional[Callable] = None, error_wrap: Optional[Callable] = None)[source]¶ Create a ForeachJig that runs a WrappedModel or MappedModels for each item in an iterator.
- Parameters
model (Union[WrappedModel, MappedModel]) – The models to call.
iterator_name (str) – The name to assign the iterator to be passed (will be used in signature of the returned model).
mapped_keys (Optional[Tuple]) – The keys to be used to lookup the model in mapping.
constant_params (Optional[Tuple]) – The parameter names which will be constant for all items in the iterator.
success_wrap (Optional[Callable]) – An optional function to call upon running the model on the items that returned without error (note if none return without error an empty list is returned).
error_wrap (Optional[Callable]) – An optional function to call upon running the model on the items that returned with error (note if none return with error an empty list is returned).
compute (Optional[Callable]) – An optional function to be used to call compute or return on the modeled objects. This is to be paired with parallel tools such as dask.compute or ray.get.
compute_kwargs (Optional[Dict]) – Optional kwargs to pass into compute.
- Returns
ForeachJig (with updated signature)