feat: separate worker into ingestion and export instances(MAPCO-9571)#95
feat: separate worker into ingestion and export instances(MAPCO-9571)#95almog8k wants to merge 7 commits into
Conversation
Provides the shared InstanceType const and type used to select the worker domain.
Each worker process now runs as a single instanceType (ingestion or export), read from config: - JobProcessor builds its poll set from the instance domain only. - containerConfig validates instanceType at startup, registers only that domain's handler, and validates only the directories that domain needs. - handlerFactory resolves a single INGESTION or EXPORT token instead of per-job-type tokens. - InstanceType const/type are now sourced from @map-colonies/raster-shared.
Adds the instanceType key (default ingestion) and its INSTANCE_TYPE env mapping.
configmap.yaml and deployment.yaml reference common.metrics.merged, which was missing and broke rendering.
Adds the instanceType value and renders only the relevant domain's env vars, volumes and S3 secret. A guard fails the render fast when instanceType is missing or invalid.
Adds ingestion/export polling cases and updates fixtures/mocks for the single INGESTION/EXPORT handler tokens.
| @@ -1,4 +1,5 @@ | |||
| { | |||
| "instanceType": "ingestion", | |||
There was a problem hiding this comment.
avoid set default value of worker by leave it empty spherically when you have this helper schema that validate for the supported values
There was a problem hiding this comment.
Changed to empty string
| {{- include "polygon-parts-worker.validateInstanceType" . -}} | ||
| {{- $releaseName := .Release.Name -}} | ||
| {{- $chartName := include "polygon-parts-worker.name" . -}} | ||
| {{- $metrics := (include "common.metrics.merged" .) | fromYaml }} |
There was a problem hiding this comment.
out of context but please remove as nothing uses the $metrics in the file
There was a problem hiding this comment.
Will handle in another pr
| {{- include "common.tplvalues.merge" ( dict "values" ( list .Values.tracing .Values.global.tracing ) "context" . ) }} | ||
| {{- end -}} | ||
|
|
||
| {{- define "common.metrics.merged" -}} |
There was a problem hiding this comment.
although it out of context
do we need it for the metrics buckets? if so, can you add the "buckets" under the mclabel prometheus scope as we did with "overseer":
https://github.com/MapColonies/overseer/pull/101/changes#diff-81801117ec01136c8a49bfcd42af8e104f4efad1f2daccda9da9d960eaad5279
see values.yaml buckets list within mclabels scope
There was a problem hiding this comment.
Will handle in another pr
| VALIDATION_REPORTS_PATH: {{ $validationReportsLocation | quote }} | ||
| INGESTION_SOURCES_DIR_PATH: {{ printf "/%s" $fs.ingestionSourcePvc.mountPath | quote }} | ||
| REPORT_STORAGE_PROVIDER: {{ $storage.reportProvider }} | ||
| DOWNLOAD_SERVER_PUBLIC_DNS: {{ $serviceUrls.downloadServerPublicDNS | quote }} |
There was a problem hiding this comment.
im not sure, can you check if this env is used by the export job aswell?
There was a problem hiding this comment.
DOWNLOAD_SERVER_PUBLIC_DNS is used only in ingestion scope
|
|
||
| public static mockJobManagerSearchTasks(jobType: string, taskTypes: string[], task: ITaskResponse<unknown>): void { | ||
| for (const handler of Object.values(handlers)) { | ||
| for (const currentJobType of Object.values(jobTypes)) { |
There was a problem hiding this comment.
avoid "current" leave it as "jobType"
There was a problem hiding this comment.
changed to "jobType"
| }); | ||
|
|
||
| afterEach(() => { | ||
| nock.cleanAll(); |
There was a problem hiding this comment.
add the eslint rule to ignore nock imports
There was a problem hiding this comment.
Added nock imports ignore
|
lets talk about the metrics issue, we can separate it from this PR and handle it right after this one |
Ok, lets handle it in separate pr. |
ce55e99 to
156193b
Compare
Summary
The worker previously polled all four job types in a single deployment (3 ingestion jobs + Export). This change lets a worker process run as a single instanceType —
ingestionorexport— so the two domains can be deployed and scaled independently, each carrying only the resources its domain needs.Changes
instanceTypeconfig value (ingestion|export) drives everything:JobProcessorpolls only the job types of its domain.containerConfigvalidatesinstanceTypeat startup, registers only that domain's handler, and validates only the directories that domain uses.handlerFactoryresolves a singleINGESTION/EXPORThandler token (new/update/swap all map to the one ingestion handler).instanceTypekey +INSTANCE_TYPEenv mapping (defaultingestion).instanceType, with a guard that fails the render fast on a missing/invalid value. Also restores the missingcommon.metrics.mergedhelper.@map-colonies/raster-sharedto^8.2.0for the sharedInstanceTypeconst/type.Verification
npm test(tsc + 127 unit + 23 integration) passes;eslintclean.helm templatefor each instanceType renders the correct domain-only env/volumes; the guard fails fast wheninstanceTypeis unset or invalid.