def wait_for_healthy(self, release_name, namespace='default', timeout=600): """ Method: wait a milvus instance until healthy or timeout Params: release_name: release name of milvus namespace: namespace that the milvus is running in timeout: default: 600 seconds """ cus_res = CusResource(kind=self.plural, group=self.group, version=self.version, namespace=namespace) starttime = time.time() log.info(f"start to check healthy: {starttime}") while time.time() < starttime + timeout: time.sleep(10) res_object = cus_res.get(release_name) mic_status = res_object.get('status', None) if mic_status is not None: if 'Healthy' == mic_status.get('status'): log.info( f"milvus healthy in {time.time() - starttime} seconds") return True else: log.info(f"milvus status is: {mic_status.get('status')}") log.info(f"end to check healthy until timeout {timeout}") return False
def endpoint(self, release_name, namespace='default'): """ Method: get Milvus endpoint by name and namespace Return: a string type endpoint. e.g: host:port """ endpoint = None cus_res = CusResource(kind=self.plural, group=self.group, version=self.version, namespace=namespace) res_object = cus_res.get(release_name) if res_object.get('status', None) is not None: endpoint = res_object['status']['endpoint'] return endpoint
def wait_for_healthy(self, release_name, namespace='default', timeout=600): cus_res = CusResource(kind=self.plural, group=self.group, version=self.version, namespace=namespace) starttime = time.time() log.info(f"start to check healthy: {starttime}") while time.time() < starttime + timeout: time.sleep(10) res_object = cus_res.get(release_name) if res_object.get('status', None) is not None: if 'Healthy' == res_object['status']['status']: log.info( f"milvus healthy in {time.time() - starttime} seconds") return True log.info(f"end to check healthy until timeout {timeout}") return False