Fixes standard TensorBoard CLI flags to parser.
(self, flags)
| 674 | ) |
| 675 | |
| 676 | def fix_flags(self, flags): |
| 677 | """Fixes standard TensorBoard CLI flags to parser.""" |
| 678 | FlagsError = base_plugin.FlagsError |
| 679 | if flags.version_tb: |
| 680 | pass |
| 681 | elif flags.inspect: |
| 682 | if flags.logdir_spec: |
| 683 | raise FlagsError( |
| 684 | "--logdir_spec is not supported with --inspect." |
| 685 | ) |
| 686 | if flags.logdir and flags.event_file: |
| 687 | raise FlagsError( |
| 688 | "Must specify either --logdir or --event_file, but not both." |
| 689 | ) |
| 690 | if not (flags.logdir or flags.event_file): |
| 691 | raise FlagsError( |
| 692 | "Must specify either --logdir or --event_file." |
| 693 | ) |
| 694 | elif flags.logdir and flags.logdir_spec: |
| 695 | raise FlagsError("May not specify both --logdir and --logdir_spec") |
| 696 | elif ( |
| 697 | not flags.db |
| 698 | and not flags.logdir |
| 699 | and not flags.logdir_spec |
| 700 | and not flags.grpc_data_provider |
| 701 | ): |
| 702 | raise FlagsError( |
| 703 | "A logdir or db must be specified. " |
| 704 | "For example `tensorboard --logdir mylogdir` " |
| 705 | "or `tensorboard --db sqlite:~/.tensorboard.db`. " |
| 706 | "Run `tensorboard --helpfull` for details and examples." |
| 707 | ) |
| 708 | elif flags.host is not None and flags.bind_all: |
| 709 | raise FlagsError("Must not specify both --host and --bind_all.") |
| 710 | elif ( |
| 711 | flags.load_fast == "true" and flags.detect_file_replacement is True |
| 712 | ): |
| 713 | raise FlagsError( |
| 714 | "Must not specify both --load_fast=true and" |
| 715 | "--detect_file_replacement=true" |
| 716 | ) |
| 717 | |
| 718 | flags.path_prefix = flags.path_prefix.rstrip("/") |
| 719 | if flags.path_prefix and not flags.path_prefix.startswith("/"): |
| 720 | raise FlagsError( |
| 721 | "Path prefix must start with slash, but got: %r." |
| 722 | % flags.path_prefix |
| 723 | ) |
| 724 | |
| 725 | def load(self, context): |
| 726 | """Creates CorePlugin instance.""" |