Skip to content

Fix benchmark cache path and add forceBenchmarks pipeline variable#927

Open
RyAuld wants to merge 6 commits into
devfrom
ryauld/fix-benchmark-cache-path
Open

Fix benchmark cache path and add forceBenchmarks pipeline variable#927
RyAuld wants to merge 6 commits into
devfrom
ryauld/fix-benchmark-cache-path

Conversation

@RyAuld

@RyAuld RyAuld commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Problem

Build 1651184 fails with:

Please specify path to a directory, File path is not allowed. /home/vsts/work/1/s/.perf.baseline is a file.

The Cache@2 ADO task requires a directory path, but .perf.baseline was configured as a file.

Additionally, Python 3.14 unit tests intermittently stall, consuming the full 30-minute job timeout before being canceled.

Changes

Fix benchmark cache path

  • Change cache path to $(System.DefaultWorkingDirectory)/.perf-baseline (a directory)
  • Update test_benchmark.py to store baseline data in .perf-baseline/data, anchored to repo root via __file__
  • Ensure the directory is created both in the pipeline (mkdir -p) and in test code (os.makedirs) so it works in CI and local runs
  • Update .gitignore to ignore the .perf-baseline/ directory

Add forceBenchmarks pipeline variable

  • Allows benchmarks to run on non-dev branches by setting forceBenchmarks=true when queuing a manual build
  • Normal CI behavior unchanged (benchmarks still only run automatically on dev)

Add 5-minute step timeout to pytest

  • Python 3.14 intermittently stalls during test execution (likely due to missing pre-built wheels or runtime changes)
  • Added timeoutInMinutes: 5 on the pytest step so stalls fail fast instead of consuming the full 30-min job timeout

Validation

Build 1651236 passed all stages including benchmarks (triggered with forceBenchmarks=true).

The Cache@2 ADO task requires a directory path, but .perf.baseline was a
file. Move baseline storage into a .perf-baseline/ directory so the cache
task can save/restore it correctly.

- Change cache path to \/.perf-baseline
- Update test_benchmark.py to store baseline in .perf-baseline/data
- Ensure directory exists with mkdir -p before running benchmarks
- Update .gitignore accordingly

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 15, 2026 16:59
@RyAuld RyAuld requested a review from a team as a code owner June 15, 2026 16:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the performance benchmark baseline caching to use a directory (compatible with Azure DevOps Cache@2) instead of a single baseline file, and aligns benchmark output storage under that directory.

Changes:

  • Switch the benchmark baseline location to .perf-baseline/data so the cache target can be a directory.
  • Update the ADO cache path to $(System.DefaultWorkingDirectory)/.perf-baseline and ensure the directory exists before running benchmarks.
  • Update .gitignore to ignore the new .perf-baseline/ directory.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/test_benchmark.py Moves baseline storage under .perf-baseline/ so it can be cached as a directory.
azure-pipelines.yml Updates the Cache@2 path to a directory and creates it prior to running benchmarks.
.gitignore Ignores the new .perf-baseline/ directory.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_benchmark.py Outdated
Comment thread azure-pipelines.yml
RyAuld and others added 2 commits June 15, 2026 10:17
Allows benchmarks to run on non-dev branches by setting the pipeline
variable forceBenchmarks=true when queuing a manual build.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add os.makedirs in test_benchmark.py so local runs don't fail
- Use absolute path in mkdir -p to align with Cache@2 path

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 15, 2026 19:01
@RyAuld RyAuld changed the title Fix benchmark cache path: use directory instead of file Fix benchmark cache path and add forceBenchmarks pipeline variable Jun 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

Comment thread tests/test_benchmark.py Outdated
Comment thread azure-pipelines.yml Outdated
RyAuld and others added 2 commits June 15, 2026 12:09
- Use __file__-based path resolution so baseline works from any CWD
- Move stdlib imports before third-party imports
- Update pipeline comment to reflect forceBenchmarks behavior

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Python 3.14 intermittently stalls during test execution, consuming the
full 30-min job timeout. Add a 5-minute timeoutInMinutes on the pytest
step so stalls are caught quickly instead of wasting agent time.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 15, 2026 19:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

Comment thread azure-pipelines.yml
Comment thread .Pipelines/template-pipeline-stages.yml Outdated
- Require Build.Reason=Manual for forceBenchmarks override (case-insensitive)
- Add 5-min timeoutInMinutes on pytest step to catch stalls early

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants