accelmo.tracking.dispatch.turn_planner

Turn-batch planning for tracking workers.

Batching is intentionally simple: the caller (DataManager) has already carved out the held-out validation turns and applied data_fraction sampling, so the turns handed to the planner are exactly the training turns to be used. The planner only has to spread those turns evenly across the batches implied by num_workers (one batch per turn-group, later fanned out over range specs). Every batch comes from a single measurement file.

accelmo.tracking.dispatch.turn_planner.group_turns_by_file(available_turns, file_map)[source]

Group available turns by measurement file index.

Return type:

dict[int, list[int]]

Parameters:
  • available_turns (list[int])

  • file_map (dict[int, int])

accelmo.tracking.dispatch.turn_planner.allocate_batches_per_file(turns_by_file, num_turn_batches)[source]

Split num_turn_batches batches across files, keeping >=1 turn per batch.

Batches are handed out one at a time to whichever file currently has the most turns per already-assigned batch, so files end up with batch counts roughly proportional to how much data they contribute while never exceeding one batch per turn (a batch must contain at least one turn).

Return type:

dict[int, int]

Parameters:
  • turns_by_file (dict[int, list[int]])

  • num_turn_batches (int)

class accelmo.tracking.dispatch.turn_planner.WorkerTurnPlanner(tracking_plan, tracking_data, num_workers, *, shuffle_turns)[source]

Bases: object

Compute worker turn batches from the training turns and tracking mode.

Parameters:
build_turn_batches(*, available_turns, file_map, num_files, workers_per_batch)[source]

Plan batches from the (already sampled) training turns and log the result.

workers_per_batch is the largest number of workers one file’s turn batch fans out to, so the batches never spawn more than num_workers workers.

Return type:

list[list[int]]

Parameters:
  • available_turns (list[int])

  • file_map (dict[int, int])

  • num_files (int)

  • workers_per_batch (int)