dau_driver.fleet¶
Concurrent scan scheduling across independent DAU devices.
Exceptions¶
Failure from one device pipeline, annotated with fleet provenance. |
|
Common base class for all non-exit exceptions. |
|
Common base class for all non-exit exceptions. |
Classes¶
One collected batch result with its global index and exact device. |
|
Functions¶
|
Run one independent scan pipeline per device over a shared lazy input. |
|
|
|
Module Contents¶
- class dau_driver.fleet.FleetScanResult[source]¶
One collected batch result with its global index and exact device.
Keeping the device object, rather than only its display name, makes provenance unambiguous even when callers construct devices with duplicate names.
- batch_index: int¶
- device: Any¶
- value: Any¶
- exception dau_driver.fleet.FleetScanError(batch_index: int | None, device: Any, cause: Exception)[source]¶
Bases:
RuntimeErrorFailure from one device pipeline, annotated with fleet provenance.
Initialize self. See help(type(self)) for accurate signature.
- batch_index¶
- device¶
- class dau_driver.fleet._DeviceTracker[source]¶
- indices: list[int] = []¶
- staged_count: int = 0¶
- completed_count: int = 0¶
- explicit_error_index: int | None = None¶
- lock: threading.Lock¶
- class dau_driver.fleet._TrackedDevice(device: Any, tracker: _DeviceTracker)[source]¶
- _device¶
- _tracker¶
- exception dau_driver.fleet._BatchIterationError(batch_index: int, cause: Exception)[source]¶
Bases:
ExceptionCommon base class for all non-exit exceptions.
Initialize self. See help(type(self)) for accurate signature.
- batch_index¶
- cause¶
- class dau_driver.fleet._DeviceBatches(source: _SharedBatches, device_index: int, tracker: _DeviceTracker)[source]¶
- _source¶
- _device_index¶
- _tracker¶
- __iter__() _DeviceBatches[source]¶
- __next__() dau_driver.scan_execution.ScanBatch[source]¶
- class dau_driver.fleet._Progress(callback: collections.abc.Callable[[int], Any] | None)[source]¶
- _callback¶
- _completed = 0¶
- _lock¶
- exception dau_driver.fleet._WorkerError(batch_index: int | None, device: Any, cause: Exception)[source]¶
Bases:
ExceptionCommon base class for all non-exit exceptions.
Initialize self. See help(type(self)) for accurate signature.
- batch_index¶
- device¶
- cause¶
- dau_driver.fleet.run_scan_batches_fleet(devices, batches: collections.abc.Iterable[dau_driver.scan_execution.ScanBatch], *, per_key_state: bool, input_regions: tuple[int, int], row_bytes: int, collect: collections.abc.Callable[[Any], Any], timeout_seconds: float = 60.0, progress=None, weights: collections.abc.Sequence[float] | None = None, poll_yield_seconds: float | None = None) list[FleetScanResult][source]¶
Run one independent scan pipeline per device over a shared lazy input.
Each batch is pulled exactly once by whichever device pipeline demands it. With
weights=Nonethis is pure demand-driven scheduling and naturally self-balances by device throughput. Weights use weighted round-robin only to pre-bias each shared pull toward the requested relative device shares; batches remain lazy and are never partitioned or queued ahead.Results are returned in global batch order as frozen
FleetScanResultrecords. Each record retains the exact device object so the caller can recover which card produced its collect value.input_regionsis reused as device-local addresses, never shared memory.per_key_stateis required and must be False. A stateful composition cannot run on a fleet at all: batches are pulled from ONE shared source by whichever device is free, so a given key’s rows land on whichever cards happen to be idle and per-key state is split across devices that never see each other’s rows. Key-partitioning the input does not help — the affinity would have to be device-wide, and demand-driven scheduling is what makes the fleet self-balancing in the first place. Refusing is the same guard run_scan_batches applies to position-sliced batches, one level up.poll_yield_secondsis passed through to each pipeline’s JOB_STATUS poll and defaults to None (spin). The real transports release the GIL in their register read (os.preadon Linux,ctypeson macOS), so concurrent pipelines interleave without it and a sleep would only add latency per poll. It exists for a pure-Python transport — a fake in a concurrent test — where the spin WOULD hold the GIL and flatten self-balancing toward an even split regardless of device speed (on fakes with a large speed gap the spinning split was close to even and took twice as long).Known limitation: cancelling on a device failure wakes pipelines blocked pulling a batch, but one already inside its JOB_STATUS wait runs to its own completion or timeout first, so an early failure can surface only after its peers finish.
An empty batch iterable returns
[]. An empty device sequence raisesValueErrorbecause no pipeline can consume even a potentially lazy iterable. A single device invokes the samerun_scan_batchespipeline as the multi-device workers and adds only ordered provenance records.