Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
ebda6cb4
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ebda6cb4
编写于
9月 21, 2019
作者:
Y
yudong.cai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MS-574 rename ServerConfig to Config
Former-commit-id: 2b0ef94293017c64a2f17616a3089e7f0cdd6b2b
上级
22563d83
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
91 addition
and
123 deletion
+91
-123
cpp/src/cache/CpuCacheMgr.cpp
cpp/src/cache/CpuCacheMgr.cpp
+2
-2
cpp/src/cache/GpuCacheMgr.cpp
cpp/src/cache/GpuCacheMgr.cpp
+2
-2
cpp/src/db/engine/ExecutionEngineImpl.cpp
cpp/src/db/engine/ExecutionEngineImpl.cpp
+2
-1
cpp/src/metrics/MetricBase.h
cpp/src/metrics/MetricBase.h
+0
-6
cpp/src/metrics/Metrics.cpp
cpp/src/metrics/Metrics.cpp
+2
-2
cpp/src/metrics/PrometheusMetrics.cpp
cpp/src/metrics/PrometheusMetrics.cpp
+3
-2
cpp/src/metrics/PrometheusMetrics.h
cpp/src/metrics/PrometheusMetrics.h
+2
-17
cpp/src/scheduler/SchedInst.cpp
cpp/src/scheduler/SchedInst.cpp
+3
-3
cpp/src/server/Config.cpp
cpp/src/server/Config.cpp
+41
-41
cpp/src/server/Config.h
cpp/src/server/Config.h
+2
-2
cpp/src/server/DBWrapper.cpp
cpp/src/server/DBWrapper.cpp
+2
-2
cpp/src/server/Server.cpp
cpp/src/server/Server.cpp
+11
-12
cpp/src/server/grpc_impl/GrpcRequestTask.cpp
cpp/src/server/grpc_impl/GrpcRequestTask.cpp
+3
-3
cpp/src/server/grpc_impl/GrpcServer.cpp
cpp/src/server/grpc_impl/GrpcServer.cpp
+2
-2
cpp/src/utils/LogUtil.cpp
cpp/src/utils/LogUtil.cpp
+1
-3
cpp/src/wrapper/KnowhereResource.cpp
cpp/src/wrapper/KnowhereResource.cpp
+2
-2
cpp/unittest/db/engine_test.cpp
cpp/unittest/db/engine_test.cpp
+0
-1
cpp/unittest/db/search_test.cpp
cpp/unittest/db/search_test.cpp
+3
-4
cpp/unittest/main.cpp
cpp/unittest/main.cpp
+3
-4
cpp/unittest/scheduler/schedinst_test.cpp
cpp/unittest/scheduler/schedinst_test.cpp
+1
-3
cpp/unittest/scheduler/scheduler_test.cpp
cpp/unittest/scheduler/scheduler_test.cpp
+3
-4
cpp/unittest/server/cache_test.cpp
cpp/unittest/server/cache_test.cpp
+1
-3
cpp/unittest/server/config_test.cpp
cpp/unittest/server/config_test.cpp
+0
-1
cpp/unittest/server/rpc_test.cpp
cpp/unittest/server/rpc_test.cpp
+0
-1
未找到文件。
cpp/src/cache/CpuCacheMgr.cpp
浏览文件 @
ebda6cb4
...
...
@@ -17,7 +17,7 @@
#include "CpuCacheMgr.h"
#include "server/
Server
Config.h"
#include "server/Config.h"
#include "utils/Log.h"
namespace
zilliz
{
...
...
@@ -29,7 +29,7 @@ namespace {
}
CpuCacheMgr
::
CpuCacheMgr
()
{
server
::
ServerConfig
&
config
=
server
::
Server
Config
::
GetInstance
();
server
::
Config
&
config
=
server
::
Config
::
GetInstance
();
int64_t
cap
=
config
.
GetCacheConfigCpuMemCapacity
()
*
unit
;
cache_
=
std
::
make_shared
<
Cache
<
DataObjPtr
>>
(
cap
,
1UL
<<
32
);
...
...
cpp/src/cache/GpuCacheMgr.cpp
浏览文件 @
ebda6cb4
...
...
@@ -19,7 +19,7 @@
#include <sstream>
#include "utils/Log.h"
#include "GpuCacheMgr.h"
#include "server/
Server
Config.h"
#include "server/Config.h"
namespace
zilliz
{
namespace
milvus
{
...
...
@@ -33,7 +33,7 @@ namespace {
}
GpuCacheMgr
::
GpuCacheMgr
()
{
server
::
ServerConfig
&
config
=
server
::
Server
Config
::
GetInstance
();
server
::
Config
&
config
=
server
::
Config
::
GetInstance
();
int32_t
cap
=
config
.
GetCacheConfigGpuMemCapacity
()
*
G_BYTE
;
cache_
=
std
::
make_shared
<
Cache
<
DataObjPtr
>>
(
cap
,
1UL
<<
32
);
...
...
cpp/src/db/engine/ExecutionEngineImpl.cpp
浏览文件 @
ebda6cb4
...
...
@@ -26,6 +26,7 @@
#include "src/wrapper/vec_index.h"
#include "src/wrapper/vec_impl.h"
#include "knowhere/common/Exception.h"
#include "server/Config.h"
#include <stdexcept>
...
...
@@ -334,7 +335,7 @@ Status ExecutionEngineImpl::GpuCache(uint64_t gpu_id) {
// TODO(linxj): remove.
Status
ExecutionEngineImpl
::
Init
()
{
using
namespace
zilliz
::
milvus
::
server
;
ServerConfig
&
config
=
Server
Config
::
GetInstance
();
server
::
Config
&
config
=
server
::
Config
::
GetInstance
();
gpu_num_
=
config
.
GetDBConfigBuildIndexGPU
();
return
Status
::
OK
();
...
...
cpp/src/metrics/MetricBase.h
浏览文件 @
ebda6cb4
...
...
@@ -19,7 +19,6 @@
#pragma once
#include "utils/Error.h"
#include "server/ServerConfig.h"
#include "SystemInfo.h"
namespace
zilliz
{
...
...
@@ -83,11 +82,6 @@ class MetricsBase{
virtual
void
CPUTemperature
()
{};
};
}
}
}
\ No newline at end of file
cpp/src/metrics/Metrics.cpp
浏览文件 @
ebda6cb4
...
...
@@ -16,7 +16,7 @@
// under the License.
#include "Metrics.h"
#include "server/
Server
Config.h"
#include "server/Config.h"
#include "PrometheusMetrics.h"
...
...
@@ -32,7 +32,7 @@ Metrics::GetInstance() {
MetricsBase
&
Metrics
::
CreateMetricsCollector
()
{
ServerConfig
&
config
=
Server
Config
::
GetInstance
();
Config
&
config
=
Config
::
GetInstance
();
std
::
string
collector_type_str
=
config
.
GetMetricConfigCollector
();
if
(
collector_type_str
==
"prometheus"
)
{
...
...
cpp/src/metrics/PrometheusMetrics.cpp
浏览文件 @
ebda6cb4
...
...
@@ -16,8 +16,9 @@
// under the License.
#include
<cache/GpuCacheMgr.h>
#include
"cache/GpuCacheMgr.h"
#include "PrometheusMetrics.h"
#include "server/Config.h"
#include "utils/Log.h"
#include "SystemInfo.h"
...
...
@@ -29,7 +30,7 @@ namespace server {
ErrorCode
PrometheusMetrics
::
Init
()
{
try
{
ServerConfig
&
config
=
Server
Config
::
GetInstance
();
Config
&
config
=
Config
::
GetInstance
();
startup_
=
config
.
GetMetricConfigAutoBootup
();
if
(
!
startup_
)
return
SERVER_SUCCESS
;
...
...
cpp/src/metrics/PrometheusMetrics.h
浏览文件 @
ebda6cb4
...
...
@@ -17,15 +17,13 @@
#pragma once
#include "utils/Error.h"
#include <memory>
#include <vector>
#include <prometheus/registry.h>
#include <prometheus/exposer.h>
#include <iostream>
#include "server/ServerConfig.h"
#include "utils/Error.h"
#include "MetricBase.h"
...
...
@@ -38,10 +36,6 @@ namespace zilliz {
namespace
milvus
{
namespace
server
{
class
PrometheusMetrics
:
public
MetricsBase
{
public:
...
...
@@ -107,11 +101,6 @@ class PrometheusMetrics: public MetricsBase {
void
GPUTemperature
()
override
;
void
CPUTemperature
()
override
;
std
::
shared_ptr
<
prometheus
::
Exposer
>
&
exposer_ptr
()
{
return
exposer_ptr_
;
}
// prometheus::Exposer& exposer() { return exposer_;}
std
::
shared_ptr
<
prometheus
::
Registry
>
&
registry_ptr
()
{
return
registry_
;
}
...
...
@@ -125,8 +114,6 @@ class PrometheusMetrics: public MetricsBase {
// .Register(*registry_);
// prometheus::Counter &connection_total_ = connect_request_.Add({});
////all from DBImpl.cpp
using
BucketBoundaries
=
std
::
vector
<
double
>
;
//record add_group request
...
...
@@ -472,10 +459,8 @@ class PrometheusMetrics: public MetricsBase {
.
Name
(
"CPU_temperature"
)
.
Help
(
"CPU temperature"
)
.
Register
(
*
registry_
);
};
}
}
}
...
...
cpp/src/scheduler/SchedInst.cpp
浏览文件 @
ebda6cb4
...
...
@@ -17,7 +17,7 @@
#include "SchedInst.h"
#include "server/
Server
Config.h"
#include "server/Config.h"
#include "ResourceFactory.h"
#include "knowhere/index/vector_index/IndexGPUIVF.h"
#include "Utils.h"
...
...
@@ -38,7 +38,7 @@ std::mutex JobMgrInst::mutex_;
void
load_simple_config
()
{
server
::
ServerConfig
&
config
=
server
::
Server
Config
::
GetInstance
();
server
::
Config
&
config
=
server
::
Config
::
GetInstance
();
auto
mode
=
config
.
GetResourceConfigMode
();
auto
pool
=
config
.
GetResourceConfigPool
();
bool
cpu
=
false
;
...
...
@@ -81,7 +81,7 @@ load_simple_config() {
void
load_advance_config
()
{
// try {
// server::ConfigNode &config = server::
Server
Config::GetInstance().GetConfig(server::CONFIG_RESOURCE);
// server::ConfigNode &config = server::Config::GetInstance().GetConfig(server::CONFIG_RESOURCE);
//
// if (config.GetChildren().empty()) throw "resource_config null exception";
//
...
...
cpp/src/server/
Server
Config.cpp
→
cpp/src/server/Config.cpp
浏览文件 @
ebda6cb4
...
...
@@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.
#include "
Server
Config.h"
#include "Config.h"
#include <sys/stat.h>
#include <sys/types.h>
...
...
@@ -35,14 +35,14 @@ namespace server {
constexpr
uint64_t
MB
=
1024
*
1024
;
constexpr
uint64_t
GB
=
MB
*
1024
;
Server
Config
&
Server
Config
::
GetInstance
()
{
static
ServerConfig
config
;
return
config
;
Config
&
Config
::
GetInstance
()
{
static
Config
config_inst
;
return
config
_inst
;
}
Status
Server
Config
::
LoadConfigFile
(
const
std
::
string
&
filename
)
{
Config
::
LoadConfigFile
(
const
std
::
string
&
filename
)
{
if
(
filename
.
empty
())
{
std
::
cerr
<<
"ERROR: need specify config file"
<<
std
::
endl
;
exit
(
1
);
...
...
@@ -71,7 +71,7 @@ ServerConfig::LoadConfigFile(const std::string &filename) {
}
Status
Server
Config
::
ValidateConfig
()
{
Config
::
ValidateConfig
()
{
if
(
!
CheckServerConfig
().
ok
())
{
return
Status
(
SERVER_INVALID_ARGUMENT
,
"Server config validation check fail"
);
}
...
...
@@ -94,7 +94,7 @@ ServerConfig::ValidateConfig() {
}
Status
Server
Config
::
CheckServerConfig
()
{
Config
::
CheckServerConfig
()
{
/*
server_config:
address: 0.0.0.0 # milvus server ip address (IPv4)
...
...
@@ -154,7 +154,7 @@ ServerConfig::CheckServerConfig() {
}
Status
Server
Config
::
CheckDBConfig
()
{
Config
::
CheckDBConfig
()
{
/*
db_config:
db_path: @MILVUS_DB_PATH@ # milvus data storage path
...
...
@@ -230,7 +230,7 @@ ServerConfig::CheckDBConfig() {
}
Status
Server
Config
::
CheckMetricConfig
()
{
Config
::
CheckMetricConfig
()
{
/*
metric_config:
is_startup: off # if monitoring start: on, off
...
...
@@ -260,7 +260,7 @@ ServerConfig::CheckMetricConfig() {
}
Status
Server
Config
::
CheckCacheConfig
()
{
Config
::
CheckCacheConfig
()
{
/*
cache_config:
cpu_cache_capacity: 16 # how many memory are used as cache, unit: GB, range: 0 ~ less than total memory
...
...
@@ -361,7 +361,7 @@ ServerConfig::CheckCacheConfig() {
}
Status
Server
Config
::
CheckEngineConfig
()
{
Config
::
CheckEngineConfig
()
{
/*
engine_config:
use_blas_threshold: 20
...
...
@@ -396,7 +396,7 @@ ServerConfig::CheckEngineConfig() {
}
Status
Server
Config
::
CheckResourceConfig
()
{
Config
::
CheckResourceConfig
()
{
/*
resource_config:
mode: simple
...
...
@@ -406,7 +406,7 @@ ServerConfig::CheckResourceConfig() {
- gpu100
*/
bool
okay
=
true
;
server
::
ConfigNode
&
config
=
server
::
ServerConfig
::
GetInstance
().
GetConfig
(
server
::
CONFIG_RESOURCE
);
server
::
ConfigNode
&
config
=
GetConfig
(
server
::
CONFIG_RESOURCE
);
auto
mode
=
config
.
GetValue
(
CONFIG_RESOURCE_MODE
,
CONFIG_RESOURCE_MODE_DEFAULT
);
if
(
mode
!=
"simple"
)
{
std
::
cerr
<<
"ERROR: invalid resource config: mode is "
<<
mode
<<
std
::
endl
;
...
...
@@ -422,7 +422,7 @@ ServerConfig::CheckResourceConfig() {
}
//Status
//
Server
Config::CheckResourceConfig() {
//Config::CheckResourceConfig() {
/*
resource_config:
# resource list, length: 0~N
...
...
@@ -604,7 +604,7 @@ ServerConfig::CheckResourceConfig() {
//}
void
Server
Config
::
PrintAll
()
const
{
Config
::
PrintAll
()
const
{
if
(
const
ConfigMgr
*
mgr
=
ConfigMgr
::
GetInstance
())
{
std
::
string
str
=
mgr
->
DumpString
();
// SERVER_LOG_INFO << "\n" << str;
...
...
@@ -613,14 +613,14 @@ ServerConfig::PrintAll() const {
}
ConfigNode
Server
Config
::
GetConfig
(
const
std
::
string
&
name
)
const
{
Config
::
GetConfig
(
const
std
::
string
&
name
)
const
{
const
ConfigMgr
*
mgr
=
ConfigMgr
::
GetInstance
();
const
ConfigNode
&
root_node
=
mgr
->
GetRootNode
();
return
root_node
.
GetChild
(
name
);
}
ConfigNode
&
Server
Config
::
GetConfig
(
const
std
::
string
&
name
)
{
Config
::
GetConfig
(
const
std
::
string
&
name
)
{
ConfigMgr
*
mgr
=
ConfigMgr
::
GetInstance
();
ConfigNode
&
root_node
=
mgr
->
GetRootNode
();
return
root_node
.
GetChild
(
name
);
...
...
@@ -628,28 +628,28 @@ ServerConfig::GetConfig(const std::string &name) {
/* server config */
std
::
string
Server
Config
::
GetServerConfigAddress
()
{
Config
::
GetServerConfigAddress
()
{
ConfigNode
server_config
=
GetConfig
(
CONFIG_SERVER
);
return
server_config
.
GetValue
(
CONFIG_SERVER_ADDRESS
,
CONFIG_SERVER_ADDRESS_DEFAULT
);
}
std
::
string
Server
Config
::
GetServerConfigPort
()
{
Config
::
GetServerConfigPort
()
{
ConfigNode
server_config
=
GetConfig
(
CONFIG_SERVER
);
return
server_config
.
GetValue
(
CONFIG_SERVER_PORT
,
CONFIG_SERVER_PORT_DEFAULT
);
}
std
::
string
Server
Config
::
GetServerConfigMode
()
{
Config
::
GetServerConfigMode
()
{
ConfigNode
server_config
=
GetConfig
(
CONFIG_SERVER
);
return
server_config
.
GetValue
(
CONFIG_SERVER_MODE
,
CONFIG_SERVER_MODE_DEFAULT
);
}
std
::
string
Server
Config
::
GetServerConfigTimeZone
()
{
Config
::
GetServerConfigTimeZone
()
{
ConfigNode
server_config
=
GetConfig
(
CONFIG_SERVER
);
return
server_config
.
GetValue
(
CONFIG_SERVER_TIME_ZONE
,
CONFIG_SERVER_TIME_ZONE_DEFAULT
);
...
...
@@ -657,49 +657,49 @@ ServerConfig::GetServerConfigTimeZone() {
/* db config */
std
::
string
Server
Config
::
GetDBConfigPath
()
{
Config
::
GetDBConfigPath
()
{
ConfigNode
db_config
=
GetConfig
(
CONFIG_DB
);
return
db_config
.
GetValue
(
CONFIG_DB_PATH
,
CONFIG_DB_PATH_DEFAULT
);
}
std
::
string
Server
Config
::
GetDBConfigSlavePath
()
{
Config
::
GetDBConfigSlavePath
()
{
ConfigNode
db_config
=
GetConfig
(
CONFIG_DB
);
return
db_config
.
GetValue
(
CONFIG_DB_SLAVE_PATH
,
CONFIG_DB_SLAVE_PATH_DEFAULT
);
}
std
::
string
Server
Config
::
GetDBConfigBackendUrl
()
{
Config
::
GetDBConfigBackendUrl
()
{
ConfigNode
db_config
=
GetConfig
(
CONFIG_DB
);
return
db_config
.
GetValue
(
CONFIG_DB_BACKEND_URL
,
CONFIG_DB_BACKEND_URL_DEFAULT
);
}
int32_t
Server
Config
::
GetDBConfigArchiveDiskThreshold
()
{
Config
::
GetDBConfigArchiveDiskThreshold
()
{
ConfigNode
db_config
=
GetConfig
(
CONFIG_DB
);
return
db_config
.
GetInt32Value
(
CONFIG_DB_ARCHIVE_DISK_THRESHOLD
,
std
::
stoi
(
CONFIG_DB_ARCHIVE_DISK_THRESHOLD_DEFAULT
));
}
int32_t
Server
Config
::
GetDBConfigArchiveDaysThreshold
()
{
Config
::
GetDBConfigArchiveDaysThreshold
()
{
ConfigNode
db_config
=
GetConfig
(
CONFIG_DB
);
return
db_config
.
GetInt32Value
(
CONFIG_DB_ARCHIVE_DAYS_THRESHOLD
,
std
::
stoi
(
CONFIG_DB_ARCHIVE_DAYS_THRESHOLD_DEFAULT
));
}
int32_t
Server
Config
::
GetDBConfigBufferSize
()
{
Config
::
GetDBConfigBufferSize
()
{
ConfigNode
db_config
=
GetConfig
(
CONFIG_DB
);
return
db_config
.
GetInt32Value
(
CONFIG_DB_BUFFER_SIZE
,
std
::
stoi
(
CONFIG_DB_BUFFER_SIZE_DEFAULT
));
}
int32_t
Server
Config
::
GetDBConfigBuildIndexGPU
()
{
Config
::
GetDBConfigBuildIndexGPU
()
{
ConfigNode
db_config
=
GetConfig
(
CONFIG_DB
);
return
db_config
.
GetInt32Value
(
CONFIG_DB_BUILD_INDEX_GPU
,
std
::
stoi
(
CONFIG_DB_BUILD_INDEX_GPU_DEFAULT
));
...
...
@@ -707,21 +707,21 @@ ServerConfig::GetDBConfigBuildIndexGPU() {
/* metric config */
bool
Server
Config
::
GetMetricConfigAutoBootup
()
{
Config
::
GetMetricConfigAutoBootup
()
{
ConfigNode
metric_config
=
GetConfig
(
CONFIG_METRIC
);
return
metric_config
.
GetBoolValue
(
CONFIG_METRIC_AUTO_BOOTUP
,
std
::
stoi
(
CONFIG_METRIC_AUTO_BOOTUP_DEFAULT
));
}
std
::
string
Server
Config
::
GetMetricConfigCollector
()
{
Config
::
GetMetricConfigCollector
()
{
ConfigNode
metric_config
=
GetConfig
(
CONFIG_METRIC
);
return
metric_config
.
GetValue
(
CONFIG_METRIC_COLLECTOR
,
CONFIG_METRIC_COLLECTOR_DEFAULT
);
}
std
::
string
Server
Config
::
GetMetricConfigPrometheusPort
()
{
Config
::
GetMetricConfigPrometheusPort
()
{
ConfigNode
metric_config
=
GetConfig
(
CONFIG_METRIC
);
return
metric_config
.
GetValue
(
CONFIG_METRIC_PROMETHEUS_PORT
,
CONFIG_METRIC_PROMETHEUS_PORT_DEFAULT
);
...
...
@@ -729,35 +729,35 @@ ServerConfig::GetMetricConfigPrometheusPort() {
/* cache config */
int32_t
Server
Config
::
GetCacheConfigCpuMemCapacity
()
{
Config
::
GetCacheConfigCpuMemCapacity
()
{
ConfigNode
cache_config
=
GetConfig
(
CONFIG_CACHE
);
return
cache_config
.
GetInt32Value
(
CONFIG_CACHE_CPU_MEM_CAPACITY
,
std
::
stoi
(
CONFIG_CACHE_CPU_MEM_CAPACITY_DEFAULT
));
}
float
Server
Config
::
GetCacheConfigCpuMemThreshold
()
{
Config
::
GetCacheConfigCpuMemThreshold
()
{
ConfigNode
cache_config
=
GetConfig
(
CONFIG_CACHE
);
return
cache_config
.
GetFloatValue
(
CONFIG_CACHE_CPU_MEM_THRESHOLD
,
std
::
stof
(
CONFIG_CACHE_CPU_MEM_THRESHOLD_DEFAULT
));
}
int32_t
Server
Config
::
GetCacheConfigGpuMemCapacity
()
{
Config
::
GetCacheConfigGpuMemCapacity
()
{
ConfigNode
cache_config
=
GetConfig
(
CONFIG_CACHE
);
return
cache_config
.
GetInt32Value
(
CONFIG_CACHE_GPU_MEM_CAPACITY
,
std
::
stoi
(
CONFIG_CACHE_GPU_MEM_CAPACITY_DEFAULT
));
}
float
Server
Config
::
GetCacheConfigGpuMemThreshold
()
{
Config
::
GetCacheConfigGpuMemThreshold
()
{
ConfigNode
cache_config
=
GetConfig
(
CONFIG_CACHE
);
return
cache_config
.
GetFloatValue
(
CONFIG_CACHE_GPU_MEM_THRESHOLD
,
std
::
stof
(
CONFIG_CACHE_GPU_MEM_THRESHOLD_DEFAULT
));
}
bool
Server
Config
::
GetCacheConfigCacheInsertData
()
{
Config
::
GetCacheConfigCacheInsertData
()
{
ConfigNode
cache_config
=
GetConfig
(
CONFIG_CACHE
);
return
cache_config
.
GetBoolValue
(
CONFIG_CACHE_CACHE_INSERT_DATA
,
std
::
stoi
(
CONFIG_CACHE_CACHE_INSERT_DATA_DEFAULT
));
...
...
@@ -765,14 +765,14 @@ ServerConfig::GetCacheConfigCacheInsertData() {
/* engine config */
int32_t
Server
Config
::
GetEngineConfigBlasThreshold
()
{
Config
::
GetEngineConfigBlasThreshold
()
{
ConfigNode
engine_config
=
GetConfig
(
CONFIG_ENGINE
);
return
engine_config
.
GetInt32Value
(
CONFIG_ENGINE_BLAS_THRESHOLD
,
std
::
stoi
(
CONFIG_ENGINE_BLAS_THRESHOLD_DEFAULT
));
}
int32_t
Server
Config
::
GetEngineConfigOmpThreadNum
()
{
Config
::
GetEngineConfigOmpThreadNum
()
{
ConfigNode
engine_config
=
GetConfig
(
CONFIG_ENGINE
);
return
engine_config
.
GetInt32Value
(
CONFIG_ENGINE_OMP_THREAD_NUM
,
std
::
stoi
(
CONFIG_ENGINE_OMP_THREAD_NUM_DEFAULT
));
...
...
@@ -780,14 +780,14 @@ ServerConfig::GetEngineConfigOmpThreadNum() {
/* resource config */
std
::
string
Server
Config
::
GetResourceConfigMode
()
{
Config
::
GetResourceConfigMode
()
{
ConfigNode
resource_config
=
GetConfig
(
CONFIG_RESOURCE
);
return
resource_config
.
GetValue
(
CONFIG_RESOURCE_MODE
,
CONFIG_RESOURCE_MODE_DEFAULT
);
}
std
::
vector
<
std
::
string
>
Server
Config
::
GetResourceConfigPool
()
{
Config
::
GetResourceConfigPool
()
{
ConfigNode
resource_config
=
GetConfig
(
CONFIG_RESOURCE
);
return
resource_config
.
GetSequence
(
CONFIG_RESOURCE_POOL
);
}
...
...
cpp/src/server/
Server
Config.h
→
cpp/src/server/Config.h
浏览文件 @
ebda6cb4
...
...
@@ -91,9 +91,9 @@ static const char* CONFIG_RESOURCE_MODE_DEFAULT = "simple";
static
const
char
*
CONFIG_RESOURCE_POOL
=
"pool"
;
class
Server
Config
{
class
Config
{
public:
static
Server
Config
&
GetInstance
();
static
Config
&
GetInstance
();
Status
LoadConfigFile
(
const
std
::
string
&
filename
);
Status
ValidateConfig
();
...
...
cpp/src/server/DBWrapper.cpp
浏览文件 @
ebda6cb4
...
...
@@ -17,7 +17,7 @@
#include "DBWrapper.h"
#include "
Server
Config.h"
#include "Config.h"
#include "db/DBFactory.h"
#include "utils/CommonUtil.h"
#include "utils/Log.h"
...
...
@@ -35,7 +35,7 @@ DBWrapper::DBWrapper() {
}
Status
DBWrapper
::
StartService
()
{
ServerConfig
&
config
=
Server
Config
::
GetInstance
();
Config
&
config
=
Config
::
GetInstance
();
//db config
engine
::
DBOptions
opt
;
...
...
cpp/src/server/Server.cpp
浏览文件 @
ebda6cb4
...
...
@@ -16,14 +16,6 @@
// under the License.
#include <thread>
#include "Server.h"
#include "server/grpc_impl/GrpcServer.h"
#include "utils/Log.h"
#include "utils/LogUtil.h"
#include "utils/SignalUtil.h"
#include "utils/TimeRecorder.h"
#include "metrics/Metrics.h"
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
...
...
@@ -31,10 +23,17 @@
//#include <numaif.h>
#include <unistd.h>
#include <string.h>
#include <src/scheduler/SchedInst.h>
#include "src/wrapper/KnowhereResource.h"
#include "Server.h"
#include "server/grpc_impl/GrpcServer.h"
#include "server/Config.h"
#include "utils/Log.h"
#include "utils/LogUtil.h"
#include "utils/SignalUtil.h"
#include "utils/TimeRecorder.h"
#include "metrics/Metrics.h"
#include "scheduler/SchedInst.h"
#include "wrapper/KnowhereResource.h"
#include "DBWrapper.h"
...
...
@@ -161,7 +160,7 @@ Server::Start() {
}
/* log path is defined in Config file, so InitLog must be called after LoadConfig */
ServerConfig
&
config
=
Server
Config
::
GetInstance
();
Config
&
config
=
Config
::
GetInstance
();
std
::
string
time_zone
=
config
.
GetServerConfigTimeZone
();
if
(
time_zone
.
length
()
==
3
)
{
time_zone
=
"CUT"
;
...
...
@@ -230,7 +229,7 @@ Server::Stop() {
ErrorCode
Server
::
LoadConfig
()
{
ServerConfig
&
server_config
=
Server
Config
::
GetInstance
();
Config
&
server_config
=
Config
::
GetInstance
();
server_config
.
LoadConfigFile
(
config_filename_
);
auto
status
=
server_config
.
ValidateConfig
();
if
(
!
status
.
ok
())
{
...
...
cpp/src/server/grpc_impl/GrpcRequestTask.cpp
浏览文件 @
ebda6cb4
...
...
@@ -15,8 +15,9 @@
// specific language governing permissions and limitations
// under the License.
#include <string.h>
#include "GrpcRequestTask.h"
#include "../ServerConfig.h"
#include "utils/CommonUtil.h"
#include "utils/Log.h"
#include "utils/TimeRecorder.h"
...
...
@@ -28,9 +29,8 @@
#include "scheduler/SchedInst.h"
//#include <gperftools/profiler.h>
#include "s
rc/s
erver/Server.h"
#include "server/Server.h"
#include <string.h>
namespace
zilliz
{
namespace
milvus
{
...
...
cpp/src/server/grpc_impl/GrpcServer.cpp
浏览文件 @
ebda6cb4
...
...
@@ -17,7 +17,7 @@
#include "milvus.grpc.pb.h"
#include "GrpcServer.h"
#include "server/
Server
Config.h"
#include "server/Config.h"
#include "server/DBWrapper.h"
#include "utils/Log.h"
#include "GrpcRequestHandler.h"
...
...
@@ -73,7 +73,7 @@ GrpcServer::Stop() {
Status
GrpcServer
::
StartService
()
{
ServerConfig
&
config
=
Server
Config
::
GetInstance
();
Config
&
config
=
Config
::
GetInstance
();
std
::
string
address
=
config
.
GetServerConfigAddress
();
std
::
string
port
=
config
.
GetServerConfigPort
();
...
...
cpp/src/utils/LogUtil.cpp
浏览文件 @
ebda6cb4
...
...
@@ -15,13 +15,11 @@
// specific language governing permissions and limitations
// under the License.
#include "LogUtil.h"
#include "server/ServerConfig.h"
#include <ctype.h>
#include <string>
#include <libgen.h>
#include "LogUtil.h"
namespace
zilliz
{
namespace
milvus
{
...
...
cpp/src/wrapper/KnowhereResource.cpp
浏览文件 @
ebda6cb4
...
...
@@ -18,7 +18,7 @@
#include "KnowhereResource.h"
#include "knowhere/index/vector_index/helpers/FaissGpuResourceMgr.h"
#include "server/
Server
Config.h"
#include "server/Config.h"
#include <map>
...
...
@@ -38,7 +38,7 @@ ErrorCode KnowhereResource::Initialize() {
GpuResourcesArray
gpu_resources
;
//get build index gpu resource
server
::
ServerConfig
&
config
=
server
::
Server
Config
::
GetInstance
();
server
::
Config
&
config
=
server
::
Config
::
GetInstance
();
int32_t
build_index_gpu
=
config
.
GetDBConfigBuildIndexGPU
();
gpu_resources
.
insert
(
std
::
make_pair
(
build_index_gpu
,
GpuResourceSetting
()));
...
...
cpp/unittest/db/engine_test.cpp
浏览文件 @
ebda6cb4
...
...
@@ -21,7 +21,6 @@
#include "db/engine/EngineFactory.h"
#include "db/engine/ExecutionEngineImpl.h"
#include "server/ServerConfig.h"
#include "utils.h"
using
namespace
zilliz
::
milvus
;
...
...
cpp/unittest/db/search_test.cpp
浏览文件 @
ebda6cb4
...
...
@@ -15,13 +15,12 @@
// specific language governing permissions and limitations
// under the License.
#include "server/ServerConfig.h"
#include "utils/TimeRecorder.h"
#include <gtest/gtest.h>
#include <cmath>
#include <vector>
#include <src/scheduler/task/SearchTask.h>
#include "scheduler/task/SearchTask.h"
#include "utils/TimeRecorder.h"
using
namespace
zilliz
::
milvus
;
...
...
cpp/unittest/main.cpp
浏览文件 @
ebda6cb4
...
...
@@ -15,13 +15,12 @@
// specific language governing permissions and limitations
// under the License.
#include "utils/easylogging++.h"
#include "server/ServerConfig.h"
#include "utils/CommonUtil.h"
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include "utils/easylogging++.h"
#include "utils/CommonUtil.h"
INITIALIZE_EASYLOGGINGPP
using
namespace
zilliz
::
milvus
;
...
...
cpp/unittest/scheduler/schedinst_test.cpp
浏览文件 @
ebda6cb4
...
...
@@ -15,12 +15,10 @@
// specific language governing permissions and limitations
// under the License.
#include "scheduler/SchedInst.h"
#include "server/ServerConfig.h"
#include <boost/filesystem.hpp>
#include <gtest/gtest.h>
#include "scheduler/SchedInst.h"
namespace
zilliz
{
namespace
milvus
{
...
...
cpp/unittest/scheduler/scheduler_test.cpp
浏览文件 @
ebda6cb4
...
...
@@ -15,17 +15,16 @@
// specific language governing permissions and limitations
// under the License.
#include "scheduler/Scheduler.h"
#include <gtest/gtest.h>
#include <src/scheduler/tasklabel/DefaultLabel.h>
#include <src/server/ServerConfig.h>
#include "scheduler/tasklabel/DefaultLabel.h"
#include "cache/DataObj.h"
#include "cache/GpuCacheMgr.h"
#include "scheduler/Scheduler.h"
#include "scheduler/task/TestTask.h"
#include "scheduler/ResourceFactory.h"
#include "scheduler/resource/Resource.h"
#include "utils/Error.h"
#include "
src/
wrapper/vec_index.h"
#include "wrapper/vec_index.h"
#include "scheduler/tasklabel/SpecResLabel.h"
...
...
cpp/unittest/server/cache_test.cpp
浏览文件 @
ebda6cb4
...
...
@@ -18,10 +18,8 @@
#include <gtest/gtest.h>
#include "cache/CpuCacheMgr.h"
#include "cache/GpuCacheMgr.h"
#include "server/ServerConfig.h"
#include "utils/Error.h"
#include "
src/
wrapper/vec_index.h"
#include "wrapper/vec_index.h"
using
namespace
zilliz
::
milvus
;
...
...
cpp/unittest/server/config_test.cpp
浏览文件 @
ebda6cb4
...
...
@@ -19,7 +19,6 @@
#include <gtest/gtest-death-test.h>
#include "config/ConfigMgr.h"
#include "server/ServerConfig.h"
#include "utils/CommonUtil.h"
#include "utils/ValidationUtil.h"
...
...
cpp/unittest/server/rpc_test.cpp
浏览文件 @
ebda6cb4
...
...
@@ -29,7 +29,6 @@
#include "grpc/gen-status/status.pb.h"
#include "server/DBWrapper.h"
#include "server/ServerConfig.h"
#include "scheduler/SchedInst.h"
#include "scheduler/ResourceFactory.h"
#include "utils/CommonUtil.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录