Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
e9eb601a
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e9eb601a
编写于
8月 26, 2019
作者:
W
wxyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MS-421 Add TaskLabel in scheduler
Former-commit-id: e43fc9f6dd0182f2fbf054e4cbbabcc654ddd977
上级
6289f37f
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
167 addition
and
7 deletion
+167
-7
cpp/CHANGELOG.md
cpp/CHANGELOG.md
+1
-0
cpp/src/scheduler/Scheduler.cpp
cpp/src/scheduler/Scheduler.cpp
+0
-2
cpp/src/scheduler/resource/Resource.h
cpp/src/scheduler/resource/Resource.h
+1
-0
cpp/src/scheduler/task/Task.h
cpp/src/scheduler/task/Task.h
+20
-5
cpp/src/scheduler/task/TaskConvert.cpp
cpp/src/scheduler/task/TaskConvert.cpp
+4
-0
cpp/src/scheduler/tasklabel/BroadcastLabel.h
cpp/src/scheduler/tasklabel/BroadcastLabel.h
+27
-0
cpp/src/scheduler/tasklabel/DefaultLabel.h
cpp/src/scheduler/tasklabel/DefaultLabel.h
+28
-0
cpp/src/scheduler/tasklabel/SpecResLabel.h
cpp/src/scheduler/tasklabel/SpecResLabel.h
+47
-0
cpp/src/scheduler/tasklabel/TaskLabel.h
cpp/src/scheduler/tasklabel/TaskLabel.h
+39
-0
未找到文件。
cpp/CHANGELOG.md
浏览文件 @
e9eb601a
...
@@ -57,6 +57,7 @@ Please mark all change in change log and use the ticket from JIRA.
...
@@ -57,6 +57,7 @@ Please mark all change in change log and use the ticket from JIRA.
-
MS-415 - Add command tasktable to dump all tasktables
-
MS-415 - Add command tasktable to dump all tasktables
-
MS-418 - Update server_config.template file, set CPU compute only default
-
MS-418 - Update server_config.template file, set CPU compute only default
-
MS-419 - Move index_file_size from IndexParam to TableSchema
-
MS-419 - Move index_file_size from IndexParam to TableSchema
-
MS-421 - Add TaskLabel in scheduler
## New Feature
## New Feature
-
MS-343 - Implement ResourceMgr
-
MS-343 - Implement ResourceMgr
...
...
cpp/src/scheduler/Scheduler.cpp
浏览文件 @
e9eb601a
...
@@ -104,8 +104,6 @@ Scheduler::OnStartUp(const EventPtr &event) {
...
@@ -104,8 +104,6 @@ Scheduler::OnStartUp(const EventPtr &event) {
void
void
Scheduler
::
OnFinishTask
(
const
EventPtr
&
event
)
{
Scheduler
::
OnFinishTask
(
const
EventPtr
&
event
)
{
if
(
auto
resource
=
event
->
resource_
.
lock
())
{
}
}
}
void
void
...
...
cpp/src/scheduler/resource/Resource.h
浏览文件 @
e9eb601a
...
@@ -29,6 +29,7 @@ namespace zilliz {
...
@@ -29,6 +29,7 @@ namespace zilliz {
namespace
milvus
{
namespace
milvus
{
namespace
engine
{
namespace
engine
{
// TODO(wxyu): Storage, Route, Executor
enum
class
ResourceType
{
enum
class
ResourceType
{
DISK
=
0
,
DISK
=
0
,
CPU
=
1
,
CPU
=
1
,
...
...
cpp/src/scheduler/task/Task.h
浏览文件 @
e9eb601a
...
@@ -5,10 +5,12 @@
...
@@ -5,10 +5,12 @@
******************************************************************************/
******************************************************************************/
#pragma once
#pragma once
#include "db/scheduler/context/SearchContext.h"
#include "db/scheduler/task/IScheduleTask.h"
#include "scheduler/tasklabel/TaskLabel.h"
#include <string>
#include <string>
#include <memory>
#include <memory>
#include <src/db/scheduler/context/SearchContext.h>
#include "src/db/scheduler/task/IScheduleTask.h"
namespace
zilliz
{
namespace
zilliz
{
...
@@ -36,6 +38,21 @@ public:
...
@@ -36,6 +38,21 @@ public:
explicit
explicit
Task
(
TaskType
type
)
:
type_
(
type
)
{}
Task
(
TaskType
type
)
:
type_
(
type
)
{}
/*
* Just Getter;
*/
inline
TaskType
Type
()
const
{
return
type_
;
}
/*
* Getter and Setter;
*/
inline
TaskLabelPtr
&
label
()
{
return
label_
;
}
public:
virtual
void
virtual
void
Load
(
LoadType
type
,
uint8_t
device_id
)
=
0
;
Load
(
LoadType
type
,
uint8_t
device_id
)
=
0
;
...
@@ -46,13 +63,11 @@ public:
...
@@ -46,13 +63,11 @@ public:
virtual
TaskPtr
virtual
TaskPtr
Clone
()
=
0
;
Clone
()
=
0
;
inline
TaskType
Type
()
const
{
return
type_
;
}
public:
public:
std
::
vector
<
SearchContextPtr
>
search_contexts_
;
std
::
vector
<
SearchContextPtr
>
search_contexts_
;
ScheduleTaskPtr
task_
;
ScheduleTaskPtr
task_
;
TaskType
type_
;
TaskType
type_
;
TaskLabelPtr
label_
=
nullptr
;
};
};
...
...
cpp/src/scheduler/task/TaskConvert.cpp
浏览文件 @
e9eb601a
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
******************************************************************************/
******************************************************************************/
#include "TaskConvert.h"
#include "TaskConvert.h"
#include "scheduler/tasklabel/DefaultLabel.h"
#include "scheduler/tasklabel/BroadcastLabel.h"
namespace
zilliz
{
namespace
zilliz
{
...
@@ -17,6 +19,7 @@ TaskConvert(const ScheduleTaskPtr &schedule_task) {
...
@@ -17,6 +19,7 @@ TaskConvert(const ScheduleTaskPtr &schedule_task) {
case
ScheduleTaskType
::
kIndexLoad
:
{
case
ScheduleTaskType
::
kIndexLoad
:
{
auto
load_task
=
std
::
static_pointer_cast
<
IndexLoadTask
>
(
schedule_task
);
auto
load_task
=
std
::
static_pointer_cast
<
IndexLoadTask
>
(
schedule_task
);
auto
task
=
std
::
make_shared
<
XSearchTask
>
(
load_task
->
file_
);
auto
task
=
std
::
make_shared
<
XSearchTask
>
(
load_task
->
file_
);
task
->
label
()
=
std
::
make_shared
<
DefaultLabel
>
();
task
->
search_contexts_
=
load_task
->
search_contexts_
;
task
->
search_contexts_
=
load_task
->
search_contexts_
;
task
->
task_
=
schedule_task
;
task
->
task_
=
schedule_task
;
return
task
;
return
task
;
...
@@ -24,6 +27,7 @@ TaskConvert(const ScheduleTaskPtr &schedule_task) {
...
@@ -24,6 +27,7 @@ TaskConvert(const ScheduleTaskPtr &schedule_task) {
case
ScheduleTaskType
::
kDelete
:
{
case
ScheduleTaskType
::
kDelete
:
{
auto
delete_task
=
std
::
static_pointer_cast
<
DeleteTask
>
(
schedule_task
);
auto
delete_task
=
std
::
static_pointer_cast
<
DeleteTask
>
(
schedule_task
);
auto
task
=
std
::
make_shared
<
XDeleteTask
>
(
delete_task
->
context_
);
auto
task
=
std
::
make_shared
<
XDeleteTask
>
(
delete_task
->
context_
);
task
->
label
()
=
std
::
make_shared
<
BroadcastLabel
>
();
return
task
;
return
task
;
}
}
default:
{
default:
{
...
...
cpp/src/scheduler/tasklabel/BroadcastLabel.h
0 → 100644
浏览文件 @
e9eb601a
/*******************************************************************************
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited.
* Proprietary and confidential.
******************************************************************************/
#pragma once
#include "TaskLabel.h"
#include <memory>
namespace
zilliz
{
namespace
milvus
{
namespace
engine
{
class
BroadcastLabel
:
public
TaskLabel
{
public:
BroadcastLabel
()
:
TaskLabel
(
TaskLabelType
::
BROADCAST
)
{}
};
using
BroadcastLabelPtr
=
std
::
shared_ptr
<
BroadcastLabel
>
;
}
}
}
cpp/src/scheduler/tasklabel/DefaultLabel.h
0 → 100644
浏览文件 @
e9eb601a
/*******************************************************************************
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited.
* Proprietary and confidential.
******************************************************************************/
#pragma once
#include "TaskLabel.h"
#include <memory>
namespace
zilliz
{
namespace
milvus
{
namespace
engine
{
class
DefaultLabel
:
public
TaskLabel
{
public:
DefaultLabel
()
:
TaskLabel
(
TaskLabelType
::
DEFAULT
)
{}
};
using
DefaultLabelPtr
=
std
::
shared_ptr
<
DefaultLabel
>
;
}
}
}
cpp/src/scheduler/tasklabel/SpecResLabel.h
0 → 100644
浏览文件 @
e9eb601a
/*******************************************************************************
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited.
* Proprietary and confidential.
******************************************************************************/
#pragma once
#include "TaskLabel.h"
#include <string>
#include <memory>
class
Resource
;
using
ResourceWPtr
=
std
::
weak_ptr
<
Resource
>
;
namespace
zilliz
{
namespace
milvus
{
namespace
engine
{
class
SpecResLabel
:
public
TaskLabel
{
public:
SpecResLabel
(
const
ResourceWPtr
&
resource
)
:
TaskLabel
(
TaskLabelType
::
SPECIAL_RESOURCE
),
resource_
(
resource
)
{}
inline
ResourceWPtr
&
resource
()
const
{
return
resource_
;
}
inline
std
::
string
&
resource_name
()
const
{
return
resource_name_
;
}
private:
ResourceWPtr
resource_
;
std
::
string
resource_name_
;
}
using
SpecResLabelPtr
=
std
::
make_shared
<
SpecResLabel
>
;
}
}
}
cpp/src/scheduler/tasklabel/TaskLabel.h
0 → 100644
浏览文件 @
e9eb601a
/*******************************************************************************
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited.
* Proprietary and confidential.
******************************************************************************/
#pragma once
#include <memory>
namespace
zilliz
{
namespace
milvus
{
namespace
engine
{
enum
class
TaskLabelType
{
DEFAULT
,
// means can be executed in any resource
SPECIAL_RESOURCE
,
// means must executing in special resource
BROADCAST
,
// means all enable-executor resource must execute task
};
class
TaskLabel
{
public:
inline
TaskLabelType
Type
()
const
{
return
type_
;
}
protected:
TaskLabel
(
TaskLabelType
type
)
:
type_
(
type
)
{}
private:
TaskLabelType
type_
;
};
using
TaskLabelPtr
=
std
::
shared_ptr
<
TaskLabel
>
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录