quickie.thread_group
- quickie.thread_group(obj: Callable) ThreadGroup
- quickie.thread_group(**kwargs: Unpack[CommonTaskKwargs]) PartialReturnType[ThreadGroup]
Create a thread group task from a function.
The returned task will run in parallel. To add arguments to individual tasks in the group, you can use functools.partial with the task and the arguments.
Note that the tasks run in separate threads, so they should be thread-safe. This means that they are also affected by the Global Interpreter Lock (GIL).
@thread_group(args=["arg1"]) def my_group(arg1): return [task1, functools.partial(task2, arg1)]
- Parameters:
obj – The function to create the thread group task from.
kwargs – Common keyword arguments for tasks. See CommonTaskKwargs for more information.
- Returns:
The thread group task class, or, if obj is None, a partial function to be used as a decorator for a function.