From c2a9ea22d6800761d2fadca75a200a121e57c734 Mon Sep 17 00:00:00 2001 From: you-n-g Date: Sun, 8 Aug 2021 22:58:28 +0800 Subject: [PATCH] Fix shared task dict BUG --- qlib/workflow/task/gen.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qlib/workflow/task/gen.py b/qlib/workflow/task/gen.py index e60fa4755b..2fc87b1a46 100644 --- a/qlib/workflow/task/gen.py +++ b/qlib/workflow/task/gen.py @@ -162,8 +162,7 @@ def gen_following_tasks(self, task: dict, test_end: pd.Timestamp) -> List[dict]: List[dict]: the following tasks of `task`(`task` itself is excluded) """ - t = copy.deepcopy(task) - prev_seg = t["dataset"]["kwargs"]["segments"] + prev_seg = task["dataset"]["kwargs"]["segments"] while True: segments = {} try: @@ -184,6 +183,7 @@ def gen_following_tasks(self, task: dict, test_end: pd.Timestamp) -> List[dict]: break prev_seg = segments + t = copy.deepcopy(task) # deepcopy is necessary to avoid modify task inplace self._update_task_segs(t, segments) yield t