提交 e450df84 编写于 作者: Y Yu Kun

Merge remote-tracking branch 'upstream/branch-0.5.0' into branch-0.5.0-yk


Former-commit-id: a9efa9a72da2b4c178842ab06a610cf324855dae
...@@ -27,6 +27,7 @@ Please mark all change in change log and use the ticket from JIRA. ...@@ -27,6 +27,7 @@ Please mark all change in change log and use the ticket from JIRA.
- MS-608 - Update TODO names - MS-608 - Update TODO names
- MS-609 - Update task construct function - MS-609 - Update task construct function
- MS-611 - Add resources validity check in ResourceMgr - MS-611 - Add resources validity check in ResourceMgr
- MS-619 - Add optimizer class in scheduler
## New Feature ## New Feature
......
...@@ -50,6 +50,7 @@ aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler scheduler_main_files) ...@@ -50,6 +50,7 @@ aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler scheduler_main_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/action scheduler_action_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/action scheduler_action_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/event scheduler_event_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/event scheduler_event_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/job scheduler_job_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/job scheduler_job_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/optimizer scheduler_optimizer_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/resource scheduler_resource_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/resource scheduler_resource_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/task scheduler_task_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/task scheduler_task_files)
set(scheduler_files set(scheduler_files
...@@ -57,6 +58,7 @@ set(scheduler_files ...@@ -57,6 +58,7 @@ set(scheduler_files
${scheduler_action_files} ${scheduler_action_files}
${scheduler_event_files} ${scheduler_event_files}
${scheduler_job_files} ${scheduler_job_files}
${scheduler_optimizer_files}
${scheduler_resource_files} ${scheduler_resource_files}
${scheduler_task_files} ${scheduler_task_files}
) )
......
// 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 "HybridPass.h"
#include "scheduler/task/SearchTask.h"
namespace milvus {
namespace scheduler {
bool
HybridPass::Run(const TaskPtr& task) {
// TODO: Index::IVFSQ8Hybrid, if nq < threshold set cpu, else set gpu
if (task->Type() != TaskType::SearchTask) return false;
auto search_task = std::static_pointer_cast<XSearchTask>(task);
// if (search_task->file_->engine_type_ == engine::EngineType::FAISS_IVFSQ8Hybrid)
return false;
}
}
}
// 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.
#pragma once
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <unordered_map>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <memory>
#include "Pass.h"
namespace milvus {
namespace scheduler {
class HybridPass : public Pass {
public:
HybridPass() = default;
public:
bool
Run(const TaskPtr& task) override;
};
using HybridPassPtr = std::shared_ptr<HybridPass>;
}
}
// 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 "Optimizer.h"
namespace milvus {
namespace scheduler {
void
Optimizer::Init() {
for (auto& pass : pass_list_) {
pass->Init();
}
}
bool
Optimizer::Run(const TaskPtr& task) {
for (auto& pass : pass_list_) {
if (pass->Run(task)) {
return true;
}
}
return false;
}
}
}
// 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.
#pragma once
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <unordered_map>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <memory>
#include "Pass.h"
namespace milvus {
namespace scheduler {
class Optimizer {
public:
Optimizer() = default;
void
Init();
bool
Run(const TaskPtr &task);
private:
std::vector<PassPtr> pass_list_;
};
}
}
// 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.
#pragma once
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <unordered_map>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <memory>
#include "scheduler/task/Task.h"
namespace milvus {
namespace scheduler {
class Pass {
public:
virtual void
Init() {}
virtual bool
Run(const TaskPtr& task) = 0;
};
using PassPtr = std::shared_ptr<Pass>;
}
}
...@@ -86,7 +86,6 @@ class Task { ...@@ -86,7 +86,6 @@ class Task {
public: public:
Path task_path_; Path task_path_;
// std::vector<SearchContextPtr> search_contexts_;
scheduler::JobWPtr job_; scheduler::JobWPtr job_;
TaskType type_; TaskType type_;
TaskLabelPtr label_ = nullptr; TaskLabelPtr label_ = nullptr;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册