mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-03 17:31:58 +08:00
Merge remote-tracking branch 'upstream/branch-0.5.0' into branch-0.5.0-yk
Former-commit-id: a9efa9a72da2b4c178842ab06a610cf324855dae
This commit is contained in:
commit
e450df84e6
@ -27,6 +27,7 @@ Please mark all change in change log and use the ticket from JIRA.
|
||||
- MS-608 - Update TODO names
|
||||
- MS-609 - Update task construct function
|
||||
- MS-611 - Add resources validity check in ResourceMgr
|
||||
- MS-619 - Add optimizer class in scheduler
|
||||
|
||||
## New Feature
|
||||
|
||||
|
||||
@ -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/event scheduler_event_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/task scheduler_task_files)
|
||||
set(scheduler_files
|
||||
@ -57,6 +58,7 @@ set(scheduler_files
|
||||
${scheduler_action_files}
|
||||
${scheduler_event_files}
|
||||
${scheduler_job_files}
|
||||
${scheduler_optimizer_files}
|
||||
${scheduler_resource_files}
|
||||
${scheduler_task_files}
|
||||
)
|
||||
|
||||
35
cpp/src/scheduler/optimizer/HybridPass.cpp
Normal file
35
cpp/src/scheduler/optimizer/HybridPass.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
// 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
48
cpp/src/scheduler/optimizer/HybridPass.h
Normal file
48
cpp/src/scheduler/optimizer/HybridPass.h
Normal file
@ -0,0 +1,48 @@
|
||||
// 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>;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
43
cpp/src/scheduler/optimizer/Optimizer.cpp
Normal file
43
cpp/src/scheduler/optimizer/Optimizer.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
// 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
51
cpp/src/scheduler/optimizer/Optimizer.h
Normal file
51
cpp/src/scheduler/optimizer/Optimizer.h
Normal file
@ -0,0 +1,51 @@
|
||||
// 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_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
46
cpp/src/scheduler/optimizer/Pass.h
Normal file
46
cpp/src/scheduler/optimizer/Pass.h
Normal file
@ -0,0 +1,46 @@
|
||||
// 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 {
|
||||
|
||||
public:
|
||||
Path task_path_;
|
||||
// std::vector<SearchContextPtr> search_contexts_;
|
||||
scheduler::JobWPtr job_;
|
||||
TaskType type_;
|
||||
TaskLabelPtr label_ = nullptr;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user