def extract_snapshots_matplotlib_cloud(demo_type, core_type): """ runs snapshot extraction on the cloud and saves the result on local machine. """ demo_testing_dir = osp.join(testing_results_dir, demo_type) env_state_files = find_recursive(demo_testing_dir, '*.cp') state_infos = [] for env_state_file in env_state_files: with open(env_state_file,"r") as fh: seg_info = cp.load(fh)['seg_info'] if seg_info == None: continue save_dir = osp.join(osp.dirname(env_state_file), 'snapshots') state_infos.append((seg_info, save_dir, osp.splitext(osp.basename(env_state_file))[0]+'.jpg')) p = multiprocessing.Pool(8) p.map(render_local, state_infos)
def extract_snapshots_on_cloud(demo_type, core_type): """ runs snapshot extraction on the cloud and saves the result on local machine. """ demo_testing_dir = osp.join(testing_results_dir, demo_type) env_state_files = find_recursive(demo_testing_dir, '*.cp') state_infos = [] for env_state_file in env_state_files[0:2]: with open(env_state_file,"r") as fh: seg_info = cp.load(fh)['seg_info'] if seg_info == None: continue save_dir = osp.join(osp.dirname(env_state_file), 'snapshots', osp.splitext(osp.basename(env_state_file))[0]) state_infos.append((seg_info, save_dir)) print colorize("calling on cloud..", "yellow", True) jids = cloud.map(get_state_snapshots, state_infos, _env='RSS3', _type=core_type) res = cloud.result(jids) print colorize("got snapshots from cloud for : %s. Saving..."%demo_type, "green", True) save_snapshots_from_cloud(res)