ep_id = "4b116d3c-1703-4f8f-9f6f-39921e5864df" print("FN_UUID : ", func_ids) start = time.time() task_count = 5 batch = fx.create_batch() for func_id in func_ids: for i in range(task_count): batch.add(i, i + 1, c=i + 2, d=i + 3, endpoint_id=ep_id, function_id=func_id) task_ids = fx.batch_run(batch) delta = time.time() - start print(f"Time to launch {task_count * len(func_ids)} tasks: {delta:8.3f} s") print(f"Got {len(task_ids)} tasks_ids ") for _i in range(10): x = fx.get_batch_result(task_ids) complete_count = sum(1 for t in task_ids if t in x and x[t].get("pending", False)) print(f"Batch status : {complete_count}/{len(task_ids)} complete") if complete_count == len(task_ids): print(x) break time.sleep(5)
if args.proxy: store = ps.store.init_store( "redis", hostname="127.0.0.1", port=args.redis_port, ) batch = fxc.create_batch() for _ in range(args.num_arrays): x = np.random.rand(args.size, args.size) if args.proxy: x = store.proxy(x) batch.add(x, endpoint_id=args.funcx_endpoint, function_id=double_uuid) batch_res = fxc.batch_run(batch) mapped_results = fxc.get_batch_result(batch_res) for res in mapped_results.values(): while res["pending"]: time.sleep(0.1) mapped_results = [ fxc.get_result(i) for i, status in mapped_results.items() ] if args.proxy: mapped_results = store.proxy(mapped_results) total = fxc.run( mapped_results, endpoint_id=args.funcx_endpoint, function_id=sum_uuid, )