Exemple #1
0
# -----------------------------------------------------------------

# 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)

    # get the local and remote paths (creating the local directories if needed)
    skirtrun = SkirtRun(runid, create=True)
    local_runpath = skirtrun.runpath()
    local_inpath = skirtrun.inpath()
Exemple #2
0
# if there is single record, put it into a list
if len(records.shape)==0:
    records = [ records ]

# display some information for verification
print "Selected {} galaxies from {} with stellar mass 10^{} to 10^{}" \
            .format(len(records), eaglesim, minstarmass, maxstarmass)
print "SKIRT-runs will be inserted with label {} and ski template {}" \
            .format(label, skitemplate)

# ask confirmation
confirm = raw_input("--> Would you like to insert {} new SKIRT-runs? [y/n]: ".format(len(records)))
if not confirm.lower().startswith('y'): exit()

# backup the data base
database.backup()

# insert a new record into the database for each selected galaxy
db = database.Database()
firstid = db.maxrunid()+1
with db.transaction():
    for record in records:
        db.insert(label, eaglesim,
                  int(record["snaptag"]), int(record["galaxyid"]), int(record["groupnr"]), int(record["subgroupnr"]),
                  float(record["starmass"]), float(record["copx"]), float(record["copy"]), float(record["copz"]),
                  skitemplate, numpp, deltamax)
lastid = db.maxrunid()
db.close()

# confirm completion
print "{} new SKIRT-runs were inserted with run-ids {}-{}".format(len(records), firstid, lastid)
Exemple #3
0
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)

    # get the local and remote paths (creating the local directories if needed)
    skirtrun = SkirtRun(runid, create=True)
Exemple #4
0
    records = [records]

# display some information for verification
print "Selected {} galaxies from {} with stellar mass 10^{} to 10^{}" \
            .format(len(records), eaglesim, minstarmass, maxstarmass)
print "SKIRT-runs will be inserted with label {} and ski template {}" \
            .format(label, skitemplate)

# ask confirmation
confirm = raw_input(
    "--> Would you like to insert {} new SKIRT-runs? [y/n]: ".format(
        len(records)))
if not confirm.lower().startswith('y'): exit()

# backup the data base
database.backup()

# insert a new record into the database for each selected galaxy
db = database.Database()
firstid = db.maxrunid() + 1
with db.transaction():
    for record in records:
        db.insert(label, eaglesim, int(record["snaptag"]),
                  int(record["galaxyid"]), int(record["groupnr"]),
                  int(record["subgroupnr"]), float(record["starmass"]),
                  float(record["copx"]), float(record["copy"]),
                  float(record["copz"]), skitemplate, numpp, deltamax)
lastid = db.maxrunid()
db.close()

# confirm completion