From 55f3b7fa552271d35d02b8b160bb07dedfb606ad Mon Sep 17 00:00:00 2001 From: StardustDL Date: Mon, 5 Feb 2024 21:28:37 +0800 Subject: [PATCH] [update] fix std duration --- README.md | 3 +++ index/std.py | 63 +++++++++++++++++++++++++++------------------------- 2 files changed, 36 insertions(+), 30 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..6c5935d --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# AexPy Package Index + +Scheduled data processing tasks for [online AexPy](https://aexpy.netlify.app/). diff --git a/index/std.py b/index/std.py index a53519d..391debf 100644 --- a/index/std.py +++ b/index/std.py @@ -4,6 +4,7 @@ from aexpy.environments.conda import CondaEnvironment, CondaEnvironmentBuilder from aexpy.extracting.environment import getExtractorEnvironmentBuilder from aexpy.models import Release, ReleasePair, ApiDescription +from aexpy import utils from index.dist import DistPathBuilder from index.processor import ProcessDB @@ -87,41 +88,43 @@ def version(self, release): totalResult: ApiDescription | None = None totalLog = "" - for module in modules: - env.logger.info(f"Process stdlib: {module}") - result = self.worker.preprocess( - [ - "-s", - str(rootPath), - "-p", - str(release), - "-P", - release.version, - "-m", - module, - "-", - ], - check=True, - ) - result = self.worker.extract( - ["-", "-", "-e", e.name], input=result.out - ) - totalLog += result.log - - if result.data is None: - continue - - if totalResult is None: - totalResult = result.data - else: - for entry in result.data.entries.values(): - if entry.id not in totalResult.entries: - totalResult.addEntry(entry) + with utils.elapsedTimer() as timer: + for module in modules: + env.logger.info(f"Process stdlib: {module}") + result = self.worker.preprocess( + [ + "-s", + str(rootPath), + "-p", + str(release), + "-P", + release.version, + "-m", + module, + "-", + ], + check=True, + ) + result = self.worker.extract( + ["-", "-", "-e", e.name], input=result.out + ) + totalLog += result.log + + if result.data is None: + continue + + if totalResult is None: + totalResult = result.data + else: + for entry in result.data.entries.values(): + if entry.id not in totalResult.entries: + totalResult.addEntry(entry) if totalResult is None: finalResult = AexPyResult( code=1, log="Failed to dump", out="" ) else: + totalResult.duration = timer() finalResult = AexPyResult( out=totalResult.model_dump_json(), log=totalLog, code=0 )