Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
fb8d4653
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,发现更多精彩内容 >>
提交
fb8d4653
编写于
8月 26, 2019
作者:
W
wxyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MS-422 Support DeleteTask in Multi-GpuResource case
Former-commit-id: c5d46cefb2b04ed262de0d72f365c708e62297d0
上级
4ef42c47
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
39 addition
and
109 deletion
+39
-109
cpp/CHANGELOG.md
cpp/CHANGELOG.md
+1
-0
cpp/src/scheduler/ResourceMgr.cpp
cpp/src/scheduler/ResourceMgr.cpp
+1
-1
cpp/src/scheduler/Scheduler.cpp
cpp/src/scheduler/Scheduler.cpp
+17
-4
cpp/src/scheduler/action/Action.h
cpp/src/scheduler/action/Action.h
+2
-14
cpp/src/scheduler/action/PullTaskFromNeighbour.cpp
cpp/src/scheduler/action/PullTaskFromNeighbour.cpp
+0
-24
cpp/src/scheduler/action/PushTaskToNeighbour.cpp
cpp/src/scheduler/action/PushTaskToNeighbour.cpp
+18
-66
未找到文件。
cpp/CHANGELOG.md
浏览文件 @
fb8d4653
...
...
@@ -58,6 +58,7 @@ Please mark all change in change log and use the ticket from JIRA.
-
MS-418 - Update server_config.template file, set CPU compute only default
-
MS-419 - Move index_file_size from IndexParam to TableSchema
-
MS-421 - Add TaskLabel in scheduler
-
MS-422 - Support DeleteTask in Multi-GpuResource case
## New Feature
-
MS-343 - Implement ResourceMgr
...
...
cpp/src/scheduler/ResourceMgr.cpp
浏览文件 @
fb8d4653
...
...
@@ -54,7 +54,7 @@ ResourceMgr::Connect(const std::string &name1, const std::string &name2, Connect
auto
res2
=
get_resource_by_name
(
name2
);
if
(
res1
&&
res2
)
{
res1
->
AddNeighbour
(
std
::
static_pointer_cast
<
Node
>
(
res2
),
connection
);
res2
->
AddNeighbour
(
std
::
static_pointer_cast
<
Node
>
(
res1
),
connection
);
//
res2->AddNeighbour(std::static_pointer_cast<Node>(res1), connection);
}
}
...
...
cpp/src/scheduler/Scheduler.cpp
浏览文件 @
fb8d4653
...
...
@@ -108,12 +108,25 @@ Scheduler::OnFinishTask(const EventPtr &event) {
void
Scheduler
::
OnCopyCompleted
(
const
EventPtr
&
event
)
{
auto
load_completed_event
=
std
::
static_pointer_cast
<
CopyCompletedEvent
>
(
event
);
if
(
auto
resource
=
event
->
resource_
.
lock
())
{
resource
->
WakeupExecutor
();
if
(
resource
->
Type
()
==
ResourceType
::
DISK
)
{
Action
::
PushTaskToNeighbour
(
event
->
resource_
);
}
else
{
Action
::
PushTaskToNeighbourHasExecutor
(
event
->
resource_
);
auto
task_table_type
=
load_completed_event
->
task_table_item_
->
task
->
label
()
->
Type
();
switch
(
task_table_type
)
{
case
TaskLabelType
::
DEFAULT
:
{
if
(
not
resource
->
HasExecutor
()
&&
load_completed_event
->
task_table_item_
->
Move
())
{
Action
::
PushTaskToNeighbourRandomly
(
load_completed_event
->
task_table_item_
->
task
,
resource
);
}
break
;
}
case
TaskLabelType
::
BROADCAST
:
{
Action
::
PushTaskToAllNeighbour
(
load_completed_event
->
task_table_item_
->
task
,
resource
);
break
;
}
default:
{
break
;
}
}
}
}
...
...
cpp/src/scheduler/action/Action.h
浏览文件 @
fb8d4653
...
...
@@ -14,23 +14,11 @@ namespace engine {
class
Action
{
public:
/*
* Push task to neighbour;
*/
static
void
PushTaskToNeighbour
(
const
ResourceW
Ptr
&
self
);
PushTaskToNeighbour
Randomly
(
const
TaskPtr
&
task
,
const
Resource
Ptr
&
self
);
/*
* Push task to neighbour that has executor;
*/
static
void
PushTaskToNeighbourHasExecutor
(
const
ResourceWPtr
&
self
);
/*
* Pull task From neighbour;
*/
static
void
PullTaskFromNeighbour
(
const
ResourceWPtr
&
self
);
PushTaskToAllNeighbour
(
const
TaskPtr
&
task
,
const
ResourcePtr
&
self
);
};
...
...
cpp/src/scheduler/action/PullTaskFromNeighbour.cpp
已删除
100644 → 0
浏览文件 @
4ef42c47
/*******************************************************************************
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited.
* Proprietary and confidential.
******************************************************************************/
#include "Action.h"
namespace
zilliz
{
namespace
milvus
{
namespace
engine
{
void
Action
::
PullTaskFromNeighbour
(
const
ResourceWPtr
&
self
)
{
// TODO: implement
}
}
}
}
cpp/src/scheduler/action/PushTaskToNeighbour.cpp
浏览文件 @
fb8d4653
...
...
@@ -13,85 +13,37 @@ namespace zilliz {
namespace
milvus
{
namespace
engine
{
void
next
(
std
::
list
<
ResourcePtr
>
&
neighbours
,
std
::
list
<
ResourcePtr
>::
iterator
&
it
)
{
it
++
;
if
(
neighbours
.
end
()
==
it
)
{
it
=
neighbours
.
begin
();
}
}
// TODO: this function called with only on tasks, so it will always push task to first neighbour
void
push_task_round_robin
(
TaskTable
&
self_task_table
,
std
::
list
<
ResourcePtr
>
&
neighbours
)
{
CacheMgr
cache
;
auto
it
=
neighbours
.
begin
();
if
(
it
==
neighbours
.
end
())
return
;
auto
indexes
=
PickToMove
(
self_task_table
,
cache
,
self_task_table
.
Size
());
std
::
vector
<
ResourcePtr
>
get_neighbours
(
const
ResourcePtr
&
self
)
{
std
::
vector
<
ResourcePtr
>
neighbours
;
for
(
auto
&
neighbour_node
:
self
->
GetNeighbours
())
{
auto
node
=
neighbour_node
.
neighbour_node
.
lock
();
if
(
not
node
)
continue
;
for
(
auto
index
:
indexes
)
{
if
(
self_task_table
.
Move
(
index
))
{
auto
task
=
self_task_table
.
Get
(
index
)
->
task
;
// task = task->Clone();
(
*
it
)
->
task_table
().
Put
(
task
);
next
(
neighbours
,
it
);
}
auto
resource
=
std
::
static_pointer_cast
<
Resource
>
(
node
);
neighbours
.
emplace_back
(
resource
);
}
return
neighbours
;
}
void
push_task_randomly
(
TaskTable
&
self_task_table
,
std
::
vector
<
ResourcePtr
>
&
neighbours
)
{
Action
::
PushTaskToNeighbourRandomly
(
const
TaskPtr
&
task
,
const
ResourcePtr
&
self
)
{
auto
neighbours
=
get_neighbours
(
self
);
std
::
random_device
rd
;
std
::
mt19937
mt
(
rd
());
std
::
uniform_int_distribution
<
uint64_t
>
dist
(
0
,
neighbours
.
size
()
-
1
);
CacheMgr
cache
;
auto
indexes
=
PickToMove
(
self_task_table
,
cache
,
self_task_table
.
Size
());
for
(
auto
index
:
indexes
)
{
if
(
self_task_table
.
Move
(
index
))
{
auto
task
=
self_task_table
.
Get
(
index
)
->
task
;
neighbours
[
dist
(
mt
)]
->
task_table
().
Put
(
task
);
}
}
}
void
Action
::
PushTaskToNeighbour
(
const
ResourceWPtr
&
res
)
{
auto
self
=
res
.
lock
();
if
(
not
self
)
return
;
std
::
list
<
ResourcePtr
>
neighbours
;
for
(
auto
&
neighbour_node
:
self
->
GetNeighbours
())
{
auto
node
=
neighbour_node
.
neighbour_node
.
lock
();
if
(
not
node
)
continue
;
auto
resource
=
std
::
static_pointer_cast
<
Resource
>
(
node
);
neighbours
.
emplace_back
(
resource
);
}
push_task_round_robin
(
self
->
task_table
(),
neighbours
);
}
void
Action
::
PushTaskToNeighbourHasExecutor
(
const
ResourceWPtr
&
res
)
{
auto
self
=
res
.
lock
();
if
(
not
self
)
return
;
std
::
list
<
ResourcePtr
>
l_neighbours
;
std
::
vector
<
ResourcePtr
>
v_neighbours
;
for
(
auto
&
neighbour_node
:
self
->
GetNeighbours
())
{
auto
node
=
neighbour_node
.
neighbour_node
.
lock
();
if
(
not
node
)
continue
;
auto
resource
=
std
::
static_pointer_cast
<
Resource
>
(
node
);
if
(
resource
->
HasExecutor
())
{
l_neighbours
.
push_back
(
resource
);
v_neighbours
.
push_back
(
resource
);
Action
::
PushTaskToAllNeighbour
(
const
TaskPtr
&
task
,
const
ResourcePtr
&
self
)
{
auto
neighbours
=
get_neighbours
(
self
);
for
(
auto
&
neighbour
:
neighbours
)
{
neighbour
->
task_table
().
Put
(
task
);
}
}
// push_task_round_robin(self->task_table(), l_neighbours);
push_task_randomly
(
self
->
task_table
(),
v_neighbours
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录