Public Access
DEVX-66: fix: calibrate molecule weights from actual CI execution times
Post-merge / detect-type (push) Successful in 31s
Post-merge / validate-commit-msg (push) Successful in 45s
Post-merge / sync-wiki (push) Successful in 48s
Post-merge / vikunja (push) Successful in 49s
Post-merge / configure-repo (push) Successful in 52s
Post-merge / release (push) Successful in 1m9s
Post-merge / badges (push) Successful in 1m24s
Post-merge / publish (push) Successful in 52s
Post-merge / detect-type (push) Successful in 31s
Post-merge / validate-commit-msg (push) Successful in 45s
Post-merge / sync-wiki (push) Successful in 48s
Post-merge / vikunja (push) Successful in 49s
Post-merge / configure-repo (push) Successful in 52s
Post-merge / release (push) Successful in 1m9s
Post-merge / badges (push) Successful in 1m24s
Post-merge / publish (push) Successful in 52s
This commit was merged in pull request #106.
This commit is contained in:
@@ -135,24 +135,74 @@ def build_multi_role_pairs(
|
||||
# Heuristic weights for known heavy molecule scenarios.
|
||||
# These are estimated from CI run times — scenarios that pull large Docker
|
||||
# images or run complex Ansible playbooks take longer.
|
||||
#
|
||||
# Weights are calibrated from actual CI execution times (converge→destroy):
|
||||
# nextcloud: ~7.7m → 15
|
||||
# restore/default: ~5.7m → 11
|
||||
# customer-apps: ~5.5m → 11
|
||||
# zitadel/default: ~5.0m → 10
|
||||
# docker_base/default: ~3.9m → 8
|
||||
# app_hardening/default: ~1.9m → 4
|
||||
# app_container/default: ~1.8m → 3
|
||||
# postgres-upgrade: ~1.7m → 3
|
||||
# observability/default: ~1.7m → 3
|
||||
# storage/default: ~1.5m → 3
|
||||
# storage/object-storage: ~1.0m → 2
|
||||
# vaultwarden: ~0.7m → 2
|
||||
# simple-app: ~0.7m → 2
|
||||
#
|
||||
# Role-specific weights take priority over scenario-name weights.
|
||||
# The (role, scenario) tuple is checked first, then the scenario name
|
||||
# alone, then the default weight.
|
||||
_ROLE_SCENARIO_WEIGHTS: dict[tuple[str, str], int] = {
|
||||
("app_container", "nextcloud"): 15,
|
||||
("app_container", "customer-apps"): 11,
|
||||
("app_container", "vaultwarden"): 2,
|
||||
("app_container", "simple-app"): 2,
|
||||
("app_container", "postgres-upgrade"): 3,
|
||||
("app_container", "default"): 3,
|
||||
("restore", "default"): 11,
|
||||
("zitadel", "default"): 10,
|
||||
("docker_base", "default"): 8,
|
||||
("observability", "default"): 3,
|
||||
("app_hardening", "default"): 4,
|
||||
("storage", "default"): 3,
|
||||
("storage", "object-storage"): 2,
|
||||
}
|
||||
|
||||
# Fallback weights by scenario name only (for single-role projects or
|
||||
# scenarios not in the role-specific table).
|
||||
_SCENARIO_WEIGHTS: dict[str, int] = {
|
||||
"nextcloud": 10,
|
||||
"nextcloud": 15,
|
||||
"customer-apps": 11,
|
||||
"restore": 11,
|
||||
"zitadel": 10,
|
||||
"docker-base": 8,
|
||||
"postgresql": 3,
|
||||
"postgres-upgrade": 3,
|
||||
"gitea": 8,
|
||||
"vaultwarden": 7,
|
||||
"zitadel": 7,
|
||||
"postgresql": 6,
|
||||
"redis": 5,
|
||||
"backup": 5,
|
||||
"docker-base": 4,
|
||||
"vaultwarden": 2,
|
||||
"simple-app": 2,
|
||||
"object-storage": 2,
|
||||
"default": 3,
|
||||
"binary": 2,
|
||||
}
|
||||
_DEFAULT_SCENARIO_WEIGHT = 3
|
||||
|
||||
|
||||
def _scenario_weight(scenario: str) -> int:
|
||||
"""Estimate a weight for a scenario based on its name."""
|
||||
def _scenario_weight(scenario: str, role: str | None = None) -> int:
|
||||
"""Estimate a weight for a scenario based on its name and optionally its role.
|
||||
|
||||
Role-specific weights take priority over scenario-name-only weights.
|
||||
"""
|
||||
s = scenario.lower()
|
||||
if role is not None:
|
||||
r = role.lower()
|
||||
key = (r, s)
|
||||
if key in _ROLE_SCENARIO_WEIGHTS:
|
||||
return _ROLE_SCENARIO_WEIGHTS[key]
|
||||
for key, weight in _SCENARIO_WEIGHTS.items():
|
||||
if key in s:
|
||||
return weight
|
||||
@@ -181,11 +231,11 @@ def _lpt_distribute[T](items: list[T], weights: list[int], max_runners: int) ->
|
||||
def distribute_multi_role(pairs: list[MultiRoleTestPair], max_runners: int) -> list[list[MultiRoleTestPair]]:
|
||||
"""Split *pairs* into *max_runners* balanced groups using LPT scheduling.
|
||||
|
||||
Each pair is weighted by scenario name heuristics (e.g. ``nextcloud`` is
|
||||
heavier than ``binary``). Pairs are sorted by weight descending and
|
||||
Each pair is weighted by role+scenario heuristics (e.g. ``nextcloud`` is
|
||||
heavier than ``simple-app``). Pairs are sorted by weight descending and
|
||||
assigned to the runner with the least total weight.
|
||||
"""
|
||||
weights = [_scenario_weight(p.scenario) for p in pairs]
|
||||
weights = [_scenario_weight(p.scenario, p.role) for p in pairs]
|
||||
return _lpt_distribute(pairs, weights, max_runners)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user