提交 385225c7 编写于 作者: J jinhai

Merge branch 'branch-0.4.0' into 'branch-0.4.0'

MS-531 Disable next version code

See merge request megasearch/milvus!523

Former-commit-id: dcdb5abe78aec0903e61744e4d18ab7d0b523ba0
...@@ -108,6 +108,7 @@ Please mark all change in change log and use the ticket from JIRA. ...@@ -108,6 +108,7 @@ Please mark all change in change log and use the ticket from JIRA.
- MS-527 - Update scheduler_test and enable it - MS-527 - Update scheduler_test and enable it
- MS-528 - Hide some config used future - MS-528 - Hide some config used future
- MS-530 - Add unittest for SearchTask->Load - MS-530 - Add unittest for SearchTask->Load
- MS-531 - Disable next version code
## New Feature ## New Feature
- MS-343 - Implement ResourceMgr - MS-343 - Implement ResourceMgr
......
...@@ -145,51 +145,52 @@ Scheduler::OnLoadCompleted(const EventPtr &event) { ...@@ -145,51 +145,52 @@ Scheduler::OnLoadCompleted(const EventPtr &event) {
break; break;
} }
case TaskLabelType::SPECIFIED_RESOURCE: { case TaskLabelType::SPECIFIED_RESOURCE: {
auto self = event->resource_.lock(); // support next version
auto task = load_completed_event->task_table_item_->task; // auto self = event->resource_.lock();
// auto task = load_completed_event->task_table_item_->task;
// if this resource is disk, assign it to smallest cost resource //
if (self->type() == ResourceType::DISK) { // // if this resource is disk, assign it to smallest cost resource
// step 1: calculate shortest path per resource, from disk to compute resource // if (self->type() == ResourceType::DISK) {
auto compute_resources = res_mgr_.lock()->GetComputeResources(); // // step 1: calculate shortest path per resource, from disk to compute resource
std::vector<std::vector<std::string>> paths; // auto compute_resources = res_mgr_.lock()->GetComputeResources();
std::vector<uint64_t> transport_costs; // std::vector<std::vector<std::string>> paths;
for (auto &res : compute_resources) { // std::vector<uint64_t> transport_costs;
std::vector<std::string> path; // for (auto &res : compute_resources) {
uint64_t transport_cost = ShortestPath(self, res, res_mgr_.lock(), path); // std::vector<std::string> path;
transport_costs.push_back(transport_cost); // uint64_t transport_cost = ShortestPath(self, res, res_mgr_.lock(), path);
paths.emplace_back(path); // transport_costs.push_back(transport_cost);
} // paths.emplace_back(path);
// }
// step 2: select min cost, cost(resource) = avg_cost * task_to_do + transport_cost //
uint64_t min_cost = std::numeric_limits<uint64_t>::max(); // // step 2: select min cost, cost(resource) = avg_cost * task_to_do + transport_cost
uint64_t min_cost_idx = 0; // uint64_t min_cost = std::numeric_limits<uint64_t>::max();
for (uint64_t i = 0; i < compute_resources.size(); ++i) { // uint64_t min_cost_idx = 0;
if (compute_resources[i]->TotalTasks() == 0) { // for (uint64_t i = 0; i < compute_resources.size(); ++i) {
min_cost_idx = i; // if (compute_resources[i]->TotalTasks() == 0) {
break; // min_cost_idx = i;
} // break;
uint64_t cost = compute_resources[i]->TaskAvgCost() * compute_resources[i]->NumOfTaskToExec() // }
+ transport_costs[i]; // uint64_t cost = compute_resources[i]->TaskAvgCost() * compute_resources[i]->NumOfTaskToExec()
if (min_cost > cost) { // + transport_costs[i];
min_cost = cost; // if (min_cost > cost) {
min_cost_idx = i; // min_cost = cost;
} // min_cost_idx = i;
} // }
// }
// step 3: set path in task //
Path task_path(paths[min_cost_idx], paths[min_cost_idx].size() - 1); // // step 3: set path in task
task->path() = task_path; // Path task_path(paths[min_cost_idx], paths[min_cost_idx].size() - 1);
} // task->path() = task_path;
// }
if (self->name() == task->path().Last()) { //
self->WakeupLoader(); // if (self->name() == task->path().Last()) {
} else { // self->WakeupLoader();
auto next_res_name = task->path().Next(); // } else {
auto next_res = res_mgr_.lock()->GetResource(next_res_name); // auto next_res_name = task->path().Next();
load_completed_event->task_table_item_->Move(); // auto next_res = res_mgr_.lock()->GetResource(next_res_name);
next_res->task_table().Put(task); // load_completed_event->task_table_item_->Move();
} // next_res->task_table().Put(task);
// }
break; break;
} }
case TaskLabelType::BROADCAST: { case TaskLabelType::BROADCAST: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册