提交 2b1240e2 编写于 作者: S starlord

refine code


Former-commit-id: dea5807b12170595c45d402802b5a88fecf24b57
上级 e43d93fc
......@@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.
#include "HybridPass.h"
#include "scheduler/optimizer/HybridPass.h"
#include "scheduler/task/SearchTask.h"
namespace milvus {
......@@ -24,12 +24,12 @@ namespace scheduler {
bool
HybridPass::Run(const TaskPtr& task) {
// TODO: Index::IVFSQ8Hybrid, if nq < threshold set cpu, else set gpu
if (task->Type() != TaskType::SearchTask) return false;
if (task->Type() != TaskType::SearchTask)
return false;
auto search_task = std::static_pointer_cast<XSearchTask>(task);
// if (search_task->file_->engine_type_ == engine::EngineType::FAISS_IVFSQ8Hybrid)
return false;
}
}
}
} // namespace scheduler
} // namespace milvus
......@@ -16,16 +16,16 @@
// under the License.
#pragma once
#include <string>
#include <vector>
#include <condition_variable>
#include <deque>
#include <list>
#include <memory>
#include <mutex>
#include <queue>
#include <deque>
#include <unordered_map>
#include <string>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <memory>
#include <unordered_map>
#include <vector>
#include "Pass.h"
......@@ -43,6 +43,5 @@ class HybridPass : public Pass {
using HybridPassPtr = std::shared_ptr<HybridPass>;
}
}
} // namespace scheduler
} // namespace milvus
......@@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.
#include "Optimizer.h"
#include "scheduler/optimizer/Optimizer.h"
namespace milvus {
namespace scheduler {
......@@ -38,6 +38,5 @@ Optimizer::Run(const TaskPtr& task) {
return false;
}
}
}
} // namespace scheduler
} // namespace milvus
......@@ -16,16 +16,16 @@
// under the License.
#pragma once
#include <string>
#include <vector>
#include <condition_variable>
#include <deque>
#include <list>
#include <memory>
#include <mutex>
#include <queue>
#include <deque>
#include <unordered_map>
#include <string>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <memory>
#include <unordered_map>
#include <vector>
#include "Pass.h"
......@@ -40,12 +40,11 @@ class Optimizer {
Init();
bool
Run(const TaskPtr &task);
Run(const TaskPtr& task);
private:
std::vector<PassPtr> pass_list_;
};
}
}
} // namespace scheduler
} // namespace milvus
......@@ -16,16 +16,16 @@
// under the License.
#pragma once
#include <string>
#include <vector>
#include <condition_variable>
#include <deque>
#include <list>
#include <memory>
#include <mutex>
#include <queue>
#include <deque>
#include <unordered_map>
#include <string>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <memory>
#include <unordered_map>
#include <vector>
#include "scheduler/task/Task.h"
......@@ -35,12 +35,13 @@ namespace scheduler {
class Pass {
public:
virtual void
Init() {}
Init() {
}
virtual bool
Run(const TaskPtr& task) = 0;
};
using PassPtr = std::shared_ptr<Pass>;
}
}
} // namespace scheduler
} // namespace milvus
......@@ -735,8 +735,7 @@ Config::GetDBConfigArchiveDaysThreshold(int32_t& value) {
Status
Config::GetDBConfigInsertBufferSize(int32_t& value) {
std::string str =
GetConfigStr(CONFIG_DB, CONFIG_DB_INSERT_BUFFER_SIZE, CONFIG_DB_INSERT_BUFFER_SIZE_DEFAULT);
std::string str = GetConfigStr(CONFIG_DB, CONFIG_DB_INSERT_BUFFER_SIZE, CONFIG_DB_INSERT_BUFFER_SIZE_DEFAULT);
Status s = CheckDBConfigInsertBufferSize(str);
if (!s.ok()) {
return s;
......@@ -748,8 +747,7 @@ Config::GetDBConfigInsertBufferSize(int32_t& value) {
Status
Config::GetDBConfigBuildIndexGPU(int32_t& value) {
std::string str =
GetConfigStr(CONFIG_DB, CONFIG_DB_BUILD_INDEX_GPU, CONFIG_DB_BUILD_INDEX_GPU_DEFAULT);
std::string str = GetConfigStr(CONFIG_DB, CONFIG_DB_BUILD_INDEX_GPU, CONFIG_DB_BUILD_INDEX_GPU_DEFAULT);
Status s = CheckDBConfigBuildIndexGPU(str);
if (!s.ok()) {
return s;
......@@ -767,8 +765,7 @@ Config::GetDBConfigPreloadTable(std::string& value) {
Status
Config::GetMetricConfigEnableMonitor(bool& value) {
std::string str =
GetConfigStr(CONFIG_METRIC, CONFIG_METRIC_ENABLE_MONITOR, CONFIG_METRIC_ENABLE_MONITOR_DEFAULT);
std::string str = GetConfigStr(CONFIG_METRIC, CONFIG_METRIC_ENABLE_MONITOR, CONFIG_METRIC_ENABLE_MONITOR_DEFAULT);
Status s = CheckMetricConfigEnableMonitor(str);
if (!s.ok()) {
return s;
......@@ -872,8 +869,7 @@ Config::GetEngineConfigUseBlasThreshold(int32_t& value) {
Status
Config::GetEngineConfigOmpThreadNum(int32_t& value) {
std::string str =
GetConfigStr(CONFIG_ENGINE, CONFIG_ENGINE_OMP_THREAD_NUM, CONFIG_ENGINE_OMP_THREAD_NUM_DEFAULT);
std::string str = GetConfigStr(CONFIG_ENGINE, CONFIG_ENGINE_OMP_THREAD_NUM, CONFIG_ENGINE_OMP_THREAD_NUM_DEFAULT);
Status s = CheckEngineConfigOmpThreadNum(str);
if (!s.ok()) {
return s;
......
......@@ -25,6 +25,7 @@
#include <faiss/utils.h>
#include <omp.h>
#include <string>
#include <vector>
namespace milvus {
namespace server {
......@@ -183,14 +184,14 @@ DBWrapper::StopService() {
Status
DBWrapper::PreloadTables(const std::string& preload_tables) {
if(preload_tables.empty()) {
//do nothing
} else if(preload_tables == "*") {
//load all tables
if (preload_tables.empty()) {
// do nothing
} else if (preload_tables == "*") {
// load all tables
std::vector<engine::meta::TableSchema> table_schema_array;
db_->AllTables(table_schema_array);
for(auto& schema : table_schema_array) {
for (auto& schema : table_schema_array) {
auto status = db_->PreloadTable(schema.table_id_);
if (!status.ok()) {
return status;
......@@ -199,7 +200,7 @@ DBWrapper::PreloadTables(const std::string& preload_tables) {
} else {
std::vector<std::string> table_names;
StringHelpFunctions::SplitStringByDelimeter(preload_tables, ",", table_names);
for(auto& name : table_names) {
for (auto& name : table_names) {
auto status = db_->PreloadTable(name);
if (!status.ok()) {
return status;
......
......@@ -21,6 +21,7 @@
#include "utils/Status.h"
#include <memory>
#include <string>
namespace milvus {
namespace server {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册