Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
109eb6ea
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,发现更多精彩内容 >>
提交
109eb6ea
编写于
8月 21, 2019
作者:
W
wxyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MS-390 Update resource construct function
Former-commit-id: 1413e2f8723f9164486ee9b736a47f80027daf7a
上级
cbdbd552
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
57 addition
and
35 deletion
+57
-35
cpp/CHANGELOG.md
cpp/CHANGELOG.md
+1
-0
cpp/src/scheduler/ResourceFactory.cpp
cpp/src/scheduler/ResourceFactory.cpp
+7
-4
cpp/src/scheduler/ResourceFactory.h
cpp/src/scheduler/ResourceFactory.h
+4
-1
cpp/src/scheduler/resource/CpuResource.cpp
cpp/src/scheduler/resource/CpuResource.cpp
+3
-3
cpp/src/scheduler/resource/CpuResource.h
cpp/src/scheduler/resource/CpuResource.h
+1
-1
cpp/src/scheduler/resource/DiskResource.cpp
cpp/src/scheduler/resource/DiskResource.cpp
+2
-2
cpp/src/scheduler/resource/DiskResource.h
cpp/src/scheduler/resource/DiskResource.h
+1
-1
cpp/src/scheduler/resource/GpuResource.cpp
cpp/src/scheduler/resource/GpuResource.cpp
+2
-2
cpp/src/scheduler/resource/GpuResource.h
cpp/src/scheduler/resource/GpuResource.h
+1
-1
cpp/src/scheduler/resource/Resource.h
cpp/src/scheduler/resource/Resource.h
+35
-20
未找到文件。
cpp/CHANGELOG.md
浏览文件 @
109eb6ea
...
...
@@ -35,6 +35,7 @@ Please mark all change in change log and use the ticket from JIRA.
-
MS-383 - Modify condition variable usage in scheduler
-
MS-384 - Add global instance of ResourceMgr and Scheduler
-
MS-389 - Add clone interface in Task
-
MS-390 - Update resource construct function
## New Feature
-
MS-343 - Implement ResourceMgr
...
...
cpp/src/scheduler/ResourceFactory.cpp
浏览文件 @
109eb6ea
...
...
@@ -12,13 +12,16 @@ namespace milvus {
namespace
engine
{
std
::
shared_ptr
<
Resource
>
ResourceFactory
::
Create
(
const
std
::
string
&
name
,
const
std
::
string
&
alias
)
{
ResourceFactory
::
Create
(
const
std
::
string
&
name
,
const
std
::
string
&
alias
,
bool
enable_loader
,
bool
enable_executor
)
{
if
(
name
==
"disk"
)
{
return
std
::
make_shared
<
DiskResource
>
(
alias
);
return
std
::
make_shared
<
DiskResource
>
(
alias
,
enable_loader
,
enable_executor
);
}
else
if
(
name
==
"cpu"
)
{
return
std
::
make_shared
<
CpuResource
>
(
alias
);
return
std
::
make_shared
<
CpuResource
>
(
alias
,
enable_loader
,
enable_executor
);
}
else
if
(
name
==
"gpu"
)
{
return
std
::
make_shared
<
GpuResource
>
(
alias
);
return
std
::
make_shared
<
GpuResource
>
(
alias
,
enable_loader
,
enable_executor
);
}
else
{
return
nullptr
;
}
...
...
cpp/src/scheduler/ResourceFactory.h
浏览文件 @
109eb6ea
...
...
@@ -21,7 +21,10 @@ namespace engine {
class
ResourceFactory
{
public:
static
std
::
shared_ptr
<
Resource
>
Create
(
const
std
::
string
&
name
,
const
std
::
string
&
alias
=
""
);
Create
(
const
std
::
string
&
name
,
const
std
::
string
&
alias
=
""
,
bool
enable_loader
=
true
,
bool
enable_executor
=
true
);
};
...
...
cpp/src/scheduler/resource/CpuResource.cpp
浏览文件 @
109eb6ea
...
...
@@ -16,8 +16,8 @@ std::ostream &operator<<(std::ostream &out, const CpuResource &resource) {
return
out
;
}
CpuResource
::
CpuResource
(
std
::
string
name
)
:
Resource
(
std
::
move
(
name
),
ResourceType
::
CPU
)
{}
CpuResource
::
CpuResource
(
std
::
string
name
,
bool
enable_loader
,
bool
enable_executor
)
:
Resource
(
std
::
move
(
name
),
ResourceType
::
CPU
,
enable_loader
,
enable_executor
)
{}
void
CpuResource
::
LoadFile
(
TaskPtr
task
)
{
task
->
Load
(
LoadType
::
DISK2CPU
,
0
);
...
...
@@ -29,4 +29,4 @@ void CpuResource::Process(TaskPtr task) {
}
}
}
\ No newline at end of file
}
cpp/src/scheduler/resource/CpuResource.h
浏览文件 @
109eb6ea
...
...
@@ -17,7 +17,7 @@ namespace engine {
class
CpuResource
:
public
Resource
{
public:
explicit
CpuResource
(
std
::
string
name
);
CpuResource
(
std
::
string
name
,
bool
enable_loader
,
bool
enable_executor
);
inline
std
::
string
Dump
()
const
override
{
...
...
cpp/src/scheduler/resource/DiskResource.cpp
浏览文件 @
109eb6ea
...
...
@@ -15,8 +15,8 @@ std::ostream &operator<<(std::ostream &out, const DiskResource &resource) {
return
out
;
}
DiskResource
::
DiskResource
(
std
::
string
name
)
:
Resource
(
std
::
move
(
name
),
ResourceType
::
DISK
,
true
,
false
)
{
DiskResource
::
DiskResource
(
std
::
string
name
,
bool
enable_loader
,
bool
enable_executor
)
:
Resource
(
std
::
move
(
name
),
ResourceType
::
DISK
,
enable_loader
,
enable_executor
)
{
}
void
DiskResource
::
LoadFile
(
TaskPtr
task
)
{
...
...
cpp/src/scheduler/resource/DiskResource.h
浏览文件 @
109eb6ea
...
...
@@ -16,7 +16,7 @@ namespace engine {
class
DiskResource
:
public
Resource
{
public:
explicit
DiskResource
(
std
::
string
name
);
DiskResource
(
std
::
string
name
,
bool
enable_loader
,
bool
enable_executor
);
inline
std
::
string
Dump
()
const
override
{
...
...
cpp/src/scheduler/resource/GpuResource.cpp
浏览文件 @
109eb6ea
...
...
@@ -16,8 +16,8 @@ std::ostream &operator<<(std::ostream &out, const GpuResource &resource) {
return
out
;
}
GpuResource
::
GpuResource
(
std
::
string
name
)
:
Resource
(
std
::
move
(
name
),
ResourceType
::
GPU
)
{}
GpuResource
::
GpuResource
(
std
::
string
name
,
bool
enable_loader
,
bool
enable_executor
)
:
Resource
(
std
::
move
(
name
),
ResourceType
::
GPU
,
enable_loader
,
enable_executor
)
{}
void
GpuResource
::
LoadFile
(
TaskPtr
task
)
{
task
->
Load
(
LoadType
::
CPU2GPU
,
0
);
...
...
cpp/src/scheduler/resource/GpuResource.h
浏览文件 @
109eb6ea
...
...
@@ -16,7 +16,7 @@ namespace engine {
class
GpuResource
:
public
Resource
{
public:
explicit
GpuResource
(
std
::
string
name
);
GpuResource
(
std
::
string
name
,
bool
enable_loader
,
bool
enable_executor
);
inline
std
::
string
Dump
()
const
override
{
...
...
cpp/src/scheduler/resource/Resource.h
浏览文件 @
109eb6ea
...
...
@@ -45,8 +45,30 @@ enum class RegisterType {
class
Resource
:
public
Node
,
public
std
::
enable_shared_from_this
<
Resource
>
{
public:
/*
*
Event function MUST be a short function, never blocking
;
*
Start loader and executor if enable
;
*/
void
Start
();
/*
* Stop loader and executor, join it, blocking util thread exited;
*/
void
Stop
();
/*
* wake up loader;
*/
void
WakeupLoader
();
/*
* wake up executor;
*/
void
WakeupExecutor
();
public:
template
<
typename
T
>
void
Register_T
(
const
RegisterType
&
type
)
{
register_table_
.
emplace
(
type
,
[]
{
return
std
::
make_shared
<
T
>
();
});
...
...
@@ -65,11 +87,17 @@ public:
return
type_
;
}
void
Start
();
// TODO: better name?
inline
bool
HasLoader
()
{
return
enable_loader_
;
}
void
Stop
();
// TODO: better name?
inline
bool
HasExecutor
()
{
return
enable_executor_
;
}
TaskTable
&
task_table
();
...
...
@@ -81,24 +109,11 @@ public:
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
Resource
&
resource
);
public:
/*
* wake up loader;
*/
void
WakeupLoader
();
/*
* wake up executor;
*/
void
WakeupExecutor
();
protected:
Resource
(
std
::
string
name
,
ResourceType
type
,
bool
enable_loader
=
true
,
bool
enable_executor
=
true
);
bool
enable_loader
,
bool
enable_executor
);
// TODO: SearchContextPtr to TaskPtr
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录