Refactor distributed `train_utils.wait_for_file`.
Refactor distributed `train_utils.wait_for_file`.

It can wait for arbitrary condition provided by a callable predicate.

PiperOrigin-RevId: 332165291
Change-Id: I31dcb6d7ba3e0b2f2679c8fc966bfc4be0ddb395

tensorflow/agents,tensorflow/agents