MCPcopy Index your code
hub / github.com/tensorflow/tensorboard / main

Function main

tensorboard/tools/convert_tbdev_export.py:261–334  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

259
260
261def main():
262 # Generate help from module docstring.
263 description = __doc__
264 summary, _, details = description.partition("\n\n")
265 parser = argparse.ArgumentParser(
266 prog="convert_tbdev_export.py",
267 description=summary,
268 epilog=details,
269 formatter_class=argparse.RawDescriptionHelpFormatter,
270 )
271 parser.add_argument(
272 "exp_dir",
273 metavar="EXPERIMENT-DIRECTORY",
274 help="Exported experiment directory to convert",
275 )
276 parser.add_argument(
277 "-o", "--outdir", help="Optional output directory to write to"
278 )
279 parser.add_argument(
280 "-f",
281 "--force",
282 action="store_true",
283 help=(
284 "If True, continue even if input directory name is not in"
285 "the expected format"
286 ),
287 )
288 parser.add_argument(
289 "-v",
290 "--verbose",
291 action="store_true",
292 help="If True, print a list of the resulting files",
293 )
294 args = parser.parse_args()
295 # Normalize, and in particular strip trailing slash if provided.
296 exp_dir = os.path.normpath(args.exp_dir)
297 if not os.path.exists(exp_dir):
298 logging.error("Input directory not found: %s", exp_dir)
299 exit(1)
300 if not os.path.isdir(exp_dir):
301 logging.error("Input is not a directory: %s", exp_dir)
302 exit(1)
303 exp_dir_base = os.path.basename(exp_dir)
304 if not _EXP_DIR_REGEX.fullmatch(exp_dir_base):
305 msg = "Input directory name %r does not match expected format %r. " % (
306 exp_dir_base,
307 _EXP_DIR_REGEX.pattern,
308 )
309 if args.force:
310 logging.warning(msg + "Continuing anyway due to --force.")
311 if not args.force:
312 logging.error(msg + "Pass --force to attempt conversion anyway.")
313 exit(1)
314 out_dir = args.outdir
315 if not out_dir:
316 out_dir = tempfile.mkdtemp(
317 prefix="tbdev-export-converter-%s-" % exp_dir_base
318 )

Callers 1

Calls 4

convertFunction · 0.85
existsMethod · 0.45
isdirMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…