Skip to content

Commit 5d95d54

Browse files
authored
Update gen.py (microsoft#576)
1 parent b7bcd44 commit 5d95d54

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

qlib/workflow/task/gen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ def gen_following_tasks(self, task: dict, test_end: pd.Timestamp) -> List[dict]:
162162
List[dict]:
163163
the following tasks of `task`(`task` itself is excluded)
164164
"""
165-
t = copy.deepcopy(task)
166-
prev_seg = t["dataset"]["kwargs"]["segments"]
165+
prev_seg = task["dataset"]["kwargs"]["segments"]
167166
while True:
168167
segments = {}
169168
try:
@@ -184,6 +183,7 @@ def gen_following_tasks(self, task: dict, test_end: pd.Timestamp) -> List[dict]:
184183
break
185184

186185
prev_seg = segments
186+
t = copy.deepcopy(task) # deepcopy is necessary to avoid modify task inplace
187187
self._update_task_segs(t, segments)
188188
yield t
189189

0 commit comments

Comments
 (0)