compute_pool is what runs the process’s jobs; ComputePool runs a picklable job
in a worker and awaits it; COMPUTE_WORKERS sizes it (ComputeSettings).
share_compute_pool lets the children a process forks run their jobs in its pool. A process
started through a process prelude runs its jobs in a pool host it starts, through a
HostedPool. A process reaches a pool it does not run through a ComputePoolClient.
ComputeJobFailedError
tai42_kit.compute.errors.ComputeJobFailedError
ComputePool
tai42_kit.compute.pool.ComputePool
workers worker processes running picklable jobs.
start launches the workers and stop ends them; a pool runs once. run on a pool
that is not running raises ComputePoolUnavailableError:
a job never runs anywhere but in a worker. A running pool is stopped when its process exits
through the interpreter or through multiprocessing’s child exit. The pool’s process must
run OS threads (runs_in_this_process).
Members
workers
tai42_kit.compute.pool.ComputePool.workers
broken
tai42_kit.compute.pool.ComputePool.broken
runs_in_this_process
tai42_kit.compute.pool.ComputePool.runs_in_this_process
PROCESS_PRELUDE_ENV names one) cannot run one.
start
tai42_kit.compute.pool.ComputePool.start
RuntimeError when the pool is already running, and
ComputePoolUnavailableError when it was stopped or when
no pool can run in this process (runs_in_this_process).
stop
tai42_kit.compute.pool.ComputePool.stop
run
tai42_kit.compute.pool.ComputePool.run
fn(*args) in a worker process and return its result.
An exception fn raises is raised here as itself, the worker’s traceback chained as its
cause (WorkerTraceback); one that cannot be rebuilt here
raises ComputeJobFailedError carrying its type and
message, with the same cause. A job whose module fails to import in the worker raises
that import error the same way. timeout (seconds, None for none) bounds the
job once a worker takes it up: past it the worker is terminated at once and
TimeoutError is raised; nothing the job itself started is cleaned up. A worker that
ends while running the job raises
ComputeWorkerLostError; a pool that is not running, or
broke, raises ComputePoolUnavailableError. An argument
or a result that cannot be pickled raises the pickling error.
Parameters
run_packed
tai42_kit.compute.pool.ComputePool.run_packed
pack) in a worker and return its outcome.
Raises what run raises for the pool’s own failures (TimeoutError,
ComputeWorkerLostError,
ComputePoolUnavailableError), naming name;
cancelling the awaiting task terminates the job’s worker.
Parameters
ComputePoolClient
tai42_kit.compute.pool_wire.ComputePoolClient
Members
server_ended
tai42_kit.compute.pool_wire.ComputePoolClient.server_ended
run
tai42_kit.compute.pool_wire.ComputePoolClient.run
fn(*args) in a worker of the serving process’s pool and return its result.
The same contract as ComputePool.run; the timeout and the termination of the
worker happen in the serving process’s pool, and a pool error raised there arrives here
without its cause. A job the serving process’s closed end refused raises
JobNotSentError and is recorded (server_ended); a job whose socket this
process cannot make, or whose socket closes with no reply, raises
ComputePoolUnavailableError and is not.
Parameters
close
tai42_kit.compute.pool_wire.ComputePoolClient.close
ComputePoolUnavailableError
tai42_kit.compute.errors.ComputePoolUnavailableError
ComputeSettings
tai42_kit.compute.settings.ComputeSettings
COMPUTE_-prefixed environment variables.
Attributes
ComputeWorkerLostError
tai42_kit.compute.errors.ComputeWorkerLostError
HostedPool
tai42_kit.compute.pool_host.HostedPool
Members
run
tai42_kit.compute.pool_host.HostedPool.run
fn(*args) in a worker of the pool host the process reaches and return its result.
The contract of run. A job the
host’s closed end refused never reached it, so it is sent once more, to the host the
process reaches then; a second refusal raises.
Parameters
WorkerTraceback
tai42_kit.compute.errors.WorkerTraceback
compute_pool
tai42_kit.compute.process_pool.compute_pool
HostedPool, or its own
ComputePool, which the first call starts.
compute_settings
tai42_kit.compute.settings.compute_settings
ComputeSettings, cached after first load.
share_compute_pool
tai42_kit.compute.process_pool.share_compute_pool
ComputePoolUnavailableError when the share cannot start
serving (a process at its descriptor limit, or a serving thread that cannot start or run a
loop of its own); nothing is shared then.
stop_compute_pool
tai42_kit.compute.process_pool.stop_compute_pool

