Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 14 additions & 19 deletions docker/profiles/docker-compose.onnx-override.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
---
# Override file for ONNX-based semantic search in debug quickstart.
# Mounts the host-side model directory into the GMS debug container AND sets the
# semantic-search / ONNX environment directly on the GMS service so that
# semantic-search / ONNX environment on the GMS service so that
# OnnxEmbeddingProvider loads and activates at startup.
#
# The environment MUST live on the service here (not in the Gradle compose
# plugin's process env), because Compose does not inject the plugin's process
# environment into sibling service containers.
# The values live in env/docker/variants/onnx/, added to the service's env_file
# list here (not in the Gradle compose plugin's process env), because Compose
# does not inject the plugin's process environment into sibling service
# containers. ONNX_EMBEDDING_MODEL_DIR stays in environment: it is tied to the
# /datahub/models mount below.
#
# Used automatically by the quickstartDebugBuiltinEmbedding Gradle target.
# Not meant to be activated manually — use:
# ./gradlew quickstartDebugBuiltinEmbedding

services:
datahub-gms-debug:
# Compose appends this file after the service's whole env_file list, so it wins over the
# extension, job and ad-hoc layers; only environment: beats it.
env_file:
- ../../env/docker/variants/onnx/gms.env

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Compose appends an override file's env_file entries after the base service's list, so this ONNX file now wins over every layer in the base list: env/docker/gms.env, <mode>/all.env, the extension dir and the job dir. That is the reverse of the documented order, where variants sit below the extension and job layers. I confirmed it by rendering with an ad-hoc file that sets one of these keys: the ONNX value wins.

Before this PR the same values sat in the override's environment: block, which also outranks env_file, so an ad-hoc or job file could not override them then either. The change is not a regression. It does mean the new layering doc is wrong for this variant.

Either document that the ONNX variant is last, or add the variant to the base env_file list at its normal position. The same applies to system-update-debug below.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Confirmed: the override's env_file entries are appended after the service's whole list, so the ONNX variant beats the extension, job and ad-hoc layers. Kept the behaviour and documented it in env/README.md and next to each env_file in the override (fda3c07). Only environment: beats it.

