diff --git a/cpp/CHANGELOG.md b/cpp/CHANGELOG.md index 7926698609..ba1e78d550 100644 --- a/cpp/CHANGELOG.md +++ b/cpp/CHANGELOG.md @@ -99,6 +99,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 7e4dc506c1..12be4d2eb8 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 0000000000..ddb3bec427 --- /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(); +} + +} +} +}