def main(): print "------------------" iops = Iops(True) iops.start() if DEL_CONTAINER_NAME: for _del_str in DEL_CONTAINER_NAME: del iops.hosts_container[_del_str] #print iops.hosts_container iops.linq_to_dict() print "-------------------" conn = iops.get_mysql_connection(DES_STORE_IP, DES_STORE_USER, DES_STORE_PASSWORD, PORT) if conn == None: raise TypeErro(r'src_store_addr is not connect!') pool = ThreadPool(processes=len(iops.req_data)) pool.daemon = True for _info in iops.req_data: _path = [] _path = [ '/container/stat/{0}/diskiops'.format(i).encode("utf-8") for i in iops.req_data[_info].values()[0] ] pool.apply_async(iops.request, (iops.req_data[_info].keys()[0], _path, _info, conn)) pool.close() pool.join() if conn is not None: conn.close()
def process_page(self, page_number): results = self.github_search.page_result(page_number) if not results: return None pool = Pool(MAX_THREADS) for result in results: pool.apply_async(self.search_content, (result, )) pool.daemon = True pool.close() pool.join()
def load_batch_images(params, direction, x, patch_loc,map_loc): #We should modify this function to load images with different number of channels size=params["size"] im_type=params["im_type"] patch_use=params['patch_use'] sbt=1 if(im_type=="depth"): normalizer=52492 sbt=params["depth_mean"] if(im_type=="pre_depth"): normalizer=52492 sbt=params["pre_depth_mean"] if(im_type=="gray"): normalizer=255 sbt=params["gray_mean"] if(im_type=="rgb"): normalizer=255 sbt=params["rgb_mean"] if(im_type=="hha_depth_fc6"): normalizer=47.2940864563 sbt=params["hha_depth_fc6_mean"] if(im_type=="rgb_conv4_2"): normalizer=8010.15771484 sbt=params["rgb_conv4_2_mean"] if(im_type=="rgb_conv5_2"): normalizer=1042.07519531 sbt=params["rgb_conv5_2_mean"] im_order=0 if(direction=="S"): im_order=1 map_arg=[(direction, im_type, normalizer, patch_loc,map_loc, patch_use, sbt, size, im[im_order]) for im in x] pool_img = ThreadPool(params["n_procc"]) pool_img.daemon=True results = pool_img.map(load_image_wrapper,map_arg) pool_img.close() pool_img.join() batch_l=convert_set(results,im_type) return numpy.array(batch_l)