environment:
EMBEDDING_PROVIDER_TYPE: onnx
ELASTICSEARCH_SEMANTIC_SEARCH_ENABLED: "true"
SEARCH_SERVICE_SEMANTIC_SEARCH_ENABLED: "true"
ONNX_EMBEDDING_MODEL_NAME: snowflake_arctic_embed_s
ONNX_EMBEDDING_MODEL_DIR: /datahub/models/snowflake_arctic_embed_s
ELASTICSEARCH_ENTITY_INDEX_SEMANTIC_SEARCH_MODELS_SNOWFLAKE_ARCTIC_EMBED_S_VECTORDIMENSION: "384"
# Arctic-embed is CLS-pooled and expects a query instruction prefix.
ONNX_EMBEDDING_POOLING: cls
ONNX_EMBEDDING_QUERY_INSTRUCTION: "Represent this sentence for searching relevant passages: "
volumes:
- ../datahub-gms-onnx/models:/datahub/models:ro
# Shadow the default (slim) war with the onnx boot archive so the debug stack runs the same
Expand All @@ -37,15 +35,12 @@ services:
# it either skips the semantic index (flags off) or fails to start the
# provider bean (flags on, model missing). It mirrors the GMS service exactly.
system-update-debug:
# Compose appends this file after the service's whole env_file list, so it wins over the
# extension, job and ad-hoc layers; only environment: beats it.
env_file:
- ../../env/docker/variants/onnx/system-update.env
environment:
EMBEDDING_PROVIDER_TYPE: onnx
ELASTICSEARCH_SEMANTIC_SEARCH_ENABLED: "true"
SEARCH_SERVICE_SEMANTIC_SEARCH_ENABLED: "true"
ONNX_EMBEDDING_MODEL_NAME: snowflake_arctic_embed_s
ONNX_EMBEDDING_MODEL_DIR: /datahub/models/snowflake_arctic_embed_s
ELASTICSEARCH_ENTITY_INDEX_SEMANTIC_SEARCH_MODELS_SNOWFLAKE_ARCTIC_EMBED_S_VECTORDIMENSION: "384"
ONNX_EMBEDDING_POOLING: cls
ONNX_EMBEDDING_QUERY_INSTRUCTION: "Represent this sentence for searching relevant passages: "
volumes:
- ../datahub-gms-onnx/models:/datahub/models:ro
# Shadow the default (slim) jar with the onnx boot archive so system-update embeds via the
Expand Down
6 changes: 5 additions & 1 deletion env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ names are `gms`, `system-update`, `mae-consumer`, `mce-consumer`, `frontend`, `a
`${DATAHUB_ENV_MODE}/` subfolder, then in its `docker/` subfolder (values only compose reads).
4. Ad-hoc: `DATAHUB_LOCAL_COMMON_ENV`, then `DATAHUB_LOCAL_<SERVICE>_ENV`.

Compose's `environment:` blocks beat every file. Every entry except the existing service files and
Compose's `environment:` blocks beat every file. The one exception to the order above is the `onnx`
variant: `docker-compose.onnx-override.yml` adds `env/docker/variants/onnx/<service>.env` to the debug
`gms` and `system-update` services after their whole list, so it wins over the extension, job and
ad-hoc layers too, and only `environment:` beats it. To change an ONNX value, edit the variant file
or the override. Every entry except the existing service files and
the ad-hoc slots is optional and skipped when the file is missing. An unset directory variable
resolves to `.unset`, a folder that does not exist under `docker/profiles/`, so its entries are
skipped. Set the directory variables to absolute paths: a relative path is resolved from
Expand Down
10 changes: 10 additions & 0 deletions env/docker/variants/onnx/gms.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ONNX semantic search for the debug quickstart (quickstartDebugBuiltinEmbedding). Arctic-embed is
# CLS-pooled and expects a query instruction prefix. The model dir stays in the override file's
# environment: it is tied to the /datahub/models mount.
EMBEDDING_PROVIDER_TYPE=onnx
ELASTICSEARCH_SEMANTIC_SEARCH_ENABLED=true
SEARCH_SERVICE_SEMANTIC_SEARCH_ENABLED=true
ONNX_EMBEDDING_MODEL_NAME=snowflake_arctic_embed_s
ELASTICSEARCH_ENTITY_INDEX_SEMANTIC_SEARCH_MODELS_SNOWFLAKE_ARCTIC_EMBED_S_VECTORDIMENSION=384
ONNX_EMBEDDING_POOLING=cls
ONNX_EMBEDDING_QUERY_INSTRUCTION="Represent this sentence for searching relevant passages: "
10 changes: 10 additions & 0 deletions env/docker/variants/onnx/system-update.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ONNX semantic search for the debug quickstart (quickstartDebugBuiltinEmbedding). Arctic-embed is
# CLS-pooled and expects a query instruction prefix. The model dir stays in the override file's
# environment: it is tied to the /datahub/models mount.
EMBEDDING_PROVIDER_TYPE=onnx
ELASTICSEARCH_SEMANTIC_SEARCH_ENABLED=true
SEARCH_SERVICE_SEMANTIC_SEARCH_ENABLED=true
ONNX_EMBEDDING_MODEL_NAME=snowflake_arctic_embed_s
ELASTICSEARCH_ENTITY_INDEX_SEMANTIC_SEARCH_MODELS_SNOWFLAKE_ARCTIC_EMBED_S_VECTORDIMENSION=384
ONNX_EMBEDDING_POOLING=cls
ONNX_EMBEDDING_QUERY_INSTRUCTION="Represent this sentence for searching relevant passages: "
Loading