mirror of https://github.com/milvus-io/milvus.git
commit
88d4020b4f
|
@ -12,6 +12,7 @@ Please mark all change in change log and use the ticket from JIRA.
|
|||
- MS-344 - Add TaskTable Test
|
||||
- MS-345 - Add Node Test
|
||||
- MS-346 - Add some implementation of scheduler to solve compile error
|
||||
- MS-348 - Add ResourceFactory Test
|
||||
- MS-350 - Remove knowhere submodule
|
||||
|
||||
## New Feature
|
||||
|
|
|
@ -14,11 +14,11 @@ namespace engine {
|
|||
std::shared_ptr<Resource>
|
||||
ResourceFactory::Create(const std::string &name, const std::string &alias) {
|
||||
if (name == "disk") {
|
||||
return std::make_shared<CpuResource>(alias);
|
||||
return std::make_shared<DiskResource>(alias);
|
||||
} else if (name == "cpu") {
|
||||
return std::make_shared<CpuResource>(alias);
|
||||
} else if (name == "gpu") {
|
||||
return std::make_shared<CpuResource>(alias);
|
||||
return std::make_shared<GpuResource>(alias);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,17 @@ namespace milvus {
|
|||
namespace engine {
|
||||
|
||||
class DiskResource : public Resource {
|
||||
public:
|
||||
explicit
|
||||
DiskResource(std::string name)
|
||||
: Resource(std::move(name), ResourceType::DISK) {}
|
||||
|
||||
protected:
|
||||
void
|
||||
LoadFile(TaskPtr task) override {}
|
||||
|
||||
void
|
||||
Process(TaskPtr task) override {}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,17 @@ namespace milvus {
|
|||
namespace engine {
|
||||
|
||||
class GpuResource : public Resource {
|
||||
public:
|
||||
explicit
|
||||
GpuResource(std::string name)
|
||||
: Resource(std::move(name), ResourceType::GPU) {}
|
||||
|
||||
protected:
|
||||
void
|
||||
LoadFile(TaskPtr task) override {}
|
||||
|
||||
void
|
||||
Process(TaskPtr task) override {}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#include "scheduler/ResourceFactory.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
|
||||
using namespace zilliz::milvus::engine;
|
||||
|
||||
TEST(resource_factory_test, create) {
|
||||
auto disk = ResourceFactory::Create("disk");
|
||||
auto cpu = ResourceFactory::Create("cpu");
|
||||
auto gpu = ResourceFactory::Create("gpu");
|
||||
|
||||
ASSERT_TRUE(std::dynamic_pointer_cast<DiskResource>(disk));
|
||||
ASSERT_TRUE(std::dynamic_pointer_cast<CpuResource>(cpu));
|
||||
ASSERT_TRUE(std::dynamic_pointer_cast<GpuResource>(gpu));
|
||||
}
|
Loading…
Reference in New Issue