def isLoaded(self): self.project_id = db_tables.checkProject(self.session, self.project) if self.project_id is None: return False self.dataset_id = db_tables.checkDataset(self.session, self.project_id, self.dataset) if self.dataset_id is None: return False return True
def createProjectDataset(self): self.project_id = db_tables.checkProject(self.session, self.project) if self.project_id is None: self.project_id = db_tables.addProject(self.session, self.project) self.dataset_id = db_tables.checkDataset(self.session, self.project_id, self.dataset) if self.dataset_id is None: self.dataset_id = db_tables.addDataset(self.session, self.project_id, self.dataset)
def getExperiments(session, project, dataset, exp_kind=None): project_id = db_tables.checkProject(session, project) dataset_id = db_tables.checkDataset(session, project_id, dataset) query = session.query(ExperimentsAlchemy) query = query.filter(ExperimentsAlchemy.dataset_id == dataset_id) if exp_kind is not None: query = query.filter(ExperimentsAlchemy.kind == exp_kind) query = query.filter(ExperimentsAlchemy.parent == None) experiments = {} for exp in query.all(): if exp.name not in experiments.keys(): experiments[exp.name] = [] experiments[exp.name].append(exp.id) return experiments
def getAllExperiments(session, project, dataset, exp_kind=None): project_id = db_tables.checkProject(session, project) dataset_id = db_tables.checkDataset(session, project_id, dataset) all_kinds = getExperimentKinds(session, dataset_id) experiments = {} for kind in all_kinds: experiments[kind] = [] query = session.query(ExperimentsAlchemy) query = query.filter(ExperimentsAlchemy.dataset_id == dataset_id) query = query.filter(ExperimentsAlchemy.kind == kind) query = query.filter(ExperimentsAlchemy.parent == None) for exp in query.all(): e = {'name': exp.name, 'id': exp.id} experiments[kind].append(e) if len(experiments[kind]) == 0: del experiments[kind] return experiments
def setDatasetId(self): project_id = db_tables.checkProject(self.session, self.project) dataset_id = db_tables.checkDataset(self.session, project_id, self.dataset) return dataset_id