提交 b3b88840 编写于 作者: P peng.xu

Merge branch 'branch-0.5.0' into 'branch-0.5.0'

MS-585 Update namespace in scheduler

See merge request megasearch/milvus!603

Former-commit-id: b493ca29c2feaa7b0efe941da7e50060c632b483
......@@ -19,6 +19,7 @@ Please mark all change in change log and use the ticket from JIRA.
- MS-566 - Refactor cmake
- MS-555 - Remove old scheduler
- MS-578 - Makesure milvus5.0 don't crack 0.3.1 data
- MS-585 - Update namespace in scheduler
## New Feature
......
......@@ -133,9 +133,9 @@ Status DBImpl::DeleteTable(const std::string& table_id, const meta::DatesT& date
meta_ptr_->DeleteTable(table_id); //soft delete table
//scheduler will determine when to delete table files
auto nres = ResMgrInst::GetInstance()->GetNumOfComputeResource();
auto nres = scheduler::ResMgrInst::GetInstance()->GetNumOfComputeResource();
scheduler::DeleteJobPtr job = std::make_shared<scheduler::DeleteJob>(0, table_id, meta_ptr_, nres);
JobMgrInst::GetInstance()->Put(job);
scheduler::JobMgrInst::GetInstance()->Put(job);
job->WaitAndDelete();
} else {
meta_ptr_->DropPartitionsByDates(table_id, dates);
......
......@@ -20,7 +20,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
constexpr uint64_t MAXINT = std::numeric_limits<uint32_t >::max();
......
......@@ -24,7 +24,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
uint64_t
ShortestPath(const ResourcePtr &src,
......
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <unordered_map>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <memory>
#include "db/meta/MetaTypes.h"
#include "db/engine/EngineFactory.h"
#include "db/engine/ExecutionEngine.h"
namespace zilliz {
namespace milvus {
namespace scheduler {
using TableFileSchemaPtr = engine::meta::TableFileSchemaPtr;
using TableFileSchema = engine::meta::TableFileSchema;
using ExecutionEnginePtr = engine::ExecutionEnginePtr;
using EngineFactory = engine::EngineFactory;
using EngineType = engine::EngineType;
using MetricType = engine::MetricType;
}
}
}
......@@ -36,9 +36,6 @@ namespace zilliz {
namespace milvus {
namespace scheduler {
using engine::TaskPtr;
using engine::ResourceMgrPtr;
class JobMgr {
public:
explicit
......
......@@ -21,7 +21,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
std::shared_ptr<Resource>
ResourceFactory::Create(const std::string &name,
......
......@@ -28,7 +28,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class ResourceFactory {
public:
......
......@@ -22,7 +22,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
void
......
......@@ -30,7 +30,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class ResourceMgr {
public:
......
......@@ -25,7 +25,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
ResourceMgrPtr ResMgrInst::instance = nullptr;
std::mutex ResMgrInst::mutex_;
......
......@@ -27,7 +27,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class ResMgrInst {
public:
......
......@@ -25,7 +25,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
Scheduler::Scheduler(ResourceMgrWPtr res_mgr)
: running_(false),
......
......@@ -30,7 +30,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
// TODO: refactor, not friendly to unittest, logical in framework code
......
......@@ -45,7 +45,7 @@ TaskCreator::Create(const SearchJobPtr &job) {
std::vector<TaskPtr> tasks;
for (auto &index_file : job->index_files()) {
auto task = std::make_shared<XSearchTask>(index_file.second);
task->label() = std::make_shared<engine::DefaultLabel>();
task->label() = std::make_shared<DefaultLabel>();
task->job_ = job;
tasks.emplace_back(task);
}
......@@ -57,7 +57,7 @@ std::vector<TaskPtr>
TaskCreator::Create(const DeleteJobPtr &job) {
std::vector<TaskPtr> tasks;
auto task = std::make_shared<XDeleteTask>(job);
task->label() = std::make_shared<engine::BroadcastLabel>();
task->label() = std::make_shared<BroadcastLabel>();
task->job_ = job;
tasks.emplace_back(task);
......
......@@ -39,10 +39,6 @@ namespace zilliz {
namespace milvus {
namespace scheduler {
using engine::TaskPtr;
using engine::XSearchTask;
using engine::XDeleteTask;
class TaskCreator {
public:
static std::vector<TaskPtr>
......
......@@ -27,7 +27,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
std::string
ToString(TaskTableItemState state) {
......
......@@ -27,7 +27,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
enum class TaskTableItemState {
INVALID,
......
......@@ -24,7 +24,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
uint64_t
get_current_timestamp() {
......
......@@ -21,7 +21,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
uint64_t
get_current_timestamp();
......
......@@ -23,7 +23,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class Action {
public:
......
......@@ -25,7 +25,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
std::vector<ResourcePtr>
get_neighbours(const ResourcePtr &self) {
......
......@@ -21,7 +21,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
enum class EventType {
START_UP,
......
......@@ -25,7 +25,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
std::ostream &operator<<(std::ostream &out, const Event &event) {
out << event.Dump();
......
......@@ -22,7 +22,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class FinishTaskEvent : public Event {
public:
......
......@@ -23,7 +23,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class LoadCompletedEvent : public Event {
public:
......
......@@ -22,7 +22,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class StartUpEvent : public Event {
public:
......
......@@ -22,7 +22,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class TaskTableUpdatedEvent : public Event {
public:
......
......@@ -23,7 +23,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class Connection {
public:
......
......@@ -21,7 +21,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
std::ostream &operator<<(std::ostream &out, const CpuResource &resource) {
out << resource.Dump();
......
......@@ -24,7 +24,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class CpuResource : public Resource {
public:
......
......@@ -20,7 +20,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
std::ostream &operator<<(std::ostream &out, const DiskResource &resource) {
out << resource.Dump();
......
......@@ -23,7 +23,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class DiskResource : public Resource {
public:
......
......@@ -21,7 +21,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
std::ostream &operator<<(std::ostream &out, const GpuResource &resource) {
out << resource.Dump();
......
......@@ -23,7 +23,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class GpuResource : public Resource {
public:
......
......@@ -22,7 +22,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
Node::Node() {
static std::atomic_uint_fast8_t counter(0);
......
......@@ -27,7 +27,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class Node;
......
......@@ -22,7 +22,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
std::ostream &
operator<<(std::ostream &out, const Resource &resource) {
......
......@@ -37,7 +37,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
// TODO(wxyu): Storage, Route, Executor
enum class ResourceType {
......
......@@ -20,7 +20,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
std::ostream &operator<<(std::ostream &out, const TestResource &resource) {
out << resource.Dump();
......
......@@ -23,7 +23,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class TestResource : public Resource {
public:
......
......@@ -21,7 +21,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
XDeleteTask::XDeleteTask(const scheduler::DeleteJobPtr &delete_job)
: Task(TaskType::DeleteTask), delete_job_(delete_job) {}
......
......@@ -23,7 +23,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class XDeleteTask : public Task {
public:
......
......@@ -23,7 +23,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class Path {
public:
......
......@@ -27,7 +27,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
static constexpr size_t PARALLEL_REDUCE_THRESHOLD = 10000;
static constexpr size_t PARALLEL_REDUCE_BATCH = 1000;
......@@ -79,8 +79,8 @@ std::mutex XSearchTask::merge_mutex_;
void
CollectFileMetrics(int file_type, size_t file_size) {
switch (file_type) {
case meta::TableFileSchema::RAW:
case meta::TableFileSchema::TO_INDEX: {
case TableFileSchema::RAW:
case TableFileSchema::TO_INDEX: {
server::Metrics::GetInstance().RawFileSizeHistogramObserve(file_size);
server::Metrics::GetInstance().RawFileSizeTotalIncrement(file_size);
server::Metrics::GetInstance().RawFileSizeGaugeSet(file_size);
......@@ -95,7 +95,7 @@ CollectFileMetrics(int file_type, size_t file_size) {
}
}
XSearchTask::XSearchTask(meta::TableFileSchemaPtr file)
XSearchTask::XSearchTask(TableFileSchemaPtr file)
: Task(TaskType::SearchTask), file_(file) {
if (file_) {
index_engine_ = EngineFactory::Build(file_->dimension_,
......
......@@ -18,19 +18,19 @@
#pragma once
#include "Task.h"
#include "db/meta/MetaTypes.h"
#include "scheduler/job/SearchJob.h"
#include "scheduler/Definition.h"
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
// TODO: rewrite
class XSearchTask : public Task {
public:
explicit
XSearchTask(meta::TableFileSchemaPtr file);
XSearchTask(TableFileSchemaPtr file);
void
Load(LoadType type, uint8_t device_id) override;
......@@ -56,7 +56,7 @@ public:
scheduler::ResultSet &result_target);
public:
meta::TableFileSchemaPtr file_;
TableFileSchemaPtr file_;
size_t index_id_ = 0;
int index_type_ = 0;
......
......@@ -28,7 +28,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
enum class LoadType {
DISK2CPU,
......
......@@ -22,10 +22,9 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
TestTask::TestTask(meta::TableFileSchemaPtr &file) : XSearchTask(file) {}
TestTask::TestTask(TableFileSchemaPtr &file) : XSearchTask(file) {}
void
TestTask::Load(LoadType type, uint8_t device_id) {
......
......@@ -22,12 +22,12 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class TestTask : public XSearchTask {
public:
explicit
TestTask(meta::TableFileSchemaPtr& file);
TestTask(TableFileSchemaPtr& file);
public:
void
......
......@@ -24,7 +24,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class BroadcastLabel : public TaskLabel {
......
......@@ -24,7 +24,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class DefaultLabel : public TaskLabel {
public:
......
......@@ -29,7 +29,7 @@ using ResourceWPtr = std::weak_ptr<Resource>;
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class SpecResLabel : public TaskLabel {
public:
......
......@@ -21,7 +21,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
enum class TaskLabelType {
DEFAULT, // means can be executed in any resource
......
......@@ -252,7 +252,7 @@ Server::LoadConfig() {
void
Server::StartService() {
engine::KnowhereResource::Initialize();
engine::StartSchedulerService();
scheduler::StartSchedulerService();
DBWrapper::GetInstance().StartService();
grpc::GrpcServer::GetInstance().Start();
}
......@@ -261,7 +261,7 @@ void
Server::StopService() {
grpc::GrpcServer::GetInstance().Stop();
DBWrapper::GetInstance().StopService();
engine::StopSchedulerService();
scheduler::StopSchedulerService();
engine::KnowhereResource::Finalize();
}
......
......@@ -772,7 +772,7 @@ CmdTask::OnExecute() {
if (cmd_ == "version") {
result_ = MILVUS_VERSION;
} else if (cmd_ == "tasktable") {
result_ = engine::ResMgrInst::GetInstance()->DumpTaskTables();
result_ = scheduler::ResMgrInst::GetInstance()->DumpTaskTables();
}
else {
result_ = "OK";
......
......@@ -127,23 +127,23 @@ TEST(DBSearchTest, TOPK_TEST) {
std::vector<long> target_ids;
std::vector<float> target_distence;
scheduler::ResultSet src_result;
auto status = engine::XSearchTask::ClusterResult(target_ids, target_distence, NQ, TOP_K, src_result);
auto status = scheduler::XSearchTask::ClusterResult(target_ids, target_distence, NQ, TOP_K, src_result);
ASSERT_FALSE(status.ok());
ASSERT_TRUE(src_result.empty());
BuildResult(NQ, TOP_K, ascending, target_ids, target_distence);
status = engine::XSearchTask::ClusterResult(target_ids, target_distence, NQ, TOP_K, src_result);
status = scheduler::XSearchTask::ClusterResult(target_ids, target_distence, NQ, TOP_K, src_result);
ASSERT_TRUE(status.ok());
ASSERT_EQ(src_result.size(), NQ);
scheduler::ResultSet target_result;
status = engine::XSearchTask::TopkResult(target_result, TOP_K, ascending, target_result);
status = scheduler::XSearchTask::TopkResult(target_result, TOP_K, ascending, target_result);
ASSERT_TRUE(status.ok());
status = engine::XSearchTask::TopkResult(target_result, TOP_K, ascending, src_result);
status = scheduler::XSearchTask::TopkResult(target_result, TOP_K, ascending, src_result);
ASSERT_FALSE(status.ok());
status = engine::XSearchTask::TopkResult(src_result, TOP_K, ascending, target_result);
status = scheduler::XSearchTask::TopkResult(src_result, TOP_K, ascending, target_result);
ASSERT_TRUE(status.ok());
ASSERT_TRUE(src_result.empty());
ASSERT_EQ(target_result.size(), NQ);
......@@ -153,10 +153,10 @@ TEST(DBSearchTest, TOPK_TEST) {
uint64_t wrong_topk = TOP_K - 10;
BuildResult(NQ, wrong_topk, ascending, src_ids, src_distence);
status = engine::XSearchTask::ClusterResult(src_ids, src_distence, NQ, wrong_topk, src_result);
status = scheduler::XSearchTask::ClusterResult(src_ids, src_distence, NQ, wrong_topk, src_result);
ASSERT_TRUE(status.ok());
status = engine::XSearchTask::TopkResult(src_result, TOP_K, ascending, target_result);
status = scheduler::XSearchTask::TopkResult(src_result, TOP_K, ascending, target_result);
ASSERT_TRUE(status.ok());
for(uint64_t i = 0; i < NQ; i++) {
ASSERT_EQ(target_result[i].size(), TOP_K);
......@@ -165,7 +165,7 @@ TEST(DBSearchTest, TOPK_TEST) {
wrong_topk = TOP_K + 10;
BuildResult(NQ, wrong_topk, ascending, src_ids, src_distence);
status = engine::XSearchTask::TopkResult(src_result, TOP_K, ascending, target_result);
status = scheduler::XSearchTask::TopkResult(src_result, TOP_K, ascending, target_result);
ASSERT_TRUE(status.ok());
for(uint64_t i = 0; i < NQ; i++) {
ASSERT_EQ(target_result[i].size(), TOP_K);
......@@ -183,15 +183,15 @@ TEST(DBSearchTest, MERGE_TEST) {
uint64_t src_count = 5, target_count = 8;
BuildResult(1, src_count, ascending, src_ids, src_distence);
BuildResult(1, target_count, ascending, target_ids, target_distence);
auto status = engine::XSearchTask::ClusterResult(src_ids, src_distence, 1, src_count, src_result);
auto status = scheduler::XSearchTask::ClusterResult(src_ids, src_distence, 1, src_count, src_result);
ASSERT_TRUE(status.ok());
status = engine::XSearchTask::ClusterResult(target_ids, target_distence, 1, target_count, target_result);
status = scheduler::XSearchTask::ClusterResult(target_ids, target_distence, 1, target_count, target_result);
ASSERT_TRUE(status.ok());
{
scheduler::Id2DistanceMap src = src_result[0];
scheduler::Id2DistanceMap target = target_result[0];
status = engine::XSearchTask::MergeResult(src, target, 10, ascending);
status = scheduler::XSearchTask::MergeResult(src, target, 10, ascending);
ASSERT_TRUE(status.ok());
ASSERT_EQ(target.size(), 10);
CheckResult(src_result[0], target_result[0], target, ascending);
......@@ -200,7 +200,7 @@ TEST(DBSearchTest, MERGE_TEST) {
{
scheduler::Id2DistanceMap src = src_result[0];
scheduler::Id2DistanceMap target;
status = engine::XSearchTask::MergeResult(src, target, 10, ascending);
status = scheduler::XSearchTask::MergeResult(src, target, 10, ascending);
ASSERT_TRUE(status.ok());
ASSERT_EQ(target.size(), src_count);
ASSERT_TRUE(src.empty());
......@@ -210,7 +210,7 @@ TEST(DBSearchTest, MERGE_TEST) {
{
scheduler::Id2DistanceMap src = src_result[0];
scheduler::Id2DistanceMap target = target_result[0];
status = engine::XSearchTask::MergeResult(src, target, 30, ascending);
status = scheduler::XSearchTask::MergeResult(src, target, 30, ascending);
ASSERT_TRUE(status.ok());
ASSERT_EQ(target.size(), src_count + target_count);
CheckResult(src_result[0], target_result[0], target, ascending);
......@@ -219,7 +219,7 @@ TEST(DBSearchTest, MERGE_TEST) {
{
scheduler::Id2DistanceMap target = src_result[0];
scheduler::Id2DistanceMap src = target_result[0];
status = engine::XSearchTask::MergeResult(src, target, 30, ascending);
status = scheduler::XSearchTask::MergeResult(src, target, 30, ascending);
ASSERT_TRUE(status.ok());
ASSERT_EQ(target.size(), src_count + target_count);
CheckResult(src_result[0], target_result[0], target, ascending);
......@@ -242,7 +242,7 @@ TEST(DBSearchTest, PARALLEL_CLUSTER_TEST) {
BuildResult(nq, topk, ascending, target_ids, target_distence);
rc.RecordSection("build id/dietance map");
auto status = engine::XSearchTask::ClusterResult(target_ids, target_distence, nq, topk, src_result);
auto status = scheduler::XSearchTask::ClusterResult(target_ids, target_distence, nq, topk, src_result);
ASSERT_TRUE(status.ok());
ASSERT_EQ(src_result.size(), nq);
......@@ -282,14 +282,14 @@ TEST(DBSearchTest, PARALLEL_TOPK_TEST) {
TimeRecorder rc("DoCluster");
BuildResult(nq, topk, ascending, target_ids, target_distence);
auto status = engine::XSearchTask::ClusterResult(target_ids, target_distence, nq, topk, src_result);
auto status = scheduler::XSearchTask::ClusterResult(target_ids, target_distence, nq, topk, src_result);
rc.RecordSection("cluster result");
BuildResult(nq, insufficient_topk, ascending, insufficient_ids, insufficient_distence);
status = engine::XSearchTask::ClusterResult(target_ids, target_distence, nq, insufficient_topk, insufficient_result);
status = scheduler::XSearchTask::ClusterResult(target_ids, target_distence, nq, insufficient_topk, insufficient_result);
rc.RecordSection("cluster result");
engine::XSearchTask::TopkResult(insufficient_result, topk, ascending, src_result);
scheduler::XSearchTask::TopkResult(insufficient_result, topk, ascending, src_result);
ASSERT_TRUE(status.ok());
rc.RecordSection("topk");
......
......@@ -80,20 +80,20 @@ engine::DBOptions BaseTest::GetOptions() {
void DBTest::SetUp() {
BaseTest::SetUp();
auto res_mgr = engine::ResMgrInst::GetInstance();
auto res_mgr = scheduler::ResMgrInst::GetInstance();
res_mgr->Clear();
res_mgr->Add(engine::ResourceFactory::Create("disk", "DISK", 0, true, false));
res_mgr->Add(engine::ResourceFactory::Create("cpu", "CPU", 0, true, false));
res_mgr->Add(engine::ResourceFactory::Create("gtx1660", "GPU", 0, true, true));
res_mgr->Add(scheduler::ResourceFactory::Create("disk", "DISK", 0, true, false));
res_mgr->Add(scheduler::ResourceFactory::Create("cpu", "CPU", 0, true, false));
res_mgr->Add(scheduler::ResourceFactory::Create("gtx1660", "GPU", 0, true, true));
auto default_conn = engine::Connection("IO", 500.0);
auto PCIE = engine::Connection("IO", 11000.0);
auto default_conn = scheduler::Connection("IO", 500.0);
auto PCIE = scheduler::Connection("IO", 11000.0);
res_mgr->Connect("disk", "cpu", default_conn);
res_mgr->Connect("cpu", "gtx1660", PCIE);
res_mgr->Start();
engine::SchedInst::GetInstance()->Start();
scheduler::SchedInst::GetInstance()->Start();
engine::JobMgrInst::GetInstance()->Start();
scheduler::JobMgrInst::GetInstance()->Start();
auto options = GetOptions();
db_ = engine::DBFactory::Build(options);
......@@ -103,9 +103,9 @@ void DBTest::TearDown() {
db_->Stop();
db_->DropAll();
engine::JobMgrInst::GetInstance()->Stop();
engine::SchedInst::GetInstance()->Stop();
engine::ResMgrInst::GetInstance()->Stop();
scheduler::JobMgrInst::GetInstance()->Stop();
scheduler::SchedInst::GetInstance()->Stop();
scheduler::ResMgrInst::GetInstance()->Stop();
BaseTest::TearDown();
......
......@@ -26,7 +26,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class AlgorithmTest : public testing::Test {
protected:
......
......@@ -25,7 +25,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
TEST(EventTest, START_UP_EVENT) {
ResourceWPtr res(ResourcePtr(nullptr));
......
......@@ -20,7 +20,7 @@
#include <gtest/gtest.h>
using namespace zilliz::milvus::engine;
using namespace zilliz::milvus::scheduler;
class NodeTest : public ::testing::Test {
protected:
......
......@@ -26,7 +26,7 @@
#include <gtest/gtest.h>
using namespace zilliz::milvus::engine;
using namespace zilliz::milvus::scheduler;
TEST(NormalTest, INST_TEST) {
......@@ -46,7 +46,7 @@ TEST(NormalTest, INST_TEST) {
const uint64_t NUM_TASK = 1000;
std::vector<std::shared_ptr<TestTask>> tasks;
meta::TableFileSchemaPtr dummy = nullptr;
TableFileSchemaPtr dummy = nullptr;
auto disks = res_mgr->GetDiskResources();
ASSERT_FALSE(disks.empty());
......
......@@ -20,7 +20,7 @@
#include <gtest/gtest.h>
using namespace zilliz::milvus::engine;
using namespace zilliz::milvus::scheduler;
TEST(ResourceFactoryTest, CREATE) {
auto disk = ResourceFactory::Create("ssd", "DISK", 0);
......
......@@ -27,7 +27,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
/************ ResourceMgrBaseTest ************/
......@@ -187,7 +187,7 @@ TEST_F(ResourceMgrAdvanceTest, REGISTER_SUBSCRIBER) {
flag = true;
};
mgr1_->RegisterSubscriber(callback);
meta::TableFileSchemaPtr dummy = nullptr;
TableFileSchemaPtr dummy = nullptr;
disk_res->task_table().Put(std::make_shared<TestTask>(dummy));
sleep(1);
ASSERT_TRUE(flag);
......
......@@ -29,7 +29,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
/************ ResourceBaseTest ************/
class ResourceBaseTest : public testing::Test {
......@@ -180,7 +180,7 @@ protected:
TEST_F(ResourceAdvanceTest, DISK_RESOURCE_TEST) {
const uint64_t NUM = 100;
std::vector<std::shared_ptr<TestTask>> tasks;
meta::TableFileSchemaPtr dummy = nullptr;
TableFileSchemaPtr dummy = nullptr;
for (uint64_t i = 0; i < NUM; ++i) {
auto task = std::make_shared<TestTask>(dummy);
tasks.push_back(task);
......@@ -205,7 +205,7 @@ TEST_F(ResourceAdvanceTest, DISK_RESOURCE_TEST) {
TEST_F(ResourceAdvanceTest, CPU_RESOURCE_TEST) {
const uint64_t NUM = 100;
std::vector<std::shared_ptr<TestTask>> tasks;
meta::TableFileSchemaPtr dummy = nullptr;
TableFileSchemaPtr dummy = nullptr;
for (uint64_t i = 0; i < NUM; ++i) {
auto task = std::make_shared<TestTask>(dummy);
tasks.push_back(task);
......@@ -230,7 +230,7 @@ TEST_F(ResourceAdvanceTest, CPU_RESOURCE_TEST) {
TEST_F(ResourceAdvanceTest, GPU_RESOURCE_TEST) {
const uint64_t NUM = 100;
std::vector<std::shared_ptr<TestTask>> tasks;
meta::TableFileSchemaPtr dummy = nullptr;
TableFileSchemaPtr dummy = nullptr;
for (uint64_t i = 0; i < NUM; ++i) {
auto task = std::make_shared<TestTask>(dummy);
tasks.push_back(task);
......@@ -255,7 +255,7 @@ TEST_F(ResourceAdvanceTest, GPU_RESOURCE_TEST) {
TEST_F(ResourceAdvanceTest, TEST_RESOURCE_TEST) {
const uint64_t NUM = 100;
std::vector<std::shared_ptr<TestTask>> tasks;
meta::TableFileSchemaPtr dummy = nullptr;
TableFileSchemaPtr dummy = nullptr;
for (uint64_t i = 0; i < NUM; ++i) {
auto task = std::make_shared<TestTask>(dummy);
tasks.push_back(task);
......
......@@ -24,7 +24,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class SchedInstTest : public testing::Test {
......
......@@ -15,22 +15,23 @@
// specific language governing permissions and limitations
// under the License.
#include "scheduler/Scheduler.h"
#include <gtest/gtest.h>
#include "src/scheduler/tasklabel/DefaultLabel.h"
#include "cache/DataObj.h"
#include "cache/GpuCacheMgr.h"
#include "scheduler/Scheduler.h"
#include "scheduler/tasklabel/DefaultLabel.h"
#include "scheduler/tasklabel/SpecResLabel.h"
#include "scheduler/task/TestTask.h"
#include "scheduler/ResourceFactory.h"
#include "scheduler/resource/Resource.h"
#include "cache/DataObj.h"
#include "cache/GpuCacheMgr.h"
#include "utils/Error.h"
#include "src/wrapper/vec_index.h"
#include "scheduler/tasklabel/SpecResLabel.h"
#include "wrapper/vec_index.h"
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
class MockVecIndex : public engine::VecIndex {
public:
......@@ -155,7 +156,7 @@ insert_dummy_index_into_gpu_cache(uint64_t device_id) {
TEST_F(SchedulerTest, ON_LOAD_COMPLETED) {
const uint64_t NUM = 10;
std::vector<std::shared_ptr<TestTask>> tasks;
meta::TableFileSchemaPtr dummy = std::make_shared<meta::TableFileSchema>();
TableFileSchemaPtr dummy = std::make_shared<TableFileSchema>();
dummy->location_ = "location";
insert_dummy_index_into_gpu_cache(1);
......@@ -175,7 +176,7 @@ TEST_F(SchedulerTest, ON_LOAD_COMPLETED) {
TEST_F(SchedulerTest, PUSH_TASK_TO_NEIGHBOUR_RANDOMLY_TEST) {
const uint64_t NUM = 10;
std::vector<std::shared_ptr<TestTask>> tasks;
meta::TableFileSchemaPtr dummy1 = std::make_shared<meta::TableFileSchema>();
TableFileSchemaPtr dummy1 = std::make_shared<TableFileSchema>();
dummy1->location_ = "location";
tasks.clear();
......@@ -246,7 +247,7 @@ protected:
TEST_F(SchedulerTest2, SPECIFIED_RESOURCE_TEST) {
const uint64_t NUM = 10;
std::vector<std::shared_ptr<TestTask>> tasks;
meta::TableFileSchemaPtr dummy = std::make_shared<meta::TableFileSchema>();
TableFileSchemaPtr dummy = std::make_shared<TableFileSchema>();
dummy->location_ = "location";
for (uint64_t i = 0; i < NUM; ++i) {
......
......@@ -22,7 +22,7 @@
namespace zilliz {
namespace milvus {
namespace engine {
namespace scheduler {
TEST(TaskTest, INVALID_INDEX) {
......
......@@ -21,7 +21,7 @@
#include <gtest/gtest.h>
using namespace zilliz::milvus::engine;
using namespace zilliz::milvus::scheduler;
/************ TaskTableBaseTest ************/
......@@ -169,7 +169,7 @@ class TaskTableBaseTest : public ::testing::Test {
protected:
void
SetUp() override {
meta::TableFileSchemaPtr dummy = nullptr;
TableFileSchemaPtr dummy = nullptr;
invalid_task_ = nullptr;
task1_ = std::make_shared<TestTask>(dummy);
task2_ = std::make_shared<TestTask>(dummy);
......@@ -339,7 +339,7 @@ class TaskTableAdvanceTest : public ::testing::Test {
protected:
void
SetUp() override {
meta::TableFileSchemaPtr dummy = nullptr;
TableFileSchemaPtr dummy = nullptr;
for (uint64_t i = 0; i < 8; ++i) {
auto task = std::make_shared<TestTask>(dummy);
table1_.Put(task);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册