Constructs a LocalWorkMgr. Args: job_name: name of current tf-worker. task_index: index of current tf-worker. restore_works_dir: a directory that restore works for WorkQueue when failover. name: (Optional.) Name of the LocalWorkMgr. Raises: ValueError:
(self, job_name, task_index, restore_works_dir, name=None)
| 454 | class LocalWorkMgr(object): |
| 455 | """A local work manager for inference job.""" |
| 456 | def __init__(self, job_name, task_index, restore_works_dir, name=None): |
| 457 | """Constructs a LocalWorkMgr. |
| 458 | |
| 459 | Args: |
| 460 | job_name: name of current tf-worker. |
| 461 | task_index: index of current tf-worker. |
| 462 | restore_works_dir: a directory that restore works for |
| 463 | WorkQueue when failover. |
| 464 | name: (Optional.) Name of the LocalWorkMgr. |
| 465 | |
| 466 | Raises: |
| 467 | ValueError: If one of the arguments is invalid. |
| 468 | """ |
| 469 | |
| 470 | self._job_name = job_name |
| 471 | self._task_index = task_index |
| 472 | self._restore_works_dir = restore_works_dir |
| 473 | self._name = name or 'local_workqueue_mgr' |
| 474 | assert job_name in ['worker', 'chief'], \ |
| 475 | 'support chief or worker role, not {}'.format(job_name) |
| 476 | assert task_index >= 0, 'task_index must be >= 0, not {}'.format(task_index) |
| 477 | assert gfile.IsDirectory(restore_works_dir), \ |
| 478 | '{} is not a directory.'.format(restore_works_dir) |
| 479 | self._get_local_works() |
| 480 | self._local_device = control_flow_ops.no_op().device |
| 481 | |
| 482 | @property |
| 483 | def job_name(self): |
nothing calls this directly
no test coverage detected