Skip to content
Snippets Groups Projects
Commit 6d7ab958 authored by Manon Blanco's avatar Manon Blanco Committed by Yoann Schneider
Browse files

Store model_version details regardless of model version configuration

parent a6016b8d
No related branches found
No related tags found
1 merge request!500Store model_version details regardless of model version configuration
Pipeline #161009 passed
......@@ -148,6 +148,13 @@ class BaseWorker:
# there is at least one available sqlite database either given or in the parent tasks
self.use_cache = False
# model_version_id will be updated in configure() using the worker_run's model version
# or in configure_for_developers() from the environment
self.model_version_id = None
# model_details will be updated in configure() using the worker_run's model version
# or in configure_for_developers() from the environment
self.model_details = {}
# task_parents will be updated in configure_cache() if the cache is supported,
# if the task ID is set and if no database is passed as argument
self.task_parents = []
......@@ -257,15 +264,15 @@ class BaseWorker:
# Load model version configuration when available
model_version = worker_run.get("model_version")
if model_version and model_version.get("configuration"):
if model_version:
logger.info("Loaded model version configuration from WorkerRun")
self.model_configuration.update(model_version.get("configuration"))
self.model_configuration.update(model_version["configuration"])
# Set model_version ID as worker attribute
self.model_version_id = model_version.get("id")
self.model_version_id = model_version["id"]
# Set model details as worker attribute
self.model_details = model_version.get("model")
self.model_details = model_version["model"]
# Retrieve initial configuration from API
self.config = worker_version["configuration"].get("configuration", {})
......
......@@ -467,6 +467,10 @@ def test_worker_config_multiple_source(
"id": "12341234-1234-1234-1234-123412341234",
"name": "Model version 1337",
"configuration": model_config,
"model": {
"id": "hahahaha-haha-haha-haha-hahahahahaha",
"name": "My model",
},
},
"process": {
"name": None,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment