Returns a list of valid task indices in the given job. Args: job_name: The string name of a job in this cluster. Returns: A list of valid task indices in the given job. Raises: ValueError: If `job_name` does not name a job in this cluster, or no task with index
(self, job_name)
| 392 | return len(job) |
| 393 | |
| 394 | def task_indices(self, job_name): |
| 395 | """Returns a list of valid task indices in the given job. |
| 396 | |
| 397 | Args: |
| 398 | job_name: The string name of a job in this cluster. |
| 399 | |
| 400 | Returns: |
| 401 | A list of valid task indices in the given job. |
| 402 | |
| 403 | Raises: |
| 404 | ValueError: If `job_name` does not name a job in this cluster, |
| 405 | or no task with index `task_index` is defined in that job. |
| 406 | """ |
| 407 | try: |
| 408 | job = self._cluster_spec[job_name] |
| 409 | except KeyError: |
| 410 | raise ValueError("No such job in cluster: %r" % job_name) |
| 411 | return list(sorted(job.keys())) |
| 412 | |
| 413 | def task_address(self, job_name, task_index): |
| 414 | """Returns the address of the given task in the given job. |