def _require_asset(doc_cls, barrel_cls, obj_name: str, tgt_path: str, model: str = None): model = model or Project.load().model doc: [Dataset, ModelVersion] = doc_cls.find_one(name=obj_name, model=model) dyr = os.path.join(tgt_path, doc.get_dir_name()) os.makedirs(dyr, exist_ok=True) barrel_cls(doc).deploy(dyr) MetaCargo(docs=[doc], section=get_purpose()).deploy() return dyr
def __init__(self, debug=False): super().__init__(timeout=3) self.debug = debug self.proj = Project.load() self.proc_mon = load_proc_monitor() if self.debug: LOG.debug_mode = True
def __init__(self): self.proj = Project.load() self.train = Training.load(ignore=True) self.mv_api = ModelVersionAPI(self.proj)
def resolve_by_docker_repo(self, ref_to_proj): return Project.find_one(docker_repo=ref_to_proj)
def resolve_by_git_repo(self, ref_to_proj): return Project.find_one(git_repo=ref_to_proj)
def resolve_by_home_dir(self, ref_to_proj): return Project.find_one(home_dir=LocalRepository(ref_to_proj).address)
def resolve_by_cwd(self, _): return Project.find_one(home_dir=os.getcwd())
def resolve_by_name(self, ref_to_proj): if ref_to_proj is None: return None else: return Project.find_one(name=ref_to_proj)