← Back to Pull requests

feat(scheduler): make node lock timeout configurable #1117

Closed
unknown closed this pull request without merging on Jun 16, 2025 02:49 UTC
View on GitHub
unknown unknown commented on Jun 12, 2025 13:32 UTC
Author

Summary

This PR makes the HAMi scheduler's node lock timeout configurable, allowing operators to adjust the timeout duration based on their cluster characteristics and scheduling requirements.

Changes Made

1. __Configuration Layer (pkg/scheduler/config/config.go)__

- Added NodeLockTimeout int configuration parameter
- Default value set to 1 minute to maintain backward compatibility

2. __Command Line Interface (cmd/scheduler/main.go)__

- Added --node-lock-timeout flag to scheduler command line options
- Flag accepts timeout value in minutes
- Integrated timeout initialization in the start() function

3. __Runtime Behavior (pkg/util/nodelock/nodelock.go)__

- The global NodeLockTimeout variable is now set from configuration
- Maintains existing lock/unlock logic and timeout checking mechanism

Motivation

Previously, the node lock timeout was hardcoded to 1 minute. In some cluster environments, this timeout may be too long, causing unnecessary delays in scheduling operations. By making this configurable, operators can:

  • Reduce scheduling latency in fast clusters by setting shorter timeouts

  • Increase timeout for slower clusters to avoid premature lock releases

  • Fine-tune scheduler behavior based on workload characteristics
  • Backward Compatibility

  • Default timeout remains 1 minute, ensuring no behavior change for existing deployments

  • Existing configurations continue to work without modification

  • New flag is optional and uses sensible defaults
  • Default timeout is 5 minute


    ./scheduler
    

    Custom set 30s


    ./scheduler --node-lock-timeout=30s
    

    Custom set 2mins


    ./scheduler --node-lock-timeout=2m
    

    Diff: 222 lines (+166 / -56) across 2 files Reviewer: wawa0210 Review duration: 5116m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.60) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.60 · 222 lines diff across 2 files
    0.60
    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.323
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.060
    Real PR Conversation Timeline
    1 comments
    "Review active on #1117"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    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: 60.0% (MEDIUM) · Higher = larger blast radius
    60.0%
    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: 23.7% · Safe to merge
    23.7%