def completed_or_archived_runids_in_range(runidspec): runids = sorted(runids_in_range(runidspec)) db = Database() runids = filter( lambda runid: db.select("runid=" + str(runid))[0]['runstatus'] in ('completed', 'archived'), runids) db.close() return runids
def completed_skirtruns(unless_filenames=None): db = Database() runids = sorted([ row['runid'] for row in db.select("runstatus='completed' or runstatus='archived'") ]) runs = [ SkirtRun(runid) for runid in runids ] if unless_filenames!=None: runs = filter(lambda run: not has_visualization_files(run,unless_filenames), runs) db.close() return runs
def completed_skirtruns(unless_filenames=None): db = Database() runids = sorted([ row['runid'] for row in db.select("runstatus='completed' or runstatus='archived'") ]) runs = [SkirtRun(runid) for runid in runids] if unless_filenames != None: runs = filter( lambda run: not has_visualization_files(run, unless_filenames), runs) db.close() return runs
# ----------------------------------------------------------------- cosma_prefix = "[email protected]:" # ----------------------------------------------------------------- # copy the cosma database to obiwan so we have a backup and we can open it locally print "--> Copying database from cosma to obiwan backup area..." cosma_database_path = os.path.join(config.cosma["database_path"], "SKIRT-runs.db") backup_database_path = os.path.join(config.backup_path, "cosma_SKIRT-runs_backup_"+config.timestamp()+".db") subprocess.call(("rsync", "-htz", cosma_prefix+cosma_database_path, backup_database_path)) # extract records for all completed SKIRT-runs from the local copy of the cosma database db = Database(backup_database_path) records = db.select("runstatus = 'completed'") db.close() print "--> Cosma has {} completed SKIRT-runs".format(len(records)) # backup and open the local database backup() db = Database() # remove SKIRT-runs that have been archived from the do-list records = filter(lambda record: db.select("runid="+str(record['runid']))[0]['runstatus']!='archived', records) print "--> .. of which {} have not yet been archived".format(len(records)) # synchronize the results from each completed run for record in records: runid = record['runid'] print "--> Synchronizing results for run-id {}...".format(runid)
# ----------------------------------------------------------------- # copy the cosma database to obiwan so we have a backup and we can open it locally print "--> Copying database from cosma to obiwan backup area..." cosma_database_path = os.path.join(config.cosma["database_path"], "SKIRT-runs.db") backup_database_path = os.path.join( config.backup_path, "cosma_SKIRT-runs_backup_" + config.timestamp() + ".db") subprocess.call(("rsync", "-htz", cosma_prefix + cosma_database_path, backup_database_path)) # extract records for all completed SKIRT-runs from the local copy of the cosma database db = Database(backup_database_path) records = db.select("runstatus = 'completed'") db.close() print "--> Cosma has {} completed SKIRT-runs".format(len(records)) # backup and open the local database backup() db = Database() # remove SKIRT-runs that have been archived from the do-list records = filter( lambda record: db.select("runid=" + str(record['runid']))[0]['runstatus'] != 'archived', records) print "--> .. of which {} have not yet been archived".format(len(records)) # synchronize the results from each completed run for record in records: runid = record['runid']
def completed_or_archived_runids_in_range(runidspec): runids = sorted(runids_in_range(runidspec)) db = Database() runids = filter(lambda runid: db.select("runid=" + str(runid))[0]["runstatus"] in ("completed", "archived"), runids) db.close() return runids
def completed_runids(): db = Database() runids = sorted([row["runid"] for row in db.select("runstatus = 'completed'")]) db.close() return runids
def completed_runids(): db = Database() runids = sorted( [row['runid'] for row in db.select("runstatus = 'completed'")]) db.close() return runids