def data_sets(self) -> List[DataSet]: """Get all the datasets of this experiment""" runs = get_runs(self.conn, self.exp_id) data_sets = [] for run in runs: data_sets.append(load_by_id(run['run_id'])) return data_sets
def get_runs_from_db(path: str, start: int = 0, stop: Union[None, int] = None, get_structure: bool = False): """ Get a db 'overview' dictionary from the db located in `path`. `start` and `stop` refer to indices of the runs in the db that we want to have details on; if `stop` is None, we'll use runs until the end. if `get_structure` is True, include info on the run data structure in the return dict. """ conn = connect(path) runs = get_runs(conn) if stop is None: stop = len(runs) runs = runs[start:stop] overview = {} for run in runs: run_id = run['run_id'] overview[run_id] = get_ds_info(conn, run_id, get_structure=get_structure) return overview
def getRunOverview(dbPath): try: conn = connect(dbPath) runs = get_runs(conn) except: raise dsets = { 'runId': [r['run_id'] for r in runs], 'experimentName': [], 'sampleName': [], 'dataFields': [], 'startDate': [ time.strftime("%Y-%m-%d", time.localtime(r['run_timestamp'])) for r in runs ], 'startTime': [ time.strftime("%H:%M:%S", time.localtime(r['run_timestamp'])) for r in runs ], 'finishedDate': [ time.strftime("%Y-%m-%d", time.localtime(r['completed_timestamp'])) for r in runs ], 'finishedTime': [ time.strftime("%H:%M:%S", time.localtime(r['completed_timestamp'])) for r in runs ], 'dataRecords': [], } qc.config['core']['db_location'] = dbPath for runId in dsets['runId']: ds = DataSet(dbPath) ds.run_id = runId exp = Experiment(dbPath) exp.exp_id = ds.exp_id dsets['experimentName'].append(exp.name) dsets['sampleName'].append(exp.sample_name) structure = getDatasetStructure(ds) dsInfo = "" for k, v in structure.items(): if 'axes' in v: axInfo = "" for a in v['axes']: axInfo += f"{a}, " if len(axInfo) > 2: axInfo = axInfo[:-2] dsInfo += f"{k} ({axInfo}), " dsSize = ds.number_of_results if len(dsInfo) > 2: dsInfo = dsInfo[:-2] dsets['dataFields'].append(dsInfo) dsets['dataRecords'].append(dsSize) return dsets