def _runs_for_parent_links(parent_path, names, runs_dir): real_paths = [util.realpath(os.path.join(parent_path, name)) for name in names] return [ runlib.for_dir(path) for path in real_paths if _is_parent_run_path(path, runs_dir) ]
def _file_type_info(self, path): typeDesc, icon, iconTooltip, viewer = self._base_file_type_info(path) if os.path.islink(path): target = util.realpath(path) link_type = "directory" if os.path.isdir(target) else "file" if target.startswith(var.runs_dir()): typeDesc = "Link to operation output" elif target.startswith(var.cache_dir()): typeDesc = "Link to resource {}".format(link_type) else: typeDesc = "Link" icon = "folder-move" if link_type == "directory" else "file-send" iconTooltip = "Link" return typeDesc, icon, iconTooltip, viewer
def _op_source_info(self, path): if not os.path.islink(path): return None, None path = util.realpath(path) runs_dir = var.runs_dir() if not path.startswith(runs_dir): return None, None subdir = path[len(runs_dir) + 1:] parts = subdir.split(os.path.sep, 1) try: run = self._run_for_id(parts[0]) except LookupError: return "%s (deleted)" % parts[0][:8], None else: operation = run_util.format_operation(run, nowarn=True) return operation, run.short_id
def trial_runs(batch_run): runs = var.runs(batch_run.dir, sort=["timestamp"], force_root=True) # Update run dirs to real location rather than links under batch run. for run in runs: run.path = util.realpath(run.path) return runs
def _rel_source_path(source, link): source_dir, source_name = os.path.split(source) real_link = util.realpath(link) link_dir = os.path.dirname(real_link) source_rel_dir = os.path.relpath(source_dir, link_dir) return os.path.join(source_rel_dir, source_name)
def _guild_resource_cache(): return util.realpath(var.cache_dir("resources"))
def _apply_batch_runs_realpath(runs): """Update run dirs to real location from relative location under batch.""" for run in runs: run.path = util.realpath(run.path)