refactor(ocr): extract exportSenderData helper in triggerSenderTraining
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -126,10 +126,7 @@ public class SenderModelService {
|
|||||||
log.info("Started sender training run {} for person {}", runId, personId);
|
log.info("Started sender training run {} for person {}", runId, personId);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
byte[] zipBytes = exportSenderData(personId);
|
||||||
trainingDataExportService.exportForSender(personId).writeTo(baos);
|
|
||||||
byte[] zipBytes = baos.toByteArray();
|
|
||||||
|
|
||||||
log.info("[trainingRun={}] Sending {} bytes to OCR service for sender training", runId, zipBytes.length);
|
log.info("[trainingRun={}] Sending {} bytes to OCR service for sender training", runId, zipBytes.length);
|
||||||
OcrClient.TrainingResult result = ocrClient.trainSenderModel(zipBytes, outputModelPath);
|
OcrClient.TrainingResult result = ocrClient.trainSenderModel(zipBytes, outputModelPath);
|
||||||
|
|
||||||
@@ -166,6 +163,12 @@ public class SenderModelService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private byte[] exportSenderData(UUID personId) throws java.io.IOException {
|
||||||
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
trainingDataExportService.exportForSender(personId).writeTo(baos);
|
||||||
|
return baos.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Promotes the oldest QUEUED sender run to RUNNING and triggers its training.
|
* Promotes the oldest QUEUED sender run to RUNNING and triggers its training.
|
||||||
* Called in the finally block of triggerSenderTraining, creating a sequential chain:
|
* Called in the finally block of triggerSenderTraining, creating a sequential chain:
|
||||||
|
|||||||
Reference in New Issue
Block a user