Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tbdev turndown: replace dev subcommand with shim #6707

Merged
merged 2 commits into from
Jan 5, 2024
Merged

Conversation

nfelt
Copy link
Contributor

@nfelt nfelt commented Dec 20, 2023

This replaces the dev subcommand with a shim that prints out a message about the turndown.

Unfortunately, the actual uploader code can't quite be deleted yet because Cloud AI Platform is depending on it still:
https://github.com/googleapis/python-aiplatform/blob/cd31c1306a9a00a01fbc1dda56fe99ed567a4cfb/google/cloud/aiplatform/tensorboard/uploader.py#L62-L65

@nfelt nfelt added the tbdev TensorBoard.dev label Dec 20, 2023
@nfelt nfelt marked this pull request as ready for review December 20, 2023 21:58
@nfelt nfelt requested a review from bmd3k December 20, 2023 21:58
@@ -40,7 +40,7 @@ def run_main():

tensorboard = program.TensorBoard(
plugins=default.get_plugins(),
subcommands=[uploader_subcommand.UploaderSubcommand()],
subcommands=[legacy_tbdev_subcommand.LegacyTbdevSubcommand()],
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it's not worthwhile but it seems like you could at least delete uploader_subcommand.py.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's true, and there are some other related files. But I think it might actually be more manageable than I thought to remove all the uploader code, and doing it all at once is less effort than trying to carve out just the "clearly deleteable" chunk, so if you don't mind I will punt (and if we run into trouble getting all of it deleted I can come back and delete the easier parts).

@bmd3k
Copy link
Contributor

bmd3k commented Dec 27, 2023

Also, out of curiosity, why develop this in the tensorflow/tensorboard repo instead of your own repo?

Copy link
Contributor

@bmd3k bmd3k left a comment

Choose a reason for hiding this comment

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

Sorry for

def define_flags(self, parser):
pass # no flags to define

def run(self, flags):
Copy link
Contributor

Choose a reason for hiding this comment

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

This works great for tensorboard dev but for tensorboard dev upload or tensorboard dev auth revoke you get a somewhat-less-helpful error message like "tensorboard: error: unrecognized arguments: upload".

Is that intentional?

Very few people will just run tensorboard dev.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, great point. There unfortunately doesn't seem to be any way to tell an argparse subcommand to simply swallow all remaining arguments - you can swallow all positional arguments, but then it would still reject things like tensorboard dev export --outdir foo unless we define --outdir as a flag, and so on.

So I've reworked this to instead just intercept directly at the sys.argv level. That is slightly less complete since it won't trigger for things like tensorboard --verbosity 2 dev export --outdir, but that's too niche to care, and even then the error is actually still better than before: tensorboard: error: argument {serve}: invalid choice: 'dev' (choose from 'serve').

Copy link
Contributor Author

@nfelt nfelt left a comment

Choose a reason for hiding this comment

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

Also, out of curiosity, why develop this in the tensorflow/tensorboard repo instead of your own repo?

I usually prefer my own repo for one-off PRs, but you can only make a given PR a "diffbase" of another PR if its branch is in the main repo, since that allows it to be the merge target for the subsequent PR and generate the diffs relative to it during review (and then to submit you would re-point it to merge into master).

So I did that in this case under the assumption that I would stage the rest of the deletion as its own child PR, but then didn't quite get around to that.

def define_flags(self, parser):
pass # no flags to define

def run(self, flags):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, great point. There unfortunately doesn't seem to be any way to tell an argparse subcommand to simply swallow all remaining arguments - you can swallow all positional arguments, but then it would still reject things like tensorboard dev export --outdir foo unless we define --outdir as a flag, and so on.

So I've reworked this to instead just intercept directly at the sys.argv level. That is slightly less complete since it won't trigger for things like tensorboard --verbosity 2 dev export --outdir, but that's too niche to care, and even then the error is actually still better than before: tensorboard: error: argument {serve}: invalid choice: 'dev' (choose from 'serve').

@@ -40,7 +40,7 @@ def run_main():

tensorboard = program.TensorBoard(
plugins=default.get_plugins(),
subcommands=[uploader_subcommand.UploaderSubcommand()],
subcommands=[legacy_tbdev_subcommand.LegacyTbdevSubcommand()],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's true, and there are some other related files. But I think it might actually be more manageable than I thought to remove all the uploader code, and doing it all at once is less effort than trying to carve out just the "clearly deleteable" chunk, so if you don't mind I will punt (and if we run into trouble getting all of it deleted I can come back and delete the easier parts).

@nfelt nfelt requested a review from bmd3k January 5, 2024 04:15
@nfelt nfelt merged commit 140f33d into master Jan 5, 2024
16 checks passed
@nfelt nfelt deleted the nfelt-tbdev-shim branch January 5, 2024 19:23
nfelt added a commit that referenced this pull request Jan 8, 2024
Resolves #6603

This removes a sizable chunk of the code in the `tensorboard/uploader`
subdirectory, now that we've disabled the TensorBoard.dev uploader in
#6707. It also removes several Pip package deps that were only needed
for the removed code.

The remaining code (`logdir_loader.py`, `upload_tracker.py`, `util.py`,
their tests, and the protos) is preserved because it is still depended
on either by internal code or by [Cloud AI
Platform](https://github.com/googleapis/python-aiplatform/blob/cd31c1306a9a00a01fbc1dda56fe99ed567a4cfb/google/cloud/aiplatform/tensorboard/uploader.py#L62-L65).

Note that for `util.py`, I've removed everything except `RateLimiter`
since that was the only symbol where I could find outside dependencies.
To simplify the test code I also folded `FakeTime` from `test_util.py`
into `util_test.py`.

Tested with an internal sync to confirm tests will still pass (once a
few other changes land).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tbdev TensorBoard.dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants