Skip to content

Incorrect flag parsing: purge_orphaned_data #1506

@manzagop

Description

@manzagop

Hi!

Thanks for a great tool!

Issue: It is not possible to disable "purging of orphaned data" through the purge_orphaned_data flag.

  • TensorBoard version: TOT (guessing that's 1.11.0)
  • Python version 2.7

The problem is with the argparse flag parsing[1]: using type=bool means the string argument will be converted to boolean, e.g. bool('False') => True.

`import argparse
parser = argparse.ArgumentParser(prog='foo')
parser.add_argument('--purge_orphaned_data', metavar='BOOL', type=bool, nargs=1, default=True)

In [6]: parser.parse_args('--purge_orphaned_data=False'.split())
Out[6]: Namespace(purge_orphaned_data=[True])`

Ways to fix this:

  • replace type=bool with something that does the right conversion. Note we'd likely also want to change nargs to '?' so as not to get a list
  • replace the flag with a "disabling flag" (action='set_false')

Note sure if the "absl flag integration" presents additional difficulties though [2].

[1] https://github.com/tensorflow/tensorboard/blob/master/tensorboard/plugins/core/core_plugin.py#L302
[2] https://github.com/tensorflow/tensorboard/blob/master/tensorboard/program.py#L55

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions