# 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)) error = subprocess.call(("rsync", "-htvz", cosma_prefix+remote_outpath+"/*", local_outpath+"/")) if error: raise ValueError("Error in rsync for out: " + str(error)) error = subprocess.call(("rsync", "-htvz", "--update", cosma_prefix+remote_vispath+"/*", local_vispath+"/"))
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 + "/"))