broadinstitute / ml4h

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

More consistent stopping of multiprocessing workers

ndiamant opened this issue · comments

What
Make TensorGenerator or test_train_valid_generators a context manager, so that no matter what the multiprocessing workers are always shut down.

Why
It's annoying to manually kill workers if a job fails, and could get in the way of multiple TensorGenerator jobs.

How
Make TensorGenerator or test_train_valid_generators a context manager that manages the workers resource.

Acceptance Criteria
Workers never outlast their TensorGenerator