def run_step(self, interface_name, interface_params): if interface_name == "create_collection": collection_name = utils.get_unique_name("chaos") self.data_type = interface_params["data_type"] self.dimension = interface_params["dimension"] self.milvus.set_collection(collection_name) vector_type = runner_utils.get_vector_type(self.data_type) self.milvus.create_collection(self.dimension, data_type=vector_type) elif interface_name == "insert": batch_size = interface_params["batch_size"] collection_size = interface_params["collection_size"] self.insert(self.milvus, self.milvus.collection_name, self.data_type, self.dimension, collection_size, batch_size) elif interface_name == "create_index": metric_type = interface_params["metric_type"] index_type = interface_params["index_type"] index_param = interface_params["index_param"] vector_type = runner_utils.get_vector_type(self.data_type) field_name = runner_utils.get_default_field_name(vector_type) self.milvus.create_index(field_name, index_type, metric_type, index_param=index_param) elif interface_name == "flush": self.milvus.flush()
def __init__(self, deploy_mode="single"): self.deploy_mode = deploy_mode self._name = utils.get_unique_name() self._hostname = None self._port = config.SERVER_PORT_DEFAULT