Skip to content

[core][taskEvents out of GCS][3/n] Export task events from aggregator agent to dashboard head - #65028

Open
karticam wants to merge 6 commits into
ray-project:masterfrom
karticam:karticam/agg-agent-to-db-head
Open

[core][taskEvents out of GCS][3/n] Export task events from aggregator agent to dashboard head#65028
karticam wants to merge 6 commits into
ray-project:masterfrom
karticam:karticam/agg-agent-to-db-head

Conversation

@karticam

@karticam karticam commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Part of the effort to move task-event observability data out of GCS and onto the
dashboard head. This PR adds support for moving task events from aggregator agent to dashboard head. Changes are as follows:

  1. Adds a new module task_events_head that hosts a POST /api/task_events endpoint to receive task events from the aggregator agent. For now it just buffers received events in memory. More stuff to be done in upcoming PRs.
  2. Adds a new publisher client AsyncDashboardHeadPublisherClient and a corresponding flag to PUBLISH_EVENTS_TO_DASHBOARD_HEAD.
  3. The existing publisher AsyncGCSTaskEventsPublisherClient is still kept since some tests depend on it. This will be removed later after the entire migration completes.
  4. The new publisher client is similar to AsyncGCSTaskEventsPublisherClient in that it has the same event selection to export and has the same proto building, but sends the request over HTTP POST instead of a gRPC call.
  5. Each of the two publishers gets its own dropped-task-attempts metadata buffer, sinceTaskEventsMetadataBuffer.get() is destructive and a shared buffer would split the metadata across publishers.
  6. The publisher resolves the dashboard head's address lazily from InternalKV (DASHBOARD_ADDRESS) via gcs_client, then makes the POST request. If the address isn't registered yet the publish is marked unsuccessful and the publisher retries on its next cycle; once resolved, the endpoint is cached.

@karticam
karticam requested a review from a team as a code owner July 27, 2026 07:52

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request replaces the GCS-based task events publisher with a new HTTP-based publisher (AsyncDashboardHeadPublisherClient) that sends events directly to the dashboard head. It also introduces a new TaskEventsHead module to receive and temporarily buffer these events in memory. Feedback on the changes suggests setting a maximum length on the in-memory event buffer (collections.deque) in TaskEventsHead to prevent potential out-of-memory (OOM) issues from unbounded growth.

# TODO(Task 3): replace this unbounded in-memory buffer with real storage +
# GC/eviction. It exists only so the ingestion endpoint has somewhere to put
# events for now; nothing reads it yet (State-API serving is a later task).
self._events = collections.deque()

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.

medium

The in-memory buffer self._events is currently unbounded. In a long-running cluster with high task throughput, this will lead to unbounded memory growth and eventually cause the dashboard head process to be OOM-killed.

Even though this is a temporary placeholder before real storage is implemented, it is highly recommended to set a reasonable maxlen on the deque (e.g., 100000) as a defensive safeguard to prevent memory exhaustion.

Suggested change
self._events = collections.deque()
self._events = collections.deque(maxlen=100000)

Comment thread python/ray/tests/conftest.py Outdated
@ray-gardener ray-gardener Bot added the core Issues that should be addressed in Ray Core label Jul 27, 2026
@karticam karticam added the go add ONLY when ready to merge, run all tests label Jul 27, 2026
@karticam karticam changed the title [core][taskEvents out of GCS][3/n] Moving task events from aggregator agent to dashboard head - 1 [core][taskEvents out of GCS][3/n] Export task events from aggregator agent to dashboard head(1) Jul 27, 2026
@karticam karticam changed the title [core][taskEvents out of GCS][3/n] Export task events from aggregator agent to dashboard head(1) [core][taskEvents out of GCS][3/n] Export task events from aggregator agent to dashboard head Jul 27, 2026
karticam added 6 commits July 28, 2026 11:33
- New TaskEventsHead SubprocessModule exposing POST /api/task_events
- Deserialization isolated in _deserialize_request (wire format TBD)
- In-memory buffer stub; storage/GC is a later task

Signed-off-by: Kartica Modi <karticamodi@gmail.com>
Signed-off-by: Kartica Modi <karticamodi@gmail.com>
Signed-off-by: Kartica Modi <karticamodi@gmail.com>
Signed-off-by: Kartica Modi <karticamodi@gmail.com>
Signed-off-by: Kartica Modi <karticamodi@gmail.com>
Signed-off-by: Kartica Modi <karticamodi@gmail.com>
@karticam
karticam force-pushed the karticam/agg-agent-to-db-head branch from a98d6cc to f632c5e Compare July 28, 2026 18:33

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit f632c5e. Configure here.

return dashboard_optional_utils.rest_response(
status_code=dashboard_utils.HTTPStatusCode.INTERNAL_ERROR,
message=f"Failed to deserialize task events request: {e}",
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wrong status for bad payload

Low Severity

Deserialization failures for /api/task_events return HTTPStatusCode.INTERNAL_ERROR (500). A malformed client body is a client error, so this misclassifies bad input as a server failure, unlike nearby handlers such as EventHead.report_events which treat parse failures as bad requests.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f632c5e. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant