def _load_and_cache_flags_data( self, mod_path, mod_package, sys_path, flags_dest, cached_data_path ): if ( os.getenv("NO_IMPORT_FLAGS_PROGRESS") != "1" and os.getenv("FLAGS_TEST") != "1" ): cli.note_once("Refreshing flags...") try: script = python_util.Script(mod_path, mod_package, sys_path) except SyntaxError as e: self.log.warning( "cannot import flags from %s: invalid syntax on line %i\n" " %s\n" " %s^", mod_path, e.lineno, e.text.rstrip(), " " * (e.offset - 1), ) return {} else: try: data = self._flags_data_for_script(script, flags_dest) except DataLoadError: return {} else: self._apply_abs_paths(data, os.path.dirname(script.src)) self._cache_data(data, cached_data_path) return data
def one_run(run_id_prefix, args): remote = remote_support.remote_for_args(args) cli.note_once("Getting remote run info") try: return remote.one_run(run_id_prefix) except remotelib.RemoteProcessError as e: _handle_remote_process_error(e) except remotelib.OperationNotSupported: _handle_not_supported(remote)
def _load_and_cache_flags_data(self, mod_path, sys_path, cached_data_path): if os.getenv("NO_IMPORT_FLAGS_PROGRESS") != "1": cli.note_once("Refreshing flags...") script = python_util.Script(mod_path) try: data = self._flags_data_for_script(script, mod_path, sys_path) except DataLoadError: return {} else: self._apply_abs_paths(data, os.path.dirname(script.src)) self._cache_data(data, cached_data_path) return data
def _notify_path_limited(path, what): cli.note_once("Limiting %s to %s (use --all to include all)" % (what, cwd_desc(path)))
def filtered_runs(args): remote = remote_support.remote_for_args(args) cli.note_once("Getting remote run info") with op_handler(remote): return remote.filtered_runs(**_filtered_runs_kw(args))
def _notify_runs_limited(): cli.note_once("Limiting runs to %s (use --all to include all)" % cmd_impl_support.cwd_desc())
def _flags_test(fmt, *args): if os.getenv("FLAGS_TEST") == "1": fmt_args = tuple([call[0](*call[1:]) for call in args]) cli.note_once(fmt % fmt_args)