Skip to content

Make ValidatesRunner faster: Cache and reuse shared metrics pipeline execution in MetricsTest - #40322

Merged
kennknowles merged 1 commit into
apache:masterfrom
reuvenlax:improve_test_cache_metrics_pipeline
Sep 30, 2026
Merged

kennknowles merged 1 commit into
apache:masterfrom
reuvenlax:improve_test_cache_metrics_pipeline

Conversation

@reuvenlax

Copy link
Copy Markdown
Contributor

Caches the read-only PipelineResult from runPipelineWithMetrics() per runner configuration so CommittedMetricTests and AttemptedMetricTests reuse a single pipeline execution.

result.waitUntilFinish();
return result;
String cacheKey =
pipeline.getOptions().getRunner().getName()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't have a lot of context, but I do have concerns.

  1. There is nothing in the cache key to identify the pipeline. Is there just one pipeline possible here? Reading this file, I guess so? The tests are really poor, with mysterious action-at-a-distance between magic values in the runPipelineWithMetrics helper and the assertGauges and so on. I know you aren't here to fix this...
  2. This is a protected method so presumably used in test suites that extend this one? Frankly this is an anti-pattern that we should have a coding agent eliminate, in favor of simple control flow by calling helper methods. And of course if someone overrides the protected method, they lose the caching and the coherence between the test methods and the run pipeline method.

Honestly, having an agent fully rewrite this file might be nice.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah - I think the bigger problem is that this MetricsTest stuff is old and crufty. Maybe we want to just rewrite it all instead of trying to hack around it.

@kennknowles
kennknowles merged commit b544f40 into apache:master Sep 30, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants