vm_build_utils.cmd : command line utilities¶
batch and commandline utilities
-
class
vm_build_utils.cmd.HELP_FMT(prog, indent_increment=2, max_help_position=24, width=None)[source]¶ composite class to provide both default args in help and raw help strings goes to crazy lengths to split up lists of choices…
-
vm_build_utils.cmd.add_file_logging_parse_arg(parser)[source]¶ add file logging output + verbosity to a parser
-
vm_build_utils.cmd.add_run_mode_parse_arg(parser)[source]¶ add controls to run sub commands / persistent system operations
-
vm_build_utils.cmd.color_text(text, color, fmt=None)[source]¶ if color control string is not None, wrap like so: color|text|color_rest
-
vm_build_utils.cmd.confirm(run_mode, cmd_str)[source]¶ optionally ask user for confirmation with info about a cmd about to be run
-
vm_build_utils.cmd.current_platform_is_darwin()[source]¶ returns true if current system is darwin, false on linux or windows
-
vm_build_utils.cmd.current_platform_is_linux()[source]¶ returns true if current system is linux, false on darwin or windows
-
vm_build_utils.cmd.env_root(rel_path='')[source]¶ abs path relative to the directory containing bin/python
-
vm_build_utils.cmd.executable_path()[source]¶ get a path to the python interpreter than can be tweaked via env var
-
vm_build_utils.cmd.execute(cmd, run_mode='RUN_CMD_ALWAYS', cwd=None, output=False, color=True, log_level=10, env=None)[source]¶ - execute a subprocess with
- logging of commandline before output optional color coded output optional current working directory override a run mode that can disable execution, ask for user confirmation, or execute
-
vm_build_utils.cmd.execute_callback(message, callback, args, kwargs, run_mode='RUN_CMD_ALWAYS', color=True, log_arguments=True, log_time=False, log_level=10)[source]¶ - execute a python function with
- a run mode that can disable execution, ask for user confirmation, or execute
-
vm_build_utils.cmd.execute_multiline_str(**kwargs)[source]¶ wraps execute by converting multiline “cmd” kwarg to strings
-
vm_build_utils.cmd.finish_args(parser)[source]¶ add common arguments to a parser if not already added: verbose, run_mode
-
vm_build_utils.cmd.log_parsed_args(args_namespace, level=10)[source]¶ log each elemenet in an argparser namespace
-
vm_build_utils.cmd.parse_args(parser, args=None, parse_known_args=False, return_unknown=False)[source]¶ parse, handle logging and run mode arguments
-
vm_build_utils.cmd.project_path()[source]¶ abs path relative to the directory containing env/container/bin/python
-
vm_build_utils.cmd.project_path_components()[source]¶ validate and return paths related to /comet/PROJECT/env/DEVREL/bin/python
-
vm_build_utils.cmd.reset_color_code_stdout(color)[source]¶ reset stdout to non normal color code mode flush
-
vm_build_utils.cmd.set_file_logging_from_args(args)[source]¶ args is a command line parser result - use it to configure file logging
-
vm_build_utils.cmd.set_log_level_from_args(args)[source]¶ args is a command line parser result - use it to configure logging
-
vm_build_utils.cmd.setup_logging(level=10, setup_matplotlib=True, setup_lambda=False, numpy_precision=3, numpy_suppress=True, numpy_linewidth=75, stream=None, color=True, force_warning_modules=('boto3', 'botocore', 's3transfer', 'urllib3', 'websockets'))[source]¶ setup reasonable logging defaults
-
vm_build_utils.cmd.setup_patching(setup_ssl=True)[source]¶ follow this guide to make sure models can be downloaded without error: https://github.com/fchollet/deep-learning-models/issues/33#issuecomment-397257502
-
vm_build_utils.cmd.setup_run_mode(args)[source]¶ args is a command line parser result - use it to configure the run mode