← Back to Pull requests

[AAP-103749] perf: vectorize JobHostSummaryAnonymizedRollup host outcome counts #657

Closed
unknown closed this pull request without merging on Nov 27, 2026 13:20 UTC
View on GitHub
unknown unknown commented on Nov 26, 2026 15:43 UTC
Author

Description

  • Vectorize host outcome aggregation (metrics_utility/anonymized_rollups/jobhostsummary_anonymized_rollup.py): _aggregate_by_job_remote_id() and _aggregate_by_job_type_directly() counted successful, failed, and unreachable hosts via three per-group Python lambdas (lambda x: (x == '...').sum()), forcing pandas into pure-Python Series slicing for every job group.

  • Precomputed three int8 0/1 flag columns (is_successful, is_failed, is_unreachable) from host_outcome (matching the pattern already used in EventModulesAnonymizedRollup) and switched all three aggregations to vectorized 'sum'. Retained host_outcome and added _ensure_outcome_columns() for callers invoking aggregation helpers directly.
  • Testing

    Steps to Test

    1. Run unit tests (including 10 new tests covering outcome counts, dark precedence over failures, flag dtypes, direct helper calls, and missing job_remote_id):

       pytest metrics_utility/test/test_anonymized_rollups/test_jobhostsummary_anonymized_rollups.py -v
       

    2. Run paired alternating-order benchmark of JobHostSummaryAnonymizedRollup.prepare() on 100,000 synthetic rows across 4,000 jobs in a containerized AAP cont_b Controller (automation-controller-task, Python 3.12.16, pandas 3.0.3; excludes DB collection).

    Expected Results

  • All 11 tests in test_jobhostsummary_anonymized_rollups.py pass.

  • Synthetic JobHostSummaryAnonymizedRollup.prepare() median time dropped from 1.231 s to 0.227 s (−81.56%, 5.4× faster), peak RSS flat (151.90 → 152.35 MiB), with identical JSON output digests across all 6 runs.
  • Self-Review Checklist

    Code Quality

  • Code is properly linted and formatted.

  • All tests (existing and new) pass successfully.

  • Tests are added or updated as needed.

  • Code includes relevant comments for complex sections.

  • Changes are reviewed and approved by at least two team members.

  • Documentation is updated where applicable.

  • - If updates are required in the handbook, create a separate PR for the handbook repo.

    Diff: 267 lines (+200 / -67) across 3 files Reviewer: redhat-chai-bot Review duration: 1297m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 267 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.334
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #657"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.4% (MEDIUM) · Higher = larger blast radius
    39.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.6% · Safe to merge
    15.6%