Avoid creating tasks to install dependent requirements (#111048)
parent
dc4008c518
commit
17ba96ffdb
|
@ -226,21 +226,28 @@ class RequirementsManager:
|
||||||
if not deps_to_check:
|
if not deps_to_check:
|
||||||
return
|
return
|
||||||
|
|
||||||
results = await asyncio.gather(
|
exceptions: list[Exception] = []
|
||||||
*(
|
# We don't create tasks here since everything waits for the pip lock
|
||||||
self.async_get_integration_with_requirements(dep, done)
|
# anyways and we want to make sure we don't start a bunch of tasks
|
||||||
for dep in deps_to_check
|
# that will just wait for the lock.
|
||||||
),
|
for dep in deps_to_check:
|
||||||
return_exceptions=True,
|
# We want all the async_get_integration_with_requirements calls to
|
||||||
)
|
# happen even if one fails. So we catch the exception and store it
|
||||||
for result in results:
|
# to raise the first one after all are done to behave like asyncio
|
||||||
if not isinstance(result, BaseException):
|
# gather.
|
||||||
continue
|
try:
|
||||||
if not isinstance(result, IntegrationNotFound) or not (
|
await self.async_get_integration_with_requirements(dep, done)
|
||||||
not integration.is_built_in
|
except IntegrationNotFound as ex:
|
||||||
and result.domain in integration.after_dependencies
|
if (
|
||||||
):
|
integration.is_built_in
|
||||||
raise result
|
or ex.domain not in integration.after_dependencies
|
||||||
|
):
|
||||||
|
exceptions.append(ex)
|
||||||
|
except Exception as ex: # pylint: disable=broad-except
|
||||||
|
exceptions.insert(0, ex)
|
||||||
|
|
||||||
|
if exceptions:
|
||||||
|
raise exceptions[0]
|
||||||
|
|
||||||
async def async_process_requirements(
|
async def async_process_requirements(
|
||||||
self, name: str, requirements: list[str]
|
self, name: str, requirements: list[str]
|
||||||
|
|
Loading…
Reference in New Issue