Add virtual method Init() in Pass abstract class close #404

pull/405/head
wxyu 2019-11-19 12:29:05 +08:00
parent 00a21da414
commit 7ad5c51497
13 changed files with 39 additions and 13 deletions

View File

@ -29,6 +29,7 @@ Please mark all change in change log and use the ticket from JIRA.
- \#322 - Add option to enable / disable prometheus
- \#358 - Add more information in build.sh and install.md
- \#255 - Add ivfsq8 test report detailed version
- \#404 - Add virtual method Init() in Pass abstract class
## Task

View File

@ -84,6 +84,7 @@ load_simple_config() {
void
StartSchedulerService() {
load_simple_config();
OptimizerInst::GetInstance()->Init();
ResMgrInst::GetInstance()->Start();
SchedInst::GetInstance()->Start();
JobMgrInst::GetInstance()->Start();

View File

@ -23,6 +23,10 @@
namespace milvus {
namespace scheduler {
void
HybridPass::Init() {
}
bool
HybridPass::Run(const TaskPtr& task) {
// TODO: future, Index::IVFSQ8H, if nq < threshold set cpu, else set gpu

View File

@ -37,6 +37,9 @@ class HybridPass : public Pass {
HybridPass() = default;
public:
void
Init() override;
bool
Run(const TaskPtr& task) override;
};

View File

@ -27,7 +27,8 @@
namespace milvus {
namespace scheduler {
LargeSQ8HPass::LargeSQ8HPass() {
void
LargeSQ8HPass::Init() {
server::Config& config = server::Config::GetInstance();
Status s = config.GetEngineConfigGpuSearchThreshold(threshold_);
if (!s.ok()) {

View File

@ -35,9 +35,12 @@ namespace scheduler {
class LargeSQ8HPass : public Pass {
public:
LargeSQ8HPass();
LargeSQ8HPass() = default;
public:
void
Init() override;
bool
Run(const TaskPtr& task) override;

View File

@ -24,6 +24,10 @@
namespace milvus {
namespace scheduler {
void
OnlyCPUPass::Init() {
}
bool
OnlyCPUPass::Run(const TaskPtr& task) {
if (task->Type() != TaskType::SearchTask)

View File

@ -37,6 +37,9 @@ class OnlyCPUPass : public Pass {
OnlyCPUPass() = default;
public:
void
Init() override;
bool
Run(const TaskPtr& task) override;
};

View File

@ -27,6 +27,10 @@ namespace scheduler {
OnlyGPUPass::OnlyGPUPass(bool has_cpu) : has_cpu_(has_cpu) {
}
void
OnlyGPUPass::Init() {
}
bool
OnlyGPUPass::Run(const TaskPtr& task) {
if (task->Type() != TaskType::SearchTask || has_cpu_)

View File

@ -37,6 +37,9 @@ class OnlyGPUPass : public Pass {
explicit OnlyGPUPass(bool has_cpu);
public:
void
Init() override;
bool
Run(const TaskPtr& task) override;

View File

@ -20,12 +20,12 @@
namespace milvus {
namespace scheduler {
// void
// Optimizer::Init() {
// for (auto& pass : pass_list_) {
// pass->Init();
// }
// }
void
Optimizer::Init() {
for (auto& pass : pass_list_) {
pass->Init();
}
}
bool
Optimizer::Run(const TaskPtr& task) {

View File

@ -38,8 +38,8 @@ class Optimizer {
explicit Optimizer(std::vector<PassPtr> pass_list) : pass_list_(std::move(pass_list)) {
}
// void
// Init();
void
Init();
bool
Run(const TaskPtr& task);

View File

@ -34,9 +34,8 @@ namespace scheduler {
class Pass {
public:
// virtual void
// Init() {
// }
virtual void
Init() = 0;
virtual bool
Run(const TaskPtr& task) = 0;