Skip to content

tensorboard_writer: chief-rank uploader for Vertex AI TB#622

Draft
kmontemayor2-sc wants to merge 2 commits intomainfrom
kmonte/tb-writer
Draft

tensorboard_writer: chief-rank uploader for Vertex AI TB#622
kmontemayor2-sc wants to merge 2 commits intomainfrom
kmonte/tb-writer

Conversation

@kmontemayor2-sc
Copy link
Copy Markdown
Collaborator

Adds gigl.utils.tensorboard_writer.TensorBoardWriter, the
trainer-side abstraction that writes TF event files locally and (on the
chief rank only) starts an aiplatform.start_upload_tb_log background
uploader streaming events to a stable, user-named
TensorboardExperiment.

Key design points:

  • TensorBoardWriter.from_env(enabled=is_chief_process) returns a
    real writer on the chief rank, a no-op writer everywhere else, so
    trainer entry points can share the same call sites across ranks.
  • Reads AIP_TENSORBOARD_LOG_DIR (Vertex's contract — set when
    baseOutputDirectory is configured) plus three GiGL env vars
    (GIGL_TENSORBOARD_RESOURCE_NAME, EXPERIMENT_NAME, RUN_NAME)
    injected by the launcher.
  • Writes events to <AIP_TENSORBOARD_LOG_DIR>/<run_name>/ so the
    SDK's LogdirLoader discovers each subdir as a distinct
    TensorboardRun instead of merging into the SDK's hardcoded
    DEFAULT_RUN_NAME = "default".
  • Logs the named-experiment URL on uploader start so engineers can find
    the comparison page from trainer stdout.
  • Paired aiplatform.end_upload_tb_log() on close; idempotent.

This PR introduces the writer with full test coverage but no callers —
the example trainers/inferencers wire it in subsequent PRs.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

kmontemayor and others added 2 commits May 6, 2026 18:48
Adds two optional fields on ``VertexAiResourceConfig`` for opting into
Vertex AI TensorBoard. ``tensorboard_resource_name`` points at an
existing ``Tensorboard`` resource; ``tensorboard_experiment_name`` is
the user-chosen ``TensorboardExperiment`` ID under that resource —
multiple jobs sharing this name surface as comparable runs on the same
TB page.

The fields must be set together (or both unset). The validation rule is
not enforced yet (lands in a follow-up PR); this commit only adds the
proto fields and regenerates Python + Scala stubs.

Also expands the docstring on ``TrainedModelMetadata.tensorboard_logs_uri``
to document its mapping to ``AIP_TENSORBOARD_LOG_DIR`` via
``CustomJobSpec.baseOutputDirectory``.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds ``gigl.utils.tensorboard_writer.TensorBoardWriter``, the
trainer-side abstraction that writes TF event files locally and (on the
chief rank only) starts an ``aiplatform.start_upload_tb_log`` background
uploader streaming events to a stable, user-named
``TensorboardExperiment``.

Key design points:

- ``TensorBoardWriter.from_env(enabled=is_chief_process)`` returns a
  real writer on the chief rank, a no-op writer everywhere else, so
  trainer entry points can share the same call sites across ranks.
- Reads ``AIP_TENSORBOARD_LOG_DIR`` (Vertex's contract — set when
  ``baseOutputDirectory`` is configured) plus three GiGL env vars
  (``GIGL_TENSORBOARD_RESOURCE_NAME``, ``EXPERIMENT_NAME``, ``RUN_NAME``)
  injected by the launcher.
- Writes events to ``<AIP_TENSORBOARD_LOG_DIR>/<run_name>/`` so the
  SDK's ``LogdirLoader`` discovers each subdir as a distinct
  ``TensorboardRun`` instead of merging into the SDK's hardcoded
  ``DEFAULT_RUN_NAME = "default"``.
- Logs the named-experiment URL on uploader start so engineers can find
  the comparison page from trainer stdout.
- Paired ``aiplatform.end_upload_tb_log()`` on close; idempotent.

This PR introduces the writer with full test coverage but no callers —
the example trainers/inferencers wire it in subsequent PRs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kmontemayor2-sc
Copy link
Copy Markdown
Collaborator Author

/all_test

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

GiGL Automation

@ 20:32:08UTC : 🔄 Python Unit Test started.

@ 21:33:00UTC : ✅ Workflow completed successfully.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

GiGL Automation

@ 20:32:08UTC : 🔄 Scala Unit Test started.

@ 20:40:26UTC : ✅ Workflow completed successfully.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

GiGL Automation

@ 20:32:09UTC : 🔄 C++ Unit Test started.

@ 20:35:38UTC : ✅ Workflow completed successfully.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

GiGL Automation

@ 20:32:11UTC : 🔄 E2E Test started.

@ 21:57:02UTC : ✅ Workflow completed successfully.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

GiGL Automation

@ 20:32:12UTC : 🔄 Lint Test started.

@ 20:39:48UTC : ✅ Workflow completed successfully.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

GiGL Automation

@ 20:32:15UTC : 🔄 Integration Test started.

@ 21:46:54UTC : ✅ Workflow completed successfully.

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.

1 participant