Repository navigation
refactor(monitor): delegate dispatch to shared QPK runner - #605
Merged
Merged
Conversation
Replace the duplicated ~270-line dispatcher with a thin compatibility facade over quant_platform_kit.common.platform_runner.monitor at the pinned QPK revision 350dd38. Public names and the application.monitor_dispatcher import path stay unchanged; main.py and tests need no changes. Behavior equivalence: the local module was function-for-function identical to QPK except _fetch_id_token. QPK defaults QSL_CLOUD_PROVIDER to gcp, whose GcpDeploymentContext.fetch_id_token performs the same id_token.fetch_id_token(Request(), audience) call, and neither the LB repo nor its deploy config sets QSL_CLOUD_PROVIDER. No QPK pin, CI, or deployment workflow changes are included. Verification: - baseline on origin/main 32eee32: 2161 passed, 3 skipped, 176 subtests - after: 2161 passed, 3 skipped, 176 subtests - uv run pytest -q tests/test_monitor_dispatcher.py: 2 passed - uv run ruff check .: all checks passed Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动
把
application/monitor_dispatcher.py从 ~270 行重复实现缩成薄门面,全部实现复用 QPK pin350dd38ece0952beef096893a7dcf8ae3871609a中的quant_platform_kit.common.platform_runner.monitor。__all__,无import *):MONITOR_TARGET_ENV_NAMES、DEFAULT_LOOKBACK_MINUTES、DEFAULT_TIMEOUT_SECONDS、DEFAULT_MAX_WORKERS、MonitorWindow、MONITOR_WINDOWS、load_monitor_targets、dispatch_due_monitorsmain.py与tests/test_monitor_dispatcher.py的导入路径和调用不变pyproject.toml、uv.lock、CI 或部署 workflow行为等价依据
本地模块与 QPK 版本逐函数相同,唯一差异是
_fetch_id_token:id_token.fetch_id_token(Request(), audience)get_deployment_context().fetch_id_token(audience)QPK 默认
QSL_CLOUD_PROVIDER=gcp,其GcpDeploymentContext.fetch_id_token执行的正是同样的id_token.fetch_id_token(Request(), audience)。LB 仓库与部署配置均未设置QSL_CLOUD_PROVIDER,因此运行时行为等价。已确认无其他代码依赖该模块的私有函数(
_fetch_id_token、_send_dispatch、_iter_due_dispatches等)。tests/test_request_handling.py对main模块命名空间的 monkeypatch 仍作用在导入后的同一对象上。验证
32eee32)uv run pytest -q testsuv run pytest -q testsuv run pytest -q tests/test_monitor_dispatcher.pyuv run ruff check .无新增失败,失败/跳过项与基线一致。
风险
google.oauth2.id_token改为经get_deployment_context();在当前默认 provider 下等价,若未来主动设置非 gcp 的QSL_CLOUD_PROVIDER,行为会随之切换到对应 provider 实现。不合并、不部署,等待评审。
🤖 Generated with Claude Code