def start_tensorboard_service(self): tb_client = TensorBoardClient(self._k8s_client) tb_client.create_tensorboard_service() logger.info("Waiting for the URL for TensorBoard service...") tb_url = tb_client.get_tensorboard_url() if tb_url: logger.info("TensorBoard service is available at: %s" % tb_url) else: logger.warning("Unable to get the URL for TensorBoard service")
def test_create_tensorboard_service(self): client = k8s.Client( image_name=None, namespace="default", job_name="test-job-%d-%d" % (int(time.time()), random.randint(1, 101)), event_callback=None, ) tb_client = TensorBoardClient(client) tb_client.create_tensorboard_service(port=80, service_type="LoadBalancer") time.sleep(1) service = tb_client._get_tensorboard_service() self.assertTrue("load_balancer" in service["status"]) self.assertEqual(service["spec"]["ports"][0]["port"], 80)