runtime-split-patch-b
parent
74609e481d
commit
44995cebf7
@ -0,0 +1,59 @@
|
||||
# Runtime split Patch B
|
||||
|
||||
Patch B builds on Patch A and makes the NEW runtime actually process embedding jobs.
|
||||
|
||||
## What changes
|
||||
|
||||
### 1. New embedding job scheduler
|
||||
Adds:
|
||||
|
||||
- `EmbeddingJobScheduler`
|
||||
- `EmbeddingJobSchedulingConfiguration`
|
||||
|
||||
Behavior:
|
||||
- enabled only in `NEW` runtime mode
|
||||
- active only when `dip.embedding.jobs.enabled=true`
|
||||
- periodically calls:
|
||||
- `RepresentationEmbeddingOrchestrator.processNextReadyBatch()`
|
||||
|
||||
### 2. Generic import hands off to the new embedding job path
|
||||
`GenericDocumentImportService` is updated so that in `NEW` mode it:
|
||||
|
||||
- resolves `dip.embedding.default-document-model`
|
||||
- ensures the model is registered in `DOC.doc_embedding_model`
|
||||
- creates embedding jobs through:
|
||||
- `RepresentationEmbeddingOrchestrator.enqueueRepresentation(...)`
|
||||
|
||||
It no longer creates legacy-style pending embeddings as the primary handoff for the NEW runtime path.
|
||||
|
||||
## Notes
|
||||
|
||||
- This patch assumes Patch A has already introduced:
|
||||
- `RuntimeMode`
|
||||
- `RuntimeModeProperties`
|
||||
- `@ConditionalOnRuntimeMode`
|
||||
- This patch does not yet remove the legacy vectorization runtime.
|
||||
That remains the job of subsequent cutover steps.
|
||||
|
||||
## Expected runtime behavior in NEW mode
|
||||
|
||||
- `GenericDocumentImportService` persists new generic representations
|
||||
- selected representations are queued into `DOC.doc_embedding_job`
|
||||
- scheduler processes pending jobs
|
||||
- vectors are persisted through the new embedding subsystem
|
||||
|
||||
## New config
|
||||
|
||||
Example:
|
||||
|
||||
```yaml
|
||||
dip:
|
||||
runtime:
|
||||
mode: NEW
|
||||
|
||||
embedding:
|
||||
enabled: true
|
||||
jobs:
|
||||
enabled: true
|
||||
scheduler-delay-ms: 5000
|
||||
```
|
||||
@ -0,0 +1,12 @@
|
||||
package at.procon.dip.embedding.config;
|
||||
|
||||
import at.procon.dip.runtime.condition.ConditionalOnRuntimeMode;
|
||||
import at.procon.dip.runtime.config.RuntimeMode;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@Configuration
|
||||
@EnableScheduling
|
||||
@ConditionalOnRuntimeMode(RuntimeMode.NEW)
|
||||
public class EmbeddingJobSchedulingConfiguration {
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package at.procon.dip.embedding.job;
|
||||
|
||||
import at.procon.dip.embedding.service.RepresentationEmbeddingOrchestrator;
|
||||
import at.procon.dip.runtime.condition.ConditionalOnRuntimeMode;
|
||||
import at.procon.dip.runtime.config.RuntimeMode;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@ConditionalOnRuntimeMode(RuntimeMode.NEW)
|
||||
@ConditionalOnProperty(prefix = "dip.embedding.jobs", name = "enabled", havingValue = "true")
|
||||
public class EmbeddingJobScheduler {
|
||||
|
||||
private final RepresentationEmbeddingOrchestrator orchestrator;
|
||||
|
||||
@Scheduled(fixedDelayString = "${dip.embedding.jobs.scheduler-delay-ms:5000}")
|
||||
public void processNextBatch() {
|
||||
try {
|
||||
int processed = orchestrator.processNextReadyBatch();
|
||||
if (processed > 0) {
|
||||
log.debug("NEW runtime embedding job scheduler processed {} job(s)", processed);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.warn("NEW runtime embedding job scheduler failed: {}", ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,9 @@
|
||||
dip:
|
||||
runtime:
|
||||
mode: NEW
|
||||
|
||||
embedding:
|
||||
enabled: true
|
||||
jobs:
|
||||
enabled: true
|
||||
scheduler-delay-ms: 5000
|
||||
|
||||
Loading…
Reference in New Issue