tdfs4ds.scheduling.roll_workers¶
tdfs4ds.scheduling.roll_workers
¶
roll_out(max_workers=N): the processes of one date run in N worker OS processes (0.3.8.0).
A roll_out over D dates and P processes sends its statements one after the other, so on a remote
client its wall time is latency-bound. With max_workers the processes of one date that do not depend
on each other (same wave of the parallel plan) and do not write the same table (serialize_together)
run at the same time, each worker holding its own session. Dates stay sequential and the cursor is moved
by the parent between dates, exactly as in the sequential loop.
Workers are separate OS processes (spawn), never threads: run mutates module globals and teradataml
shares one connection pool (the reason scheduling/script.py does the same). A worker opens its
session from TDFS4DS_TD_* (:func:reconnect_teradata, a LOGDATA token works too).
Pure helpers (units_for, snapshot_settings) are offline-testable.
_SNAPSHOT_SKIP
module-attribute
¶
RollPool
¶
Pool of spawned workers kept for the whole roll-out (each opens its session once).
snapshot_settings
¶
The simple module settings of the parent (str / int / float / bool / None / list / dict of those).
credentials_available
¶
A worker can open its own session: TDFS4DS_TD_* describes a logon (password or token).
units_for
¶
Waves of units from a parallel plan, restricted to process_list.
Returns [[unit, ...], ...]: waves run one after the other; the units of a wave run at the same
time; a unit is the list of process ids one worker runs in order (a serialize_together group is
one unit). Order inside a unit follows process_list (already in dependency order).
worker_init
¶
Open this worker's session and apply the parent's settings (called once per worker process).
run_unit
¶
Run pids in order at the business date store_time. Returns [(pid, status, error)];
error is the exception (or its text when it cannot be pickled), None on success. Stops the
unit at its first failure, like the sequential loop stops the date.