Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
3edb4327
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,发现更多精彩内容 >>
提交
3edb4327
编写于
8月 16, 2019
作者:
W
wxyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MS-365 Use tasktableitemptr instead in event
Former-commit-id: f2e37ec3f7f5731b55d9161301084e4cc574e89f
上级
8cfeb988
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
25 addition
and
24 deletion
+25
-24
cpp/CHANGELOG.md
cpp/CHANGELOG.md
+1
-0
cpp/src/scheduler/event/CopyCompletedEvent.h
cpp/src/scheduler/event/CopyCompletedEvent.h
+3
-3
cpp/src/scheduler/event/FinishTaskEvent.h
cpp/src/scheduler/event/FinishTaskEvent.h
+3
-3
cpp/src/scheduler/resource/Resource.cpp
cpp/src/scheduler/resource/Resource.cpp
+16
-16
cpp/src/scheduler/resource/Resource.h
cpp/src/scheduler/resource/Resource.h
+2
-2
未找到文件。
cpp/CHANGELOG.md
浏览文件 @
3edb4327
...
...
@@ -20,6 +20,7 @@ Please mark all change in change log and use the ticket from JIRA.
-
MS-359 - Add cost test in new scheduler
-
MS-361 - Add event in resource
-
MS-364 - Modify tasktableitem in tasktable
-
MS-365 - Use tasktableitemptr instead in event
## New Feature
-
MS-343 - Implement ResourceMgr
...
...
cpp/src/scheduler/event/CopyCompletedEvent.h
浏览文件 @
3edb4327
...
...
@@ -15,11 +15,11 @@ namespace engine {
class
CopyCompletedEvent
:
public
Event
{
public:
CopyCompletedEvent
(
std
::
weak_ptr
<
Resource
>
resource
,
TaskTableItem
&
task_table_item
)
CopyCompletedEvent
(
std
::
weak_ptr
<
Resource
>
resource
,
TaskTableItem
Ptr
task_table_item
)
:
Event
(
EventType
::
COPY_COMPLETED
,
std
::
move
(
resource
)),
task_table_item_
(
task_table_item
)
{}
task_table_item_
(
std
::
move
(
task_table_item
)
)
{}
public:
TaskTableItem
&
task_table_item_
;
TaskTableItem
Ptr
task_table_item_
;
};
}
...
...
cpp/src/scheduler/event/FinishTaskEvent.h
浏览文件 @
3edb4327
...
...
@@ -14,12 +14,12 @@ namespace engine {
class
FinishTaskEvent
:
public
Event
{
public:
FinishTaskEvent
(
std
::
weak_ptr
<
Resource
>
resource
,
TaskTableItem
&
task_table_item
)
FinishTaskEvent
(
std
::
weak_ptr
<
Resource
>
resource
,
TaskTableItem
Ptr
task_table_item
)
:
Event
(
EventType
::
FINISH_TASK
,
std
::
move
(
resource
)),
task_table_item_
(
task_table_item
)
{}
task_table_item_
(
std
::
move
(
task_table_item
)
)
{}
public:
TaskTableItem
&
task_table_item_
;
TaskTableItem
Ptr
task_table_item_
;
};
}
...
...
cpp/src/scheduler/resource/Resource.cpp
浏览文件 @
3edb4327
...
...
@@ -41,23 +41,23 @@ void Resource::WakeupLoader() {
load_cv_
.
notify_one
();
}
TaskPtr
Resource
::
pick_task_load
()
{
Task
TableItem
Ptr
Resource
::
pick_task_load
()
{
auto
indexes
=
PickToLoad
(
task_table_
,
3
);
for
(
auto
index
:
indexes
)
{
// try to set one task loading, then return
if
(
task_table_
.
Load
(
index
))
return
task_table_
.
Get
(
index
)
->
task
;
return
task_table_
.
Get
(
index
);
// else try next
}
return
nullptr
;
}
TaskPtr
Resource
::
pick_task_execute
()
{
Task
TableItem
Ptr
Resource
::
pick_task_execute
()
{
auto
indexes
=
PickToExecute
(
task_table_
,
3
);
for
(
auto
index
:
indexes
)
{
// try to set one task executing, then return
if
(
task_table_
.
Execute
(
index
))
return
task_table_
.
Get
(
index
)
->
task
;
return
task_table_
.
Get
(
index
);
// else try next
}
return
nullptr
;
...
...
@@ -67,12 +67,12 @@ void Resource::loader_function() {
while
(
running_
)
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
load_mutex_
);
load_cv_
.
wait
(
lock
,
[
&
]
{
return
load_flag_
;
});
auto
task
=
pick_task_load
();
if
(
task
)
{
LoadFile
(
task
);
auto
task
_item
=
pick_task_load
();
if
(
task
_item
)
{
LoadFile
(
task
_item
->
task
);
if
(
subscriber_
)
{
// auto event = std::make_shared<CopyCompletedEvent>(shared_from_this(), task
);
//
subscriber_(std::static_pointer_cast<Event>(event));
auto
event
=
std
::
make_shared
<
CopyCompletedEvent
>
(
shared_from_this
(),
task_item
);
subscriber_
(
std
::
static_pointer_cast
<
Event
>
(
event
));
}
}
}
...
...
@@ -81,18 +81,18 @@ void Resource::loader_function() {
void
Resource
::
executor_function
()
{
GetRegisterFunc
(
RegisterType
::
START_UP
)
->
Exec
();
if
(
subscriber_
)
{
//
auto event = std::make_shared<StartUpEvent>(shared_from_this());
//
subscriber_(std::static_pointer_cast<Event>(event));
auto
event
=
std
::
make_shared
<
StartUpEvent
>
(
shared_from_this
());
subscriber_
(
std
::
static_pointer_cast
<
Event
>
(
event
));
}
while
(
running_
)
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
exec_mutex_
);
exec_cv_
.
wait
(
lock
,
[
&
]
{
return
exec_flag_
;
});
auto
task
=
pick_task_execute
();
if
(
task
)
{
Process
(
task
);
auto
task
_item
=
pick_task_execute
();
if
(
task
_item
)
{
Process
(
task
_item
->
task
);
if
(
subscriber_
)
{
// auto event = std::make_shared<FinishTaskEvent>(shared_from_this(), task
);
//
subscriber_(std::static_pointer_cast<Event>(event));
auto
event
=
std
::
make_shared
<
FinishTaskEvent
>
(
shared_from_this
(),
task_item
);
subscriber_
(
std
::
static_pointer_cast
<
Event
>
(
event
));
}
}
}
...
...
cpp/src/scheduler/resource/Resource.h
浏览文件 @
3edb4327
...
...
@@ -114,14 +114,14 @@ private:
* Pick one task to load;
* Order by start time;
*/
TaskPtr
Task
TableItem
Ptr
pick_task_load
();
/*
* Pick one task to execute;
* Pick by start time and priority;
*/
TaskPtr
Task
TableItem
Ptr
pick_task_execute
();
private:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录