def _link_guild_dir(src, link): if os.path.lexists(link): link_target = os.path.realpath(link) if not util.compare_paths(src, link_target): log.warning( "Guild directory %s exists (links to %s), " "skipping link to Guild home %s", link, link_target, src, ) return elif os.path.exists(link): log.warning( "Guild directory %s exists, skipping link to Guild home %s", link, src) return util.ensure_dir(os.path.dirname(link)) util.symlink(src, link)
def _trial_name(run): if util.compare_paths(os.path.dirname(run.dir), var.runs_dir()): return os.path.basename(run.dir) else: return "in %s" % run.dir
def _styled_op_dir_suffix(op_dir, apply_style): cwd = os.path.abspath(config.cwd()) if util.compare_paths(op_dir, cwd): return _empty_style("", apply_style) shortened_op_dir = run_util.shorten_op_dir(op_dir, cwd) return _dim_style(" (%s)" % shortened_op_dir, apply_style)
def _is_parent_run_path(path, runs_dir): return util.compare_paths(os.path.dirname(path), runs_dir)