From 1d6c3c3d83e898c43de1c100ba7f0db9af0f9117 Mon Sep 17 00:00:00 2001 From: XkunW Date: Mon, 6 Oct 2025 11:05:14 -0400 Subject: [PATCH 1/4] Use cached collector to preserve state between calls for throuput calculation --- vec_inf/cli/_cli.py | 2 +- vec_inf/client/api.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/vec_inf/cli/_cli.py b/vec_inf/cli/_cli.py index 778ee4de..dfe5eecd 100644 --- a/vec_inf/cli/_cli.py +++ b/vec_inf/cli/_cli.py @@ -447,7 +447,7 @@ def metrics(slurm_job_id: str) -> None: metrics_formatter.format_metrics() live.update(metrics_formatter.table) - time.sleep(2) + time.sleep(1) except click.ClickException as e: raise e except Exception as e: diff --git a/vec_inf/client/api.py b/vec_inf/client/api.py index 9424f326..cec6e4db 100644 --- a/vec_inf/client/api.py +++ b/vec_inf/client/api.py @@ -81,7 +81,7 @@ class VecInfClient: def __init__(self) -> None: """Initialize the Vector Inference client.""" - pass + self._metrics_collectors: dict[str, PerformanceMetricsCollector] = {} def list_models(self) -> list[ModelInfo]: """List all available models. @@ -218,7 +218,11 @@ def get_metrics(self, slurm_job_id: str) -> MetricsResponse: - Performance metrics or error message - Timestamp of collection """ - performance_metrics_collector = PerformanceMetricsCollector(slurm_job_id) + # Use cached collector to preserve state between calls for throughput calculation + if slurm_job_id not in self._metrics_collectors: + self._metrics_collectors[slurm_job_id] = PerformanceMetricsCollector(slurm_job_id) + + performance_metrics_collector = self._metrics_collectors[slurm_job_id] metrics: Union[dict[str, float], str] if not performance_metrics_collector.metrics_url.startswith("http"): From 3ff51f2bdb91b94fac59ea79afba324ede569965 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Oct 2025 15:07:31 +0000 Subject: [PATCH 2/4] [pre-commit.ci] Add auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- vec_inf/client/api.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vec_inf/client/api.py b/vec_inf/client/api.py index cec6e4db..d936bfee 100644 --- a/vec_inf/client/api.py +++ b/vec_inf/client/api.py @@ -220,8 +220,10 @@ def get_metrics(self, slurm_job_id: str) -> MetricsResponse: """ # Use cached collector to preserve state between calls for throughput calculation if slurm_job_id not in self._metrics_collectors: - self._metrics_collectors[slurm_job_id] = PerformanceMetricsCollector(slurm_job_id) - + self._metrics_collectors[slurm_job_id] = PerformanceMetricsCollector( + slurm_job_id + ) + performance_metrics_collector = self._metrics_collectors[slurm_job_id] metrics: Union[dict[str, float], str] From b3455468ead34c0e07b991f38a0e4ce4f157956d Mon Sep 17 00:00:00 2001 From: XkunW Date: Mon, 6 Oct 2025 11:11:41 -0400 Subject: [PATCH 3/4] Shorten over-length comment --- vec_inf/client/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vec_inf/client/api.py b/vec_inf/client/api.py index d936bfee..a2bcaf61 100644 --- a/vec_inf/client/api.py +++ b/vec_inf/client/api.py @@ -218,7 +218,7 @@ def get_metrics(self, slurm_job_id: str) -> MetricsResponse: - Performance metrics or error message - Timestamp of collection """ - # Use cached collector to preserve state between calls for throughput calculation + # Use cached collector to preserve state between calls to compute throughput if slurm_job_id not in self._metrics_collectors: self._metrics_collectors[slurm_job_id] = PerformanceMetricsCollector( slurm_job_id From 5e1ce48ec6e79eb7ae9aa1a27c358c7066a6396b Mon Sep 17 00:00:00 2001 From: XkunW Date: Mon, 6 Oct 2025 11:32:01 -0400 Subject: [PATCH 4/4] Ignore pip advisory vulnerability until fixed in pip>=25.3 --- .github/workflows/code_checks.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/code_checks.yml b/.github/workflows/code_checks.yml index 8b1fc469..bc0eeb38 100644 --- a/.github/workflows/code_checks.yml +++ b/.github/workflows/code_checks.yml @@ -49,3 +49,5 @@ jobs: uses: pypa/gh-action-pip-audit@v1.1.0 with: virtual-environment: .venv/ + # Temporary: ignore pip advisory until fixed in pip>=25.3 + ignore-vulns: GHSA-4xh5-x5gv-qwph