mirror of
https://github.com/enpaul/tox-poetry-installer.git
synced 2024-10-29 19:47:00 +00:00
Add logging for package installation completion
Currently, tox-poetry-installer logs when it submits a dependency to the (possibly-parallel) executor for installation, but not when the installation is finished; this commit adds a log message when the installation actually starts (in contrast with when the job is queued) and a log message when the installation completes, along with the wall time it took. Rationale: I've noticed in some cases when running under Python 3.10 packages take much longer to install -- this logging should help pinpoint culprits.
This commit is contained in:
parent
3c0b76a30f
commit
1478e35c0b
@ -5,6 +5,7 @@
|
||||
import concurrent.futures
|
||||
import contextlib
|
||||
import typing
|
||||
from datetime import datetime
|
||||
from typing import Sequence
|
||||
from typing import Set
|
||||
|
||||
@ -46,6 +47,13 @@ def install(
|
||||
|
||||
installed: Set[PoetryPackage] = set()
|
||||
|
||||
def logged_install(dependency: PoetryPackage) -> None:
|
||||
start = datetime.now()
|
||||
logger.debug(f"Installing {dependency}")
|
||||
pip.install(dependency)
|
||||
end = datetime.now()
|
||||
logger.debug(f"Finished installing {dependency} in {end - start}")
|
||||
|
||||
@contextlib.contextmanager
|
||||
def _optional_parallelize():
|
||||
"""A bit of cheat, really
|
||||
@ -66,8 +74,8 @@ def install(
|
||||
for dependency in packages:
|
||||
if dependency not in installed:
|
||||
installed.add(dependency)
|
||||
logger.debug(f"Installing {dependency}")
|
||||
executor(pip.install, dependency)
|
||||
logger.debug(f"Queuing {dependency}")
|
||||
executor(logged_install, dependency)
|
||||
else:
|
||||
logger.debug(f"Skipping {dependency}, already installed")
|
||||
logger.debug("Waiting for installs to finish...")
|
||||
|
Loading…
Reference in New Issue
Block a user