TS composing fails in multiprocessing
The parallelization problem occurs when n_jobs is -1 and task is ts_forecasting.
The script to reproduce:
https://github.com/nccr-itmo/FEDOT/blob/ts-bug/cases/ts_exp.py
The error:
File "D:\Projects\CompositeAutoML\fedot\core\optimisers\gp_comp\operators\evaluation.py", line 49, in __call__
evaluated_population = self.evaluate_dispatch(reversed_population)
File "D:\Projects\CompositeAutoML\fedot\core\optimisers\gp_comp\operators\evaluation.py", line 61, in evaluate_dispatch
with closing(multiprocessing.Pool(n_jobs)) as pool:
File "C:\Users\Nikolay\AppData\Local\Programs\Python\Python38\lib\multiprocessing\context.py", line 119, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild,
File "C:\Users\Nikolay\AppData\Local\Programs\Python\Python38\lib\multiprocessing\pool.py", line 212, in __init__
self._repopulate_pool()
File "C:\Users\Nikolay\AppData\Local\Programs\Python\Python38\lib\multiprocessing\pool.py", line 303, in _repopulate_pool
return self._repopulate_pool_static(self._ctx, self.Process,
File "C:\Users\Nikolay\AppData\Local\Programs\Python\Python38\lib\multiprocessing\pool.py", line 326, in _repopulate_pool_static
w.start()
File "C:\Users\Nikolay\AppData\Local\Programs\Python\Python38\lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
File "C:\Users\Nikolay\AppData\Local\Programs\Python\Python38\lib\multiprocessing\context.py", line 326, in _Popen
return Popen(process_obj)
File "C:\Users\Nikolay\AppData\Local\Programs\Python\Python38\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
prep_data = spawn.get_preparation_data(process_obj._name)
File "C:\Users\Nikolay\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
_check_not_importing_main()
File "C:\Users\Nikolay\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
raise RuntimeError('''
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.