Beispiel #1
0
        os.remove(outzip)
    error = subprocess.call(("zip", "-rj", outzip, outdir))
    if error:
        raise ValueError("Error while zipping the out directory: " + str(error))

    # copy the archives offsite
    print "--> Copying archives for SKIRT-run {}...".format(runid)
    timestamp = config.timestamp()
    archdir = os.path.join(archive_path, "g-{0:04}".format(runid // 1000))
    archin = os.path.join(archdir, "r-{0:04}-{1:03}_in_{2}.zip".format(runid // 1000, runid % 1000, timestamp))
    archout = os.path.join(archdir, "r-{0:04}-{1:03}_out_{2}.zip".format(runid // 1000, runid % 1000, timestamp))
    if not os.path.isdir(archdir):
        os.makedirs(archdir)
    error = subprocess.call(("cp", "-v", inzip, archin))
    if error:
        raise ValueError("Error while copying the in archive: " + str(error))
    error = subprocess.call(("cp", "-v", outzip, archout))
    if error:
        raise ValueError("Error while copying the out archive: " + str(error))

    # update the runstatus in the database
    db.updatestatus((runid,), "archived")
    db.commit()

# close the database
db.close()

print "Done..."

# -----------------------------------------------------------------
Beispiel #2
0
                         str(error))

    # copy the archives offsite
    print "--> Copying archives for SKIRT-run {}...".format(runid)
    timestamp = config.timestamp()
    archdir = os.path.join(archive_path, "g-{0:04}".format(runid // 1000))
    archin = os.path.join(
        archdir, "r-{0:04}-{1:03}_in_{2}.zip".format(runid // 1000,
                                                     runid % 1000, timestamp))
    archout = os.path.join(
        archdir, "r-{0:04}-{1:03}_out_{2}.zip".format(runid // 1000,
                                                      runid % 1000, timestamp))
    if not os.path.isdir(archdir): os.makedirs(archdir)
    error = subprocess.call(("cp", "-v", inzip, archin))
    if error:
        raise ValueError("Error while copying the in archive: " + str(error))
    error = subprocess.call(("cp", "-v", outzip, archout))
    if error:
        raise ValueError("Error while copying the out archive: " + str(error))

    # update the runstatus in the database
    db.updatestatus((runid, ), 'archived')
    db.commit()

# close the database
db.close()

print "Done..."

# -----------------------------------------------------------------