You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this confuses me because I'm using a with statement for the client so I would think that everything gets cleaned up
start=time.time()
withClient() asclient: # this needs to be commented out to use single threaded for profilingos.makedirs(coco_outdir, exist_ok=True)
os.makedirs(os.path.join(coco_outdir, "tiled_images_no_context"), exist_ok=True)
class_foldes_path=Path(class_folder_path)
class_folders=list(class_foldes_path.glob("*/"))
coco_output=make_coco_metadata(name=name)
coco_tiler=data.COCOtiler(
os.path.join(coco_outdir, "tiled_images_no_context")
)
scene_index=0coco_outputs= []
forclass_folderinclass_folders:
forscene_folderinlist(class_folder.glob("*GRDH*")):
assert"S1"instr(scene_folder)
scene_id=os.path.basename(scene_folder)
layer_pths= [str(i) foriinlist(scene_folder.glob("*png"))]
scene_data_tuple=dask.delayed(coco_tiler.save_background_img_tiles)(
scene_id,
layer_pths,
aux_datasets=[],
aux_resample_ratio=8,
)
coco_output=dask.delayed(coco_tiler.create_coco_from_photopea_layers)(
scene_index, scene_data_tuple, layer_pths
)
coco_outputs.append(coco_output)
scene_index+=1final_coco_output=make_coco_metadata(name=name)
# when we create a distributed client, dask.compute uses that isntead of thread scheduler by defaultcoco_outputs=client.persist(
coco_outputs
) # start computation in the backgroundprogress(coco_outputs) # watch progresscoco_outputs=dask.compute(*coco_outputs)
forcoincoco_outputs:
final_coco_output["images"].extend(co["images"])
final_coco_output["annotations"].extend(co["annotations"])
fori, anninenumerate(final_coco_output["annotations"]):
ann["id"] =icoco_tiler.save_coco_output(
final_coco_output,
os.path.join(coco_outdir, f"./instances_{name.replace(' ', '')}.json"),
)
num_images=len(final_coco_output["images"])
print(f"Number of seconds for {num_images} images: {time.time() -start}")
print(f"Images and COCO JSON have been saved in {coco_outdir}.")
the final print statements occur and the files are saved which is how I know this completes.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a script using dask distributed that calls dask.compute. it completes and saves everything, but returns a traceback at the end of the program
this confuses me because I'm using a with statement for the client so I would think that everything gets cleaned up
the final print statements occur and the files are saved which is how I know this completes.
Beta Was this translation helpful? Give feedback.
All reactions