Counts the number of workers (including chief) in cluster_spec.
(cluster_spec, chief_task_type)
| 47 | |
| 48 | |
| 49 | def _count_worker(cluster_spec, chief_task_type): |
| 50 | """Counts the number of workers (including chief) in cluster_spec.""" |
| 51 | if not cluster_spec: |
| 52 | raise RuntimeError( |
| 53 | 'Internal error: `_count_worker` does not expect empty cluster_spec.') |
| 54 | |
| 55 | return (len(cluster_spec.as_dict().get(WORKER, [])) + len( |
| 56 | cluster_spec.as_dict().get(chief_task_type, []))) |
| 57 | |
| 58 | |
| 59 | def _get_global_id(cluster_spec, task_type, task_id, chief_task_type): |
no test coverage detected