Skip to content

Commit

Permalink
executor: execute parallel unsafe ops serially
Browse files Browse the repository at this point in the history
  • Loading branch information
abn committed Oct 6, 2020
1 parent f2d53e5 commit b1e7f4f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions poetry/installation/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,30 @@ def execute(self, operations): # type: (Operation) -> int
self._sections = OrderedDict()
for _, group in groups:
tasks = []
serial_operations = []
for operation in group:
if self._shutdown:
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
is_parallel_unsafe = operation.job_type == "uninstall" or (
operation.package.develop
and operation.package.source_type == "directory"
)
if not operation.skipped and is_parallel_unsafe:
serial_operations.append(operation)
continue

tasks.append(self._executor.submit(self._execute_operation, operation))

try:
wait(tasks)

for operation in serial_operations:
wait([self._executor.submit(self._execute_operation, operation)])

except KeyboardInterrupt:
self._shutdown = True

Expand Down

0 comments on commit b1e7f4f

Please sign in to comment.