nv_ingest.util.flow_control package#
Submodules#
nv_ingest.util.flow_control.filter_by_task module#
- nv_ingest.util.flow_control.filter_by_task.filter_by_task(
- required_tasks: List[str | Tuple[Any, ...]],
- forward_func: Callable[[Any], Any] | None = None,
Decorator that checks whether the first argument (an IngestControlMessage) contains any of the required tasks. Each required task can be specified as a string (the task name) or as a tuple/list with the task name as the first element and additional task properties as subsequent elements. If the IngestControlMessage does not match any required task (and its properties), the wrapped function is not called; instead, the original message is returned (or a forward function is invoked, if provided).
- Parameters:
required_tasks (list[Union[str, Tuple[Any, ...]]]) – A list of required tasks. Each element is either a string representing a task name or a tuple/list where the first element is the task name and the remaining elements specify required task properties.
forward_func (Optional[Callable[[IngestControlMessage], IngestControlMessage]], optional) – A function to be called with the IngestControlMessage if no required task is found. Defaults to None.
- Returns:
A decorator that wraps a function expecting an IngestControlMessage as its first argument.
- Return type:
Callable
Module contents#
- nv_ingest.util.flow_control.filter_by_task(
- required_tasks: List[str | Tuple[Any, ...]],
- forward_func: Callable[[Any], Any] | None = None,
Decorator that checks whether the first argument (an IngestControlMessage) contains any of the required tasks. Each required task can be specified as a string (the task name) or as a tuple/list with the task name as the first element and additional task properties as subsequent elements. If the IngestControlMessage does not match any required task (and its properties), the wrapped function is not called; instead, the original message is returned (or a forward function is invoked, if provided).
- Parameters:
required_tasks (list[Union[str, Tuple[Any, ...]]]) – A list of required tasks. Each element is either a string representing a task name or a tuple/list where the first element is the task name and the remaining elements specify required task properties.
forward_func (Optional[Callable[[IngestControlMessage], IngestControlMessage]], optional) – A function to be called with the IngestControlMessage if no required task is found. Defaults to None.
- Returns:
A decorator that wraps a function expecting an IngestControlMessage as its first argument.
- Return type:
Callable