RunPool#

class maize.core.runtime.RunPool(*items: Runnable, wait_time: float = 1)[source]#

Bases: object

Context manager for running a pool of processes.

Upon entering, will start one process for each item with the execute method as the target. Exiting will cause all processes to be joined within wait_time, and any remaining ones will be terminated.

Parameters:
  • items – Items of type Runnable

  • wait_time – Time to wait when joining processes before issuing a termination signal

__init__(*items: Runnable, wait_time: float = 1) None[source]#

Methods

__init__(*items[, wait_time])

Attributes

n_processes

Returns the total number of processes.

property n_processes: int#

Returns the total number of processes.