CaMa development view on the survival tab; governance trains any scenario in the background

This commit is contained in:
rockdrigo
2026-11-21 03:28:13 -06:00
parent cc802cbb57
commit c5cbaaab13
13 changed files with 544 additions and 20 deletions
+16
View File
@@ -10,6 +10,8 @@ import {
ModelVersion,
PromotionCheck,
ReportField,
TrainableScenario,
TrainingJob,
OcrJob,
OcrRowStatus,
OcrRowsResponse,
@@ -39,6 +41,20 @@ export class GovernanceApi {
return this.http.post<{ output: string }>(`/governance/model-versions/${domain}/${scenario}/train`, {});
}
/** The scenarios that can be trained from here. */
trainableScenarios(): Observable<{ scenarios: TrainableScenario[] }> {
return this.http.get<{ scenarios: TrainableScenario[] }>('/governance/scenarios');
}
/** Starts the training in the background: 202 with the job, 409 with the running one, 503 with no dbt manifest. */
startTrainingJob(domain: string, scenario: string): Observable<{ job: TrainingJob }> {
return this.http.post<{ job: TrainingJob }>(`/governance/model-versions/${domain}/${scenario}/train-jobs`, {});
}
trainingJobs(): Observable<{ jobs: TrainingJob[] }> {
return this.http.get<{ jobs: TrainingJob[] }>('/governance/training-jobs');
}
retireModelVersion(domain: string, scenario: string, version: string): Observable<ModelVersion> {
return this.http.post<ModelVersion>(`/governance/model-versions/${domain}/${scenario}/${version}/retire`, {});
}
@@ -136,3 +136,28 @@ export interface OcrRunSummary {
failed: number;
needs_review: number;
}
/** A scenario governance can train (`GET /governance/scenarios`); `produccion` is its version in production, if any. */
export interface TrainableScenario {
domain: string;
scenario: string;
cohort: string | null;
outcome: string | null;
description: string;
kind: 'cohorte' | 'referencia';
produccion: string | null;
}
export type TrainingJobState = 'en_curso' | 'completado' | 'entrenado_sin_promover' | 'fallido' | 'interrumpido';
/** A training in the background (`/governance/training-jobs`), with the tail of its outputs. */
export interface TrainingJob {
id: string;
domain: string;
scenario: string;
iniciado: string;
estado: TrainingJobState;
codigo: number | null;
salida: string;
error: string;
}