コード例 #1
0
 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)
コード例 #2
0
 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
コード例 #3
0
ファイル: experiment_db_tools.py プロジェクト: wtbsw/SecuML
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 list(experiments.keys()):
            experiments[exp.name] = []
        experiments[exp.name].append(exp.id)
    return experiments
コード例 #4
0
ファイル: experiment_db_tools.py プロジェクト: wtbsw/SecuML
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
コード例 #5
0
 def loadInDatabase(self, logger):
     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)
     self.computeHashes()
     if self.dataset_id is None:
         self.dataset_id = db_tables.addDataset(self.session,
                                                self.project_id,
                                                self.dataset,
                                                self.idents_hash,
                                                self.ground_truth_hash)
         self.loadIdents(logger)
         if self.annotations_filename is not None:
             self.loadGroundTruth(logger)
     else:
         idents_hash, ground_truth_hash = db_tables.getDatasetHashes(
             self.session, self.project_id, self.dataset_id)
         self.checkHashes(idents_hash, ground_truth_hash)
         if self.annotations_filename is not None:
             if ground_truth_hash is None:
                 self.loadGroundTruth(logger)
コード例 #6
0
 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