Find a running TensorBoard instance compatible with the cache key. Returns: A `TensorBoardInfo` object, or `None` if none matches the cache key.
(cache_key)
| 495 | |
| 496 | |
| 497 | def _find_matching_instance(cache_key): |
| 498 | """Find a running TensorBoard instance compatible with the cache key. |
| 499 | |
| 500 | Returns: |
| 501 | A `TensorBoardInfo` object, or `None` if none matches the cache key. |
| 502 | """ |
| 503 | infos = get_all() |
| 504 | candidates = [info for info in infos if info.cache_key == cache_key] |
| 505 | for candidate in sorted(candidates, key=lambda x: x.port): |
| 506 | # TODO(@wchargin): Check here that the provided port is still live. |
| 507 | return candidate |
| 508 | return None |
| 509 | |
| 510 | |
| 511 | def _maybe_read_file(filename): |