提交 5bbc291b 编写于 作者: W wxyu

Merge remote-tracking branch 'main/branch-0.4.0' into branch-0.4.0


Former-commit-id: 7eec087d6ec54b880b38989cb217e84491001632
......@@ -5,7 +5,7 @@ try {
dir ("milvus-helm") {
checkout([$class: 'GitSCM', branches: [[name: "${SEMVER}"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${params.GIT_USER}", url: "git@192.168.1.105:megasearch/milvus-helm.git", name: 'origin', refspec: "+refs/heads/${SEMVER}:refs/remotes/origin/${SEMVER}"]]])
dir ("milvus/milvus-gpu") {
sh "helm install --wait --timeout 300 --set engine.image.repository="zilliz.azurecr.cn/milvus/engine" --set engine.image.tag=${DOCKER_VERSION} --set expose.type=loadBalancer --name ${env.JOB_NAME}-${env.BUILD_NUMBER} -f ci/values.yaml --namespace milvus-1 --version 0.4.0 ."
sh "helm install --wait --timeout 300 --set engine.image.repository=\"zilliz.azurecr.cn/milvus/engine\" --set engine.image.tag=${DOCKER_VERSION} --set expose.type=loadBalancer --name ${env.JOB_NAME}-${env.BUILD_NUMBER} -f ci/values.yaml --namespace milvus-1 --version 0.4.0 ."
}
}
} catch (exc) {
......
......@@ -3,7 +3,7 @@ timeout(time: 40, unit: 'MINUTES') {
dir ("${PROJECT_NAME}_test") {
checkout([$class: 'GitSCM', branches: [[name: "${SEMVER}"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${params.GIT_USER}", url: "git@192.168.1.105:Test/milvus_test.git", name: 'origin', refspec: "+refs/heads/${SEMVER}:refs/remotes/origin/${SEMVER}"]]])
sh 'python3 -m pip install -r requirements.txt'
sh "pytest . --alluredir="test_out/dev/single/sqlite" --ip ${env.JOB_NAME}-${env.BUILD_NUMBER}-milvus-gpu-engine.milvus-1.svc.cluster.local"
sh "pytest . --alluredir=\"test_out/dev/single/sqlite\" --ip ${env.JOB_NAME}-${env.BUILD_NUMBER}-milvus-gpu-engine.milvus-1.svc.cluster.local"
}
// mysql database backend test
......@@ -20,7 +20,7 @@ timeout(time: 40, unit: 'MINUTES') {
}
}
dir ("${PROJECT_NAME}_test") {
sh "pytest . --alluredir="test_out/dev/single/mysql" --ip ${env.JOB_NAME}-${env.BUILD_NUMBER}-milvus-gpu-engine.milvus-2.svc.cluster.local"
sh "pytest . --alluredir=\"test_out/dev/single/mysql\" --ip ${env.JOB_NAME}-${env.BUILD_NUMBER}-milvus-gpu-engine.milvus-2.svc.cluster.local"
}
} catch (exc) {
echo 'Milvus Test Failed !'
......
......@@ -4,7 +4,7 @@ timeout(time: 40, unit: 'MINUTES') {
checkout([$class: 'GitSCM', branches: [[name: "${SEMVER}"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${params.GIT_USER}", url: "git@192.168.1.105:Test/milvus_test.git", name: 'origin', refspec: "+refs/heads/${SEMVER}:refs/remotes/origin/${SEMVER}"]]])
sh 'python3 -m pip install -r requirements.txt'
def service_ip = sh (script: "kubectl get svc --namespace milvus-1 ${env.JOB_NAME}-${env.BUILD_NUMBER}-milvus-gpu-engine --template \"{{range .status.loadBalancer.ingress}}{{.ip}}{{end}}\"",returnStdout: true).trim()
sh "pytest . --alluredir="test_out/staging/single/sqlite" --ip ${service_ip}"
sh "pytest . --alluredir=\"test_out/staging/single/sqlite\" --ip ${service_ip}"
}
// mysql database backend test
......@@ -17,12 +17,12 @@ timeout(time: 40, unit: 'MINUTES') {
}
dir ("milvus-helm") {
dir ("milvus/milvus-gpu") {
sh "helm install --wait --timeout 300 --set engine.image.repository="zilliz.azurecr.cn/milvus/engine" --set engine.image.tag=${DOCKER_VERSION} --set expose.type=loadBalancer --name ${env.JOB_NAME}-${env.BUILD_NUMBER} -f ci/db_backend/mysql_values.yaml --namespace milvus-2 --version 0.4.0 ."
sh "helm install --wait --timeout 300 --set engine.image.repository=\"zilliz.azurecr.cn/milvus/engine\" --set engine.image.tag=${DOCKER_VERSION} --set expose.type=loadBalancer --name ${env.JOB_NAME}-${env.BUILD_NUMBER} -f ci/db_backend/mysql_values.yaml --namespace milvus-2 --version 0.4.0 ."
}
}
dir ("${PROJECT_NAME}_test") {
def service_ip = sh (script: "kubectl get svc --namespace milvus-2 ${env.JOB_NAME}-${env.BUILD_NUMBER}-milvus-gpu-engine --template \"{{range .status.loadBalancer.ingress}}{{.ip}}{{end}}\"",returnStdout: true).trim()
sh "pytest . --alluredir="test_out/staging/single/mysql" --ip ${service_ip}"
sh "pytest . --alluredir=\"test_out/staging/single/mysql\" --ip ${service_ip}"
}
} catch (exc) {
echo 'Milvus Test Failed !'
......
......@@ -317,6 +317,7 @@ void DBImpl::StartMetricTask() {
int64_t cache_usage = cache::CpuCacheMgr::GetInstance()->CacheUsage();
int64_t cache_total = cache::CpuCacheMgr::GetInstance()->CacheCapacity();
server::Metrics::GetInstance().CpuCacheUsageGaugeSet(cache_usage*100/cache_total);
server::Metrics::GetInstance().GpuCacheUsageGaugeSet();
uint64_t size;
Size(size);
server::Metrics::GetInstance().DataFileSizeGaugeSet(size);
......
......@@ -413,7 +413,6 @@ Status SqliteMetaImpl::DescribeTableIndex(const std::string &table_id, TableInde
auto groups = ConnectorPtr->select(columns(&TableSchema::engine_type_,
&TableSchema::nlist_,
&TableSchema::index_file_size_,
&TableSchema::metric_type_),
where(c(&TableSchema::table_id_) == table_id
and c(&TableSchema::state_) != (int)TableSchema::TO_DELETE));
......
......@@ -32,7 +32,7 @@ class MetricsBase{
virtual void BuildIndexDurationSecondsHistogramObserve(double value) {};
virtual void CpuCacheUsageGaugeSet(double value) {};
virtual void GpuCacheUsageGaugeSet(double value) {};
virtual void GpuCacheUsageGaugeSet() {};
virtual void MetaAccessTotalIncrement(double value = 1) {};
virtual void MetaAccessDurationSecondsHistogramObserve(double value) {};
......
......@@ -167,15 +167,26 @@ void PrometheusMetrics::CPUTemperature() {
}
}
void PrometheusMetrics::GpuCacheUsageGaugeSet(double value) {
void PrometheusMetrics::GpuCacheUsageGaugeSet() {
if(!startup_) return;
int64_t num_processors = server::SystemInfo::GetInstance().num_processor();
server::ConfigNode& config = server::ServerConfig::GetInstance().GetConfig(server::CONFIG_CACHE);
std::string gpu_ids_str = config.GetValue(server::CONFIG_GPU_IDS, "0,1");
for (auto i = 0; i < num_processors; ++i) {
// int gpu_cache_usage = cache::GpuCacheMgr::GetInstance(i)->CacheUsage();
// int gpu_cache_total = cache::GpuCacheMgr::GetInstance(i)->CacheCapacity();
// prometheus::Gauge &gpu_cache = gpu_cache_usage_.Add({{"GPU_Cache", std::to_string(i)}});
// gpu_cache.Set(gpu_cache_usage * 100 / gpu_cache_total);
std::vector<uint64_t > gpu_ids;
std::stringstream ss(gpu_ids_str);
for (int i; ss >> i;) {
gpu_ids.push_back(i);
if (ss.peek() == ',') {
ss.ignore();
}
}
for(auto i = 0; i < gpu_ids.size(); ++i) {
uint64_t cache_usage = cache::GpuCacheMgr::GetInstance(gpu_ids[i])->CacheUsage();
uint64_t cache_capacity = cache::GpuCacheMgr::GetInstance(gpu_ids[i])->CacheCapacity();
prometheus::Gauge &gpu_cache = gpu_cache_usage_.Add({{"GPU_Cache", std::to_string(i)}});
gpu_cache.Set(cache_usage * 100 / cache_capacity);
}
}
......
......@@ -55,7 +55,7 @@ class PrometheusMetrics: public MetricsBase {
void IndexFileSizeHistogramObserve(double value) override { if(startup_) index_files_size_histogram_.Observe(value);};
void BuildIndexDurationSecondsHistogramObserve(double value) override { if(startup_) build_index_duration_seconds_histogram_.Observe(value);};
void CpuCacheUsageGaugeSet(double value) override { if(startup_) cpu_cache_usage_gauge_.Set(value);};
void GpuCacheUsageGaugeSet(double value) override;
void GpuCacheUsageGaugeSet() override;
void MetaAccessTotalIncrement(double value = 1) override { if(startup_) meta_access_total_.Increment(value);};
void MetaAccessDurationSecondsHistogramObserve(double value) override { if(startup_) meta_access_duration_seconds_histogram_.Observe(value);};
......
......@@ -18,7 +18,7 @@ GrpcRequestHandler::CreateTable(::grpc::ServerContext *context,
const ::milvus::grpc::TableSchema *request,
::milvus::grpc::Status *response) {
BaseTaskPtr task_ptr = CreateTableTask::Create(*request);
BaseTaskPtr task_ptr = CreateTableTask::Create(request);
GrpcRequestScheduler::ExecTask(task_ptr, response);
return ::grpc::Status::OK;
}
......@@ -52,7 +52,7 @@ GrpcRequestHandler::CreateIndex(::grpc::ServerContext *context,
const ::milvus::grpc::IndexParam *request,
::milvus::grpc::Status *response) {
BaseTaskPtr task_ptr = CreateIndexTask::Create(*request);
BaseTaskPtr task_ptr = CreateIndexTask::Create(request);
GrpcRequestScheduler::ExecTask(task_ptr, response);
return ::grpc::Status::OK;
}
......@@ -62,7 +62,7 @@ GrpcRequestHandler::Insert(::grpc::ServerContext *context,
const ::milvus::grpc::InsertParam *request,
::milvus::grpc::VectorIds *response) {
BaseTaskPtr task_ptr = InsertTask::Create(*request, *response);
BaseTaskPtr task_ptr = InsertTask::Create(request, response);
::milvus::grpc::Status grpc_status;
GrpcRequestScheduler::ExecTask(task_ptr, &grpc_status);
response->mutable_status()->set_reason(grpc_status.reason());
......@@ -76,7 +76,7 @@ GrpcRequestHandler::Search(::grpc::ServerContext *context,
::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> *writer) {
std::vector<std::string> file_id_array;
BaseTaskPtr task_ptr = SearchTask::Create(*request, file_id_array, *writer);
BaseTaskPtr task_ptr = SearchTask::Create(request, file_id_array, writer);
::milvus::grpc::Status grpc_status;
GrpcRequestScheduler::ExecTask(task_ptr, &grpc_status);
if (grpc_status.error_code() != SERVER_SUCCESS) {
......@@ -93,7 +93,11 @@ GrpcRequestHandler::SearchInFiles(::grpc::ServerContext *context,
::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> *writer) {
std::vector<std::string> file_id_array;
BaseTaskPtr task_ptr = SearchTask::Create(request->search_param(), file_id_array, *writer);
for(int i = 0; i < request->file_id_array_size(); i++) {
file_id_array.push_back(request->file_id_array(i));
}
::milvus::grpc::SearchInFilesParam *request_mutable = const_cast<::milvus::grpc::SearchInFilesParam *>(request);
BaseTaskPtr task_ptr = SearchTask::Create(request_mutable->mutable_search_param(), file_id_array, writer);
::milvus::grpc::Status grpc_status;
GrpcRequestScheduler::ExecTask(task_ptr, &grpc_status);
if (grpc_status.error_code() != SERVER_SUCCESS) {
......@@ -109,7 +113,7 @@ GrpcRequestHandler::DescribeTable(::grpc::ServerContext *context,
const ::milvus::grpc::TableName *request,
::milvus::grpc::TableSchema *response) {
BaseTaskPtr task_ptr = DescribeTableTask::Create(request->table_name(), *response);
BaseTaskPtr task_ptr = DescribeTableTask::Create(request->table_name(), response);
::milvus::grpc::Status grpc_status;
GrpcRequestScheduler::ExecTask(task_ptr, &grpc_status);
response->mutable_table_name()->mutable_status()->set_error_code(grpc_status.error_code());
......@@ -137,7 +141,7 @@ GrpcRequestHandler::ShowTables(::grpc::ServerContext *context,
const ::milvus::grpc::Command *request,
::grpc::ServerWriter<::milvus::grpc::TableName> *writer) {
BaseTaskPtr task_ptr = ShowTablesTask::Create(*writer);
BaseTaskPtr task_ptr = ShowTablesTask::Create(writer);
::milvus::grpc::Status grpc_status;
GrpcRequestScheduler::ExecTask(task_ptr, &grpc_status);
if (grpc_status.error_code() != SERVER_SUCCESS) {
......@@ -167,7 +171,7 @@ GrpcRequestHandler::Cmd(::grpc::ServerContext *context,
GrpcRequestHandler::DeleteByRange(::grpc::ServerContext *context,
const ::milvus::grpc::DeleteByRangeParam *request,
::milvus::grpc::Status *response) {
BaseTaskPtr task_ptr = DeleteByRangeTask::Create(*request);
BaseTaskPtr task_ptr = DeleteByRangeTask::Create(request);
::milvus::grpc::Status grpc_status;
GrpcRequestScheduler::ExecTask(task_ptr, &grpc_status);
response->set_error_code(grpc_status.error_code());
......@@ -191,7 +195,7 @@ GrpcRequestHandler::PreloadTable(::grpc::ServerContext *context,
GrpcRequestHandler::DescribeIndex(::grpc::ServerContext *context,
const ::milvus::grpc::TableName *request,
::milvus::grpc::IndexParam *response) {
BaseTaskPtr task_ptr = DescribeIndexTask::Create(request->table_name(), *response);
BaseTaskPtr task_ptr = DescribeIndexTask::Create(request->table_name(), response);
::milvus::grpc::Status grpc_status;
GrpcRequestScheduler::ExecTask(task_ptr, &grpc_status);
response->mutable_table_name()->mutable_status()->set_reason(grpc_status.reason());
......
......@@ -23,17 +23,17 @@ namespace grpc {
class CreateTableTask : public GrpcBaseTask {
public:
static BaseTaskPtr
Create(const ::milvus::grpc::TableSchema &schema);
Create(const ::milvus::grpc::TableSchema *schema);
protected:
explicit
CreateTableTask(const ::milvus::grpc::TableSchema &request);
CreateTableTask(const ::milvus::grpc::TableSchema *request);
ServerError
OnExecute() override;
private:
const ::milvus::grpc::TableSchema schema_;
const ::milvus::grpc::TableSchema *schema_;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -58,10 +58,10 @@ private:
class DescribeTableTask : public GrpcBaseTask {
public:
static BaseTaskPtr
Create(const std::string &table_name, ::milvus::grpc::TableSchema &schema);
Create(const std::string &table_name, ::milvus::grpc::TableSchema *schema);
protected:
DescribeTableTask(const std::string &table_name, ::milvus::grpc::TableSchema &schema);
DescribeTableTask(const std::string &table_name, ::milvus::grpc::TableSchema *schema);
ServerError
OnExecute() override;
......@@ -69,7 +69,7 @@ protected:
private:
std::string table_name_;
::milvus::grpc::TableSchema &schema_;
::milvus::grpc::TableSchema *schema_;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -94,76 +94,76 @@ private:
class CreateIndexTask : public GrpcBaseTask {
public:
static BaseTaskPtr
Create(const ::milvus::grpc::IndexParam &index_Param);
Create(const ::milvus::grpc::IndexParam *index_Param);
protected:
explicit
CreateIndexTask(const ::milvus::grpc::IndexParam &index_Param);
CreateIndexTask(const ::milvus::grpc::IndexParam *index_Param);
ServerError
OnExecute() override;
private:
::milvus::grpc::IndexParam index_param_;
const ::milvus::grpc::IndexParam *index_param_;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class ShowTablesTask : public GrpcBaseTask {
public:
static BaseTaskPtr
Create(::grpc::ServerWriter<::milvus::grpc::TableName> &writer);
Create(::grpc::ServerWriter<::milvus::grpc::TableName> *writer);
protected:
explicit
ShowTablesTask(::grpc::ServerWriter<::milvus::grpc::TableName> &writer);
ShowTablesTask(::grpc::ServerWriter<::milvus::grpc::TableName> *writer);
ServerError
OnExecute() override;
private:
::grpc::ServerWriter<::milvus::grpc::TableName> writer_;
::grpc::ServerWriter<::milvus::grpc::TableName> *writer_;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class InsertTask : public GrpcBaseTask {
public:
static BaseTaskPtr
Create(const ::milvus::grpc::InsertParam &insert_Param,
::milvus::grpc::VectorIds &record_ids_);
Create(const ::milvus::grpc::InsertParam *insert_Param,
::milvus::grpc::VectorIds *record_ids_);
protected:
InsertTask(const ::milvus::grpc::InsertParam &insert_Param,
::milvus::grpc::VectorIds &record_ids_);
InsertTask(const ::milvus::grpc::InsertParam *insert_Param,
::milvus::grpc::VectorIds *record_ids_);
ServerError
OnExecute() override;
private:
const ::milvus::grpc::InsertParam insert_param_;
::milvus::grpc::VectorIds &record_ids_;
const ::milvus::grpc::InsertParam *insert_param_;
::milvus::grpc::VectorIds *record_ids_;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class SearchTask : public GrpcBaseTask {
public:
static BaseTaskPtr
Create(const ::milvus::grpc::SearchParam &search_param,
Create(const ::milvus::grpc::SearchParam *search_param,
const std::vector<std::string> &file_id_array,
::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> &writer);
::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> *writer);
protected:
SearchTask(const ::milvus::grpc::SearchParam &search_param,
SearchTask(const ::milvus::grpc::SearchParam *search_param,
const std::vector<std::string> &file_id_array,
::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> &writer);
::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> *writer);
ServerError
OnExecute() override;
private:
const ::milvus::grpc::SearchParam search_param_;
const ::milvus::grpc::SearchParam *search_param_;
std::vector<std::string> file_id_array_;
::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> writer_;
::grpc::ServerWriter<::milvus::grpc::TopKQueryResult> *writer_;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -204,16 +204,16 @@ private:
class DeleteByRangeTask : public GrpcBaseTask {
public:
static BaseTaskPtr
Create(const ::milvus::grpc::DeleteByRangeParam &delete_by_range_param);
Create(const ::milvus::grpc::DeleteByRangeParam *delete_by_range_param);
protected:
DeleteByRangeTask(const ::milvus::grpc::DeleteByRangeParam &delete_by_range_param);
DeleteByRangeTask(const ::milvus::grpc::DeleteByRangeParam *delete_by_range_param);
ServerError
OnExecute() override;
private:
::milvus::grpc::DeleteByRangeParam delete_by_range_param_;
const ::milvus::grpc::DeleteByRangeParam *delete_by_range_param_;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -237,18 +237,18 @@ class DescribeIndexTask : public GrpcBaseTask {
public:
static BaseTaskPtr
Create(const std::string &table_name,
::milvus::grpc::IndexParam &index_param);
::milvus::grpc::IndexParam *index_param);
protected:
DescribeIndexTask(const std::string &table_name,
::milvus::grpc::IndexParam &index_param);
::milvus::grpc::IndexParam *index_param);
ServerError
OnExecute() override;
private:
std::string table_name_;
::milvus::grpc::IndexParam& index_param_;
::milvus::grpc::IndexParam *index_param_;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -22,7 +22,7 @@ TEST(MetricbaseTest, METRICBASE_TEST){
instance.IndexFileSizeHistogramObserve(1.0);
instance.BuildIndexDurationSecondsHistogramObserve(1.0);
instance.CpuCacheUsageGaugeSet(1.0);
instance.GpuCacheUsageGaugeSet(1.0);
instance.GpuCacheUsageGaugeSet();
instance.MetaAccessTotalIncrement();
instance.MetaAccessDurationSecondsHistogramObserve(1.0);
instance.FaissDiskLoadDurationSecondsHistogramObserve(1.0);
......
......@@ -23,7 +23,7 @@ TEST(PrometheusTest, PROMETHEUS_TEST){
instance.IndexFileSizeHistogramObserve(1.0);
instance.BuildIndexDurationSecondsHistogramObserve(1.0);
instance.CpuCacheUsageGaugeSet(1.0);
instance.GpuCacheUsageGaugeSet(1.0);
instance.GpuCacheUsageGaugeSet();
instance.MetaAccessTotalIncrement();
instance.MetaAccessDurationSecondsHistogramObserve(1.0);
instance.FaissDiskLoadDurationSecondsHistogramObserve(1.0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册