Training Session
class TrainingSession<Input, Output, InputLabel>(resources: TrainingResources<Input, Output, InputLabel>, logger: KLogger, trainingName: ExperimentName, recordsFilePath: ResilientPath?, throwIfRecordsFileExists: Boolean, podName: String?, spendLimit: JsonElement?, retries: JsonElement?, abortPolicies: List<AbortPolicy> = emptyList(), progressListener: (StageRecord) -> Unit = {})
Lifecycle wrapper for a training session.
Creates the root StageScopeImpl, runs the optimizer block via use, persists the resulting records, and returns a TrainingResult (the same shape that is written to disk).
All provider/settings wiring (agent tracking, consumption capture, spend limits, cluster progress) is supplied through resources and the constructor's injected collaborators; the app builds these via its TrainingSessionFactory.
Constructors
Link copied to clipboard
constructor(resources: TrainingResources<Input, Output, InputLabel>, logger: KLogger, trainingName: ExperimentName, recordsFilePath: ResilientPath?, throwIfRecordsFileExists: Boolean, podName: String?, spendLimit: JsonElement?, retries: JsonElement?, abortPolicies: List<AbortPolicy> = emptyList(), progressListener: (StageRecord) -> Unit = {})
Functions
Link copied to clipboard
suspend fun use(stagesTotal: Int? = null, block: suspend StageScope<Input, Output, InputLabel>.() -> Unit): TrainingResult
Runs the training session: sets up the root StageScope, runs block, persists final records, and returns the TrainingResult.