Skip to content

Add more elasticity goodput tests - #4846

Open
dipannita08 wants to merge 2 commits into
mainfrom
elastic-gp-maxtext
Open

Add more elasticity goodput tests#4846
dipannita08 wants to merge 2 commits into
mainfrom
elastic-gp-maxtext

Conversation

@dipannita08

Copy link
Copy Markdown
Collaborator

Description

This PR adds:

  • More elasticity + goodput tests
  • Tightens the check for backend pathways and elasticity enabled.
  • Adds some useful debugging logs
  • Minor cleanups.

Tests

  • Run all tests locally.
  • E2E MaxText run with pathways elasticity enabled.

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the goodput monitoring and recording logic to safely resolve and fall back to base monitors and recorders when elastic features are disabled or fail to load. It also introduces hasattr checks in elastic_utils.py to prevent errors when interacting with recorders that lack elastic APIs, accompanied by comprehensive unit tests. The reviewer suggested ensuring that both record_elastic_wait_end_time and record_elastic_reinit_start_time are checked before invocation to prevent potential AttributeErrors.

Comment on lines +72 to 75
if recorder and hasattr(recorder, "record_elastic_wait_end_time"):
recorder.record_elastic_wait_end_time(event_type=event_type)
recorder.record_elastic_reinit_start_time()
record_slice_state(recorder)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

To ensure robust defensive programming, we should verify that the recorder implements both record_elastic_wait_end_time and record_elastic_reinit_start_time before calling them. Currently, we only check for the presence of record_elastic_wait_end_time, which could lead to an AttributeError if a custom or mock recorder only implements one of the methods.

Suggested change
if recorder and hasattr(recorder, "record_elastic_wait_end_time"):
recorder.record_elastic_wait_end_time(event_type=event_type)
recorder.record_elastic_reinit_start_time()
record_slice_state(recorder)
if (
recorder
and hasattr(recorder, "record_elastic_wait_end_time")
and hasattr(recorder, "record_elastic_reinit_start_time")
):
recorder.record_elastic_wait_end_time(event_type=event_type)
recorder.record_elastic_reinit_start_time()
record_slice_state(recorder)

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 7.40741% with 25 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/maxtext/common/goodput.py 4.34% 22 Missing ⚠️
src/maxtext/utils/elastic_utils.py 25.00% 2 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

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