Skip to content

feat: separate worker into ingestion and export instances(MAPCO-9571)#95

Open
almog8k wants to merge 7 commits into
masterfrom
feat/seperate-deployments
Open

feat: separate worker into ingestion and export instances(MAPCO-9571)#95
almog8k wants to merge 7 commits into
masterfrom
feat/seperate-deployments

Conversation

@almog8k

@almog8k almog8k commented Jun 22, 2026

Copy link
Copy Markdown
Contributor
Question Answer
Tests added
Chore

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 instanceTypeingestion or export — so the two domains can be deployed and scaled independently, each carrying only the resources its domain needs.

Changes

  • Domain selection — a new instanceType config value (ingestion | export) drives everything:
    • JobProcessor polls only the job types of its domain.
    • containerConfig validates instanceType at startup, registers only that domain's handler, and validates only the directories that domain uses.
    • handlerFactory resolves a single INGESTION/EXPORT handler token (new/update/swap all map to the one ingestion handler).
  • ConfiginstanceType key + INSTANCE_TYPE env mapping (default ingestion).
  • Helm — renders only the relevant domain's env vars, volumes and S3 secret per instanceType, with a guard that fails the render fast on a missing/invalid value. Also restores the missing common.metrics.merged helper.
  • Deps — bumps @map-colonies/raster-shared to ^8.2.0 for the shared InstanceType const/type.
  • Tests — ingestion/export polling cases; fixtures/mocks updated for the single handler tokens.

Verification

  • npm test (tsc + 127 unit + 23 integration) passes; eslint clean.
  • helm template for each instanceType renders the correct domain-only env/volumes; the guard fails fast when instanceType is unset or invalid.

almog8k added 6 commits June 22, 2026 11:28
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.
@almog8k almog8k changed the title feat: separate worker into ingestion and export instances feat: separate worker into ingestion and export instances(MAPCO-9571) Jun 22, 2026
Comment thread config/default.json Outdated
@@ -1,4 +1,5 @@
{
"instanceType": "ingestion",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid set default value of worker by leave it empty spherically when you have this helper schema that validate for the supported values

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to empty string

{{- include "polygon-parts-worker.validateInstanceType" . -}}
{{- $releaseName := .Release.Name -}}
{{- $chartName := include "polygon-parts-worker.name" . -}}
{{- $metrics := (include "common.metrics.merged" .) | fromYaml }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of context but please remove as nothing uses the $metrics in the file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will handle in another pr

{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.tracing .Values.global.tracing ) "context" . ) }}
{{- end -}}

{{- define "common.metrics.merged" -}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not sure, can you check if this env is used by the export job aswell?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DOWNLOAD_SERVER_PUBLIC_DNS is used only in ingestion scope

Comment thread tests/integration/mocks/httpMocks.ts Outdated

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)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid "current" leave it as "jobType"

@almog8k almog8k Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to "jobType"

});

afterEach(() => {
nock.cleanAll();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the eslint rule to ignore nock imports

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added nock imports ignore

@CL-SHLOMIKONCHA

Copy link
Copy Markdown
Contributor

lets talk about the metrics issue, we can separate it from this PR and handle it right after this one

@almog8k

almog8k commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

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.

@almog8k almog8k force-pushed the feat/seperate-deployments branch from ce55e99 to 156193b Compare June 28, 2026 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants