File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -107,8 +107,14 @@ def apply(self, model):
107107 old_nodes .append (model .graph .node .pop ())
108108
109109 # Execute transformation in parallel
110- with mp .Pool (self ._num_workers ) as p :
111- new_nodes_and_bool = p .map (self .applyNodeLocal , old_nodes , chunksize = 1 )
110+ if self ._num_workers > 1 :
111+ with mp .Pool (self ._num_workers ) as p :
112+ new_nodes_and_bool = p .map (self .applyNodeLocal , old_nodes , chunksize = 1 )
113+ # execute without mp.Pool in case of 1 worker to simplify debugging
114+ else :
115+ new_nodes_and_bool = [self .applyNodeLocal (node ) for node in old_nodes ]
116+
117+
112118
113119 # extract nodes and check if the transformation needs to run again
114120 # Note: .pop() had initially reversed the node order
You can’t perform that action at this time.
0 commit comments