コード例 #1
0
ファイル: synchronize.py プロジェクト: Stargrazer82301/CAAPR
# 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()
    local_outpath = skirtrun.outpath()
    local_vispath = skirtrun.vispath()
    remote_runpath = local_runpath.replace(config.results_path, config.cosma["results_path"])
    remote_inpath = local_inpath.replace(config.results_path, config.cosma["results_path"])
    remote_outpath = local_outpath.replace(config.results_path, config.cosma["results_path"])
    remote_vispath = local_vispath.replace(config.results_path, config.cosma["results_path"])

    # synchronize the files in each directory
    #  - skip subdirectories and symbolic links
    #  - for the vis directory, do not overwrite newer local versions
    error = subprocess.call(("rsync", "-htvz", cosma_prefix+remote_runpath+"/*", local_runpath+"/"))
    if error: raise ValueError("Error in rsync for run: " + str(error))
    error = subprocess.call(("rsync", "-htvz", cosma_prefix+remote_inpath+"/*", local_inpath+"/"))
    if error: raise ValueError("Error in rsync for in: " + str(error))
コード例 #2
0
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()
    local_outpath = skirtrun.outpath()
    local_vispath = skirtrun.vispath()
    remote_runpath = local_runpath.replace(config.results_path,
                                           config.cosma["results_path"])
    remote_inpath = local_inpath.replace(config.results_path,
                                         config.cosma["results_path"])
    remote_outpath = local_outpath.replace(config.results_path,
                                           config.cosma["results_path"])
    remote_vispath = local_vispath.replace(config.results_path,
                                           config.cosma["results_path"])

    # synchronize the files in each directory
    #  - skip subdirectories and symbolic links
    #  - for the vis directory, do not overwrite newer local versions