mirror of https://github.com/milvus-io/milvus.git
MS-574 rename ServerConfig to Config
Former-commit-id: 2b0ef94293017c64a2f17616a3089e7f0cdd6b2bpull/191/head
parent
22563d83d7
commit
ebda6cb4ef
|
@ -17,7 +17,7 @@
|
|||
|
||||
|
||||
#include "CpuCacheMgr.h"
|
||||
#include "server/ServerConfig.h"
|
||||
#include "server/Config.h"
|
||||
#include "utils/Log.h"
|
||||
|
||||
namespace zilliz {
|
||||
|
@ -29,7 +29,7 @@ namespace {
|
|||
}
|
||||
|
||||
CpuCacheMgr::CpuCacheMgr() {
|
||||
server::ServerConfig& config = server::ServerConfig::GetInstance();
|
||||
server::Config& config = server::Config::GetInstance();
|
||||
int64_t cap = config.GetCacheConfigCpuMemCapacity() * unit;
|
||||
cache_ = std::make_shared<Cache<DataObjPtr>>(cap, 1UL<<32);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <sstream>
|
||||
#include "utils/Log.h"
|
||||
#include "GpuCacheMgr.h"
|
||||
#include "server/ServerConfig.h"
|
||||
#include "server/Config.h"
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
|
@ -33,7 +33,7 @@ namespace {
|
|||
}
|
||||
|
||||
GpuCacheMgr::GpuCacheMgr() {
|
||||
server::ServerConfig& config = server::ServerConfig::GetInstance();
|
||||
server::Config& config = server::Config::GetInstance();
|
||||
|
||||
int32_t cap = config.GetCacheConfigGpuMemCapacity() * G_BYTE;
|
||||
cache_ = std::make_shared<Cache<DataObjPtr>>(cap, 1UL<<32);
|
||||
|
|
|
@ -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 = ServerConfig::GetInstance();
|
||||
server::Config &config = server::Config::GetInstance();
|
||||
gpu_num_ = config.GetDBConfigBuildIndexGPU();
|
||||
|
||||
return Status::OK();
|
||||
|
|
|
@ -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() {};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
// under the License.
|
||||
|
||||
#include "Metrics.h"
|
||||
#include "server/ServerConfig.h"
|
||||
#include "server/Config.h"
|
||||
#include "PrometheusMetrics.h"
|
||||
|
||||
|
||||
|
@ -32,7 +32,7 @@ Metrics::GetInstance() {
|
|||
|
||||
MetricsBase &
|
||||
Metrics::CreateMetricsCollector() {
|
||||
ServerConfig &config = ServerConfig::GetInstance();
|
||||
Config &config = Config::GetInstance();
|
||||
std::string collector_type_str = config.GetMetricConfigCollector();
|
||||
|
||||
if (collector_type_str == "prometheus") {
|
||||
|
|
|
@ -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 = ServerConfig::GetInstance();
|
||||
Config &config = Config::GetInstance();
|
||||
startup_ = config.GetMetricConfigAutoBootup();
|
||||
if (!startup_) return SERVER_SUCCESS;
|
||||
|
||||
|
|
|
@ -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> ®istry_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_);
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
|
||||
#include "SchedInst.h"
|
||||
#include "server/ServerConfig.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::ServerConfig::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::ServerConfig::GetInstance().GetConfig(server::CONFIG_RESOURCE);
|
||||
// server::ConfigNode &config = server::Config::GetInstance().GetConfig(server::CONFIG_RESOURCE);
|
||||
//
|
||||
// if (config.GetChildren().empty()) throw "resource_config null exception";
|
||||
//
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
#include "ServerConfig.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;
|
||||
|
||||
ServerConfig &
|
||||
ServerConfig::GetInstance() {
|
||||
static ServerConfig config;
|
||||
return config;
|
||||
Config &
|
||||
Config::GetInstance() {
|
||||
static Config config_inst;
|
||||
return config_inst;
|
||||
}
|
||||
|
||||
Status
|
||||
ServerConfig::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
|
||||
ServerConfig::ValidateConfig() {
|
||||
Config::ValidateConfig() {
|
||||
if (!CheckServerConfig().ok()) {
|
||||
return Status(SERVER_INVALID_ARGUMENT, "Server config validation check fail");
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ ServerConfig::ValidateConfig() {
|
|||
}
|
||||
|
||||
Status
|
||||
ServerConfig::CheckServerConfig() {
|
||||
Config::CheckServerConfig() {
|
||||
/*
|
||||
server_config:
|
||||
address: 0.0.0.0 # milvus server ip address (IPv4)
|
||||
|
@ -154,7 +154,7 @@ ServerConfig::CheckServerConfig() {
|
|||
}
|
||||
|
||||
Status
|
||||
ServerConfig::CheckDBConfig() {
|
||||
Config::CheckDBConfig() {
|
||||
/*
|
||||
db_config:
|
||||
db_path: @MILVUS_DB_PATH@ # milvus data storage path
|
||||
|
@ -230,7 +230,7 @@ ServerConfig::CheckDBConfig() {
|
|||
}
|
||||
|
||||
Status
|
||||
ServerConfig::CheckMetricConfig() {
|
||||
Config::CheckMetricConfig() {
|
||||
/*
|
||||
metric_config:
|
||||
is_startup: off # if monitoring start: on, off
|
||||
|
@ -260,7 +260,7 @@ ServerConfig::CheckMetricConfig() {
|
|||
}
|
||||
|
||||
Status
|
||||
ServerConfig::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
|
||||
ServerConfig::CheckEngineConfig() {
|
||||
Config::CheckEngineConfig() {
|
||||
/*
|
||||
engine_config:
|
||||
use_blas_threshold: 20
|
||||
|
@ -396,7 +396,7 @@ ServerConfig::CheckEngineConfig() {
|
|||
}
|
||||
|
||||
Status
|
||||
ServerConfig::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
|
||||
//ServerConfig::CheckResourceConfig() {
|
||||
//Config::CheckResourceConfig() {
|
||||
/*
|
||||
resource_config:
|
||||
# resource list, length: 0~N
|
||||
|
@ -604,7 +604,7 @@ ServerConfig::CheckResourceConfig() {
|
|||
//}
|
||||
|
||||
void
|
||||
ServerConfig::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
|
||||
ServerConfig::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 &
|
||||
ServerConfig::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
|
||||
ServerConfig::GetServerConfigAddress() {
|
||||
Config::GetServerConfigAddress() {
|
||||
ConfigNode server_config = GetConfig(CONFIG_SERVER);
|
||||
return server_config.GetValue(CONFIG_SERVER_ADDRESS,
|
||||
CONFIG_SERVER_ADDRESS_DEFAULT);
|
||||
}
|
||||
|
||||
std::string
|
||||
ServerConfig::GetServerConfigPort() {
|
||||
Config::GetServerConfigPort() {
|
||||
ConfigNode server_config = GetConfig(CONFIG_SERVER);
|
||||
return server_config.GetValue(CONFIG_SERVER_PORT,
|
||||
CONFIG_SERVER_PORT_DEFAULT);
|
||||
}
|
||||
|
||||
std::string
|
||||
ServerConfig::GetServerConfigMode() {
|
||||
Config::GetServerConfigMode() {
|
||||
ConfigNode server_config = GetConfig(CONFIG_SERVER);
|
||||
return server_config.GetValue(CONFIG_SERVER_MODE,
|
||||
CONFIG_SERVER_MODE_DEFAULT);
|
||||
}
|
||||
|
||||
std::string
|
||||
ServerConfig::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
|
||||
ServerConfig::GetDBConfigPath() {
|
||||
Config::GetDBConfigPath() {
|
||||
ConfigNode db_config = GetConfig(CONFIG_DB);
|
||||
return db_config.GetValue(CONFIG_DB_PATH,
|
||||
CONFIG_DB_PATH_DEFAULT);
|
||||
}
|
||||
|
||||
std::string
|
||||
ServerConfig::GetDBConfigSlavePath() {
|
||||
Config::GetDBConfigSlavePath() {
|
||||
ConfigNode db_config = GetConfig(CONFIG_DB);
|
||||
return db_config.GetValue(CONFIG_DB_SLAVE_PATH,
|
||||
CONFIG_DB_SLAVE_PATH_DEFAULT);
|
||||
}
|
||||
|
||||
std::string
|
||||
ServerConfig::GetDBConfigBackendUrl() {
|
||||
Config::GetDBConfigBackendUrl() {
|
||||
ConfigNode db_config = GetConfig(CONFIG_DB);
|
||||
return db_config.GetValue(CONFIG_DB_BACKEND_URL,
|
||||
CONFIG_DB_BACKEND_URL_DEFAULT);
|
||||
}
|
||||
|
||||
int32_t
|
||||
ServerConfig::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
|
||||
ServerConfig::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
|
||||
ServerConfig::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
|
||||
ServerConfig::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
|
||||
ServerConfig::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
|
||||
ServerConfig::GetMetricConfigCollector() {
|
||||
Config::GetMetricConfigCollector() {
|
||||
ConfigNode metric_config = GetConfig(CONFIG_METRIC);
|
||||
return metric_config.GetValue(CONFIG_METRIC_COLLECTOR,
|
||||
CONFIG_METRIC_COLLECTOR_DEFAULT);
|
||||
}
|
||||
|
||||
std::string
|
||||
ServerConfig::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
|
||||
ServerConfig::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
|
||||
ServerConfig::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
|
||||
ServerConfig::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
|
||||
ServerConfig::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
|
||||
ServerConfig::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
|
||||
ServerConfig::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
|
||||
ServerConfig::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
|
||||
ServerConfig::GetResourceConfigMode() {
|
||||
Config::GetResourceConfigMode() {
|
||||
ConfigNode resource_config = GetConfig(CONFIG_RESOURCE);
|
||||
return resource_config.GetValue(CONFIG_RESOURCE_MODE,
|
||||
CONFIG_RESOURCE_MODE_DEFAULT);
|
||||
}
|
||||
|
||||
std::vector<std::string>
|
||||
ServerConfig::GetResourceConfigPool() {
|
||||
Config::GetResourceConfigPool() {
|
||||
ConfigNode resource_config = GetConfig(CONFIG_RESOURCE);
|
||||
return resource_config.GetSequence(CONFIG_RESOURCE_POOL);
|
||||
}
|
|
@ -91,9 +91,9 @@ static const char* CONFIG_RESOURCE_MODE_DEFAULT = "simple";
|
|||
static const char* CONFIG_RESOURCE_POOL = "pool";
|
||||
|
||||
|
||||
class ServerConfig {
|
||||
class Config {
|
||||
public:
|
||||
static ServerConfig &GetInstance();
|
||||
static Config &GetInstance();
|
||||
|
||||
Status LoadConfigFile(const std::string& filename);
|
||||
Status ValidateConfig();
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
|
||||
#include "DBWrapper.h"
|
||||
#include "ServerConfig.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 = ServerConfig::GetInstance();
|
||||
Config& config = Config::GetInstance();
|
||||
|
||||
//db config
|
||||
engine::DBOptions opt;
|
||||
|
|
|
@ -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 = ServerConfig::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 = ServerConfig::GetInstance();
|
||||
Config& server_config = Config::GetInstance();
|
||||
server_config.LoadConfigFile(config_filename_);
|
||||
auto status = server_config.ValidateConfig();
|
||||
if (!status.ok()) {
|
||||
|
|
|
@ -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 "src/server/Server.h"
|
||||
#include "server/Server.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "milvus.grpc.pb.h"
|
||||
#include "GrpcServer.h"
|
||||
#include "server/ServerConfig.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 = ServerConfig::GetInstance();
|
||||
Config &config = Config::GetInstance();
|
||||
std::string address = config.GetServerConfigAddress();
|
||||
std::string port = config.GetServerConfigPort();
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "KnowhereResource.h"
|
||||
#include "knowhere/index/vector_index/helpers/FaissGpuResourceMgr.h"
|
||||
#include "server/ServerConfig.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::ServerConfig::GetInstance();
|
||||
server::Config& config = server::Config::GetInstance();
|
||||
|
||||
int32_t build_index_gpu = config.GetDBConfigBuildIndexGPU();
|
||||
gpu_resources.insert(std::make_pair(build_index_gpu, GpuResourceSetting()));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue