Commit 08ab6ca4 by Arun Babu Neelicattu Committed by finswimmer

executor: execute parallel unsafe ops serially

Resolves: #2658 #3086
parent 27858e82
...@@ -107,14 +107,33 @@ class Executor(object): ...@@ -107,14 +107,33 @@ class Executor(object):
self._sections = OrderedDict() self._sections = OrderedDict()
for _, group in groups: for _, group in groups:
tasks = [] tasks = []
serial_operations = []
for operation in group: for operation in group:
if self._shutdown: if self._shutdown:
break break
# Some operations are unsafe, we mus execute them serially in a group
# https://github.com/python-poetry/poetry/issues/3086
# https://github.com/python-poetry/poetry/issues/2658
#
# We need to explicitly check source type here, see:
# https://github.com/python-poetry/poetry-core/pull/98
is_parallel_unsafe = operation.job_type == "uninstall" or (
operation.package.develop
and operation.package.source_type in {"directory", "git"}
)
if not operation.skipped and is_parallel_unsafe:
serial_operations.append(operation)
continue
tasks.append(self._executor.submit(self._execute_operation, operation)) tasks.append(self._executor.submit(self._execute_operation, operation))
try: try:
wait(tasks) wait(tasks)
for operation in serial_operations:
wait([self._executor.submit(self._execute_operation, operation)])
except KeyboardInterrupt: except KeyboardInterrupt:
self._shutdown = True self._shutdown = True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment