From 4c5bdaad10e879358747a836c54641beed179642 Mon Sep 17 00:00:00 2001 From: Matheus Moreno Date: Wed, 22 Dec 2021 22:06:08 -0300 Subject: [PATCH] Do not modify tags dict on start_run() (#5191) * Do not modify tags dict on start_run() Signed-off-by: Matheus Moreno * Do not rewrite tags param on create_run() Signed-off-by: Matheus Moreno * Rename variable in start_run() Signed-off-by: Matheus Moreno * Revert "Do not rewrite tags param on create_run()" This reverts commit 355fcd4a0b7b75366d3dee4c49b12683558cf20c. Signed-off-by: Matheus Moreno --- mlflow/tracking/fluent.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mlflow/tracking/fluent.py b/mlflow/tracking/fluent.py index 793e8b1020aa2..19a9346235219 100644 --- a/mlflow/tracking/fluent.py +++ b/mlflow/tracking/fluent.py @@ -8,6 +8,7 @@ import time import logging import inspect +from copy import deepcopy from packaging.version import Version from typing import Any, Dict, List, Optional, Union, TYPE_CHECKING @@ -278,15 +279,15 @@ def start_run( exp_id_for_run = experiment_id if experiment_id is not None else _get_experiment_id() - user_specified_tags = tags or {} + user_specified_tags = deepcopy(tags) or {} if parent_run_id is not None: user_specified_tags[MLFLOW_PARENT_RUN_ID] = parent_run_id if run_name is not None: user_specified_tags[MLFLOW_RUN_NAME] = run_name - tags = context_registry.resolve_tags(user_specified_tags) + resolved_tags = context_registry.resolve_tags(user_specified_tags) - active_run_obj = client.create_run(experiment_id=exp_id_for_run, tags=tags) + active_run_obj = client.create_run(experiment_id=exp_id_for_run, tags=resolved_tags) _active_run_stack.append(ActiveRun(active_run_obj)) return _active_run_stack[-1]