-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Move uploader flag parsing to its own file and add basic tests #3471
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
Conversation
wchargin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This is a good start. It would be great to follow up to expand
this to cover the actual logic as well as the remaining plumbing, so
that we could catch regressions like the one in #3377.
nit: OSS commit style is imperative with no trailing punctuation with
optional section prefix, so: “Move uploader flag parsing to its own
file”, or: “uploader: extract and test flag parsing”. Could you please
update the PR title accordingly?
* Why? For consistency; this is the style of commits generated by Git
itself, as in git revert, git merge, etc.
| flags_parser.SUBCOMMAND_KEY_UPLOAD, | ||
| getattr(flags, flags_parser.SUBCOMMAND_FLAG), | ||
| ) | ||
| self.assertEqual("some/log/dir", getattr(flags, "logdir")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This getattr(flags, "logdir") is just flags.logdir; likewise for
other getattrs with constant attribute name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| DEFAULT_ORIGIN = "https://tensorboard.dev" | ||
|
|
||
|
|
||
| def parse_flags(argv): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK: For what it’s worth, this function is vestigial, and we can really
remove the entire //tensorboard/uploader entry point in favor of
//tensorboard/uploader:uploader_main_lib (which should probably be
renamed; it’s pretty confusing). But fine with me to keep deferring that
change, as it’s not hurting anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do it in a followup PR. But first I'll warn the TensorBoard team that we'll be getting rid of //tensorboard/uploader just in case anybody is still using it. And this function would essentially be moved into the test.
|
|
||
| import argparse | ||
|
|
||
| import flags_parser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please always use the full package name for imports: here, you want
from tensorboard.uploader import flags_parser (after the tb_test
import).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
tensorboard/uploader/BUILD
Outdated
| srcs = ["flags_parser_test.py"], | ||
| deps = [ | ||
| ":flags_parser", | ||
| "//tensorboard:expect_futures_installed", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unneeded; drop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
I should have clarified: This is not intended to help with the regression in #3377 or the followup work in Issue #3404. I still intend to do that work. It's just not the goal here. Instead this is to prepare for some changes I'm making to the --plugins flag and want to have tested.
Done. |
wchargin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All sounds good; thanks!
…rflow#3471) * Motivation for features / changes Move flag-defining and parsing logic out of uploader_main.py into its own flag_parser.py file. Add some very basic tests for the moved logic. * Detailed steps to verify changes work correctly (as executed by you) Ran new tests for flag_parser.py. Ran several commands and ensured they ran to completion: bazel run //tensorboard -- dev list bazel run //tensorboard -- dev upload --logdir --plugins badplugin1 badplugin2 bazel run //tensorboard/uploader -- upload --logdir --plugins badplugin1 badplugin2
* Motivation for features / changes Move flag-defining and parsing logic out of uploader_main.py into its own flag_parser.py file. Add some very basic tests for the moved logic. * Detailed steps to verify changes work correctly (as executed by you) Ran new tests for flag_parser.py. Ran several commands and ensured they ran to completion: bazel run //tensorboard -- dev list bazel run //tensorboard -- dev upload --logdir --plugins badplugin1 badplugin2 bazel run //tensorboard/uploader -- upload --logdir --plugins badplugin1 badplugin2
Motivation for features / changes
Move flag-defining and parsing logic out of uploader_main.py into its own flag_parser.py file. Add some very basic tests for the moved logic.
Detailed steps to verify changes work correctly (as executed by you)
Ran new tests for flag_parser.py.
Ran several commands and ensured they ran to completion:
bazel run //tensorboard -- dev list
bazel run //tensorboard -- dev upload --logdir --plugins badplugin1 badplugin2
bazel run //tensorboard/uploader -- upload --logdir --plugins badplugin1 badplugin2