Return the truth value if local workqueue empty.
(self)
| 576 | return RestoreWorksBarrierHook() |
| 577 | |
| 578 | def local_workqueue_empty(self): |
| 579 | """Return the truth value if local workqueue empty.""" |
| 580 | with ops.name_scope(self._name): |
| 581 | with ops.device(self._local_device): |
| 582 | with ops.device('/cpu:0'): |
| 583 | def _body(_): |
| 584 | with ops.control_dependencies([ |
| 585 | logging_ops.print_v2( |
| 586 | "Wait to set restore_works_barrier to false,", |
| 587 | " maybe LocalWorkMgr hook not set." |
| 588 | " restore_works_barrier:", self.restore_works_barrier)]): |
| 589 | return constant_op.constant(False) |
| 590 | # wait for the local works restored to complete |
| 591 | wait = control_flow_ops.while_loop( |
| 592 | lambda _: self.restore_works_barrier, |
| 593 | _body, |
| 594 | [self.restore_works_barrier], |
| 595 | parallel_iterations=1) |
| 596 | with ops.control_dependencies([wait]): |
| 597 | queue_size = self._restore_work_queue.size() |
| 598 | return math_ops.equal(queue_size, 0) |
no test coverage detected