diff --git a/cpp/CHANGELOG.md b/cpp/CHANGELOG.md index 03be0fce9540b7ded166b2b2e2f5a3f9a84031d3..094a30e9cbf604803c235b162da1df1b703e62f4 100644 --- a/cpp/CHANGELOG.md +++ b/cpp/CHANGELOG.md @@ -100,6 +100,7 @@ Please mark all change in change log and use the ticket from JIRA. - MS-508 - Update normal_test in scheduler - MS-511 - Update resource_test in scheduler - MS-517 - Update resource_mgr_test in scheduler +- MS-518 - Add schedinst_test in scheduler ## New Feature - MS-343 - Implement ResourceMgr diff --git a/cpp/src/scheduler/SchedInst.cpp b/cpp/src/scheduler/SchedInst.cpp index 7e4dc506c12d693b08332cb116fbccdab217ff36..12be4d2eb8c85b570326051bf94e64a023973213 100644 --- a/cpp/src/scheduler/SchedInst.cpp +++ b/cpp/src/scheduler/SchedInst.cpp @@ -81,7 +81,9 @@ StartSchedulerService() { } } catch (const char* msg) { SERVER_LOG_ERROR << msg; + // TODO: throw exception instead exit(-1); +// throw std::exception(); } ResMgrInst::GetInstance()->Start(); diff --git a/cpp/unittest/scheduler/schedinst_test.cpp b/cpp/unittest/scheduler/schedinst_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ddb3bec4271a1b479eb43f63569f7c5f0dd051e5 --- /dev/null +++ b/cpp/unittest/scheduler/schedinst_test.cpp @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved + * Unauthorized copying of this file, via any medium is strictly prohibited. + * Proprietary and confidential. + ******************************************************************************/ + +#include "scheduler/SchedInst.h" +#include "server/ServerConfig.h" +#include +#include + + +namespace zilliz { +namespace milvus { +namespace engine { + + +class SchedInstTest : public testing::Test { + +protected: + void + SetUp() override { + boost::filesystem::create_directory(TMP_DIR); + std::stringstream ss; + ss << "resource_config: " << std::endl; + ss << " resources: " << std::endl; + ss << " ssda: " << std::endl; + ss << " type: DISK" << std::endl; + ss << " device_id: 0" << std::endl; + ss << " enable_loader: true" << std::endl; + ss << " enable_executor: false" << std::endl; + ss << " " << std::endl; + ss << " cpu: " << std::endl; + ss << " type: CPU" << std::endl; + ss << " device_id: 0" << std::endl; + ss << " enable_loader: true" << std::endl; + ss << " enable_executor: false" << std::endl; + ss << " " << std::endl; + ss << " gpu0: " << std::endl; + ss << " type: GPU" << std::endl; + ss << " device_id: 0" << std::endl; + ss << " enable_loader: true" << std::endl; + ss << " enable_executor: true" << std::endl; + ss << " " << std::endl; + ss << " connections: " << std::endl; + ss << " io: " << std::endl; + ss << " speed: 500" << std::endl; + ss << " endpoint: ssda===cpu" << std::endl; + ss << " pcie: " << std::endl; + ss << " speed: 11000" << std::endl; + ss << " endpoint: cpu===gpu0" << std::endl; + + boost::filesystem::path fpath(CONFIG_FILE); + boost::filesystem::fstream fstream(fpath, std::ios_base::out); + fstream << ss.str(); + fstream.close(); + + server::ServerConfig::GetInstance().LoadConfigFile(CONFIG_FILE); + } + + void + TearDown() override { + StopSchedulerService(); + boost::filesystem::remove_all(TMP_DIR); + } + + const std::string TMP_DIR = "/tmp/milvus_sched_test"; + const std::string CONFIG_FILE = "/tmp/milvus_sched_test/config.yaml"; +}; + +TEST_F(SchedInstTest, simple_gpu) { + StartSchedulerService(); +} + +} +} +}