Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
A-Tune
提交
fc63b020
A
A-Tune
项目概览
openeuler
/
A-Tune
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
A-Tune
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fc63b020
编写于
1月 13, 2020
作者:
H
hanxinke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
atune:modify the check command and add exception printing
上级
38bf68c7
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
41 addition
and
67 deletion
+41
-67
analysis/resources/optimizer.py
analysis/resources/optimizer.py
+4
-3
common/checker/elf.go
common/checker/elf.go
+0
-36
common/models/optimizer.go
common/models/optimizer.go
+14
-3
common/project/projet.go
common/project/projet.go
+1
-2
modules/client/profile/profile_check.go
modules/client/profile/profile_check.go
+5
-8
modules/client/profile/profile_collection.go
modules/client/profile/profile_collection.go
+2
-2
modules/client/profile/profile_tuning.go
modules/client/profile/profile_tuning.go
+14
-2
modules/server/profile/profile.go
modules/server/profile/profile.go
+1
-11
未找到文件。
analysis/resources/optimizer.py
浏览文件 @
fc63b020
...
@@ -53,7 +53,8 @@ class Optimizer(Resource):
...
@@ -53,7 +53,8 @@ class Optimizer(Resource):
args
=
OPTIMIZER_POST_PARSER
.
parse_args
()
args
=
OPTIMIZER_POST_PARSER
.
parse_args
()
LOGGER
.
info
(
args
)
LOGGER
.
info
(
args
)
if
args
[
"max_eval"
]
<
10
:
if
args
[
"max_eval"
]
<
10
:
abort
(
400
,
"max_eval must be >=10"
)
LOGGER
.
error
(
"the max iterations %s must be greater than 10"
,
args
[
"max_eval"
])
abort
(
400
,
"the max iterations {} must be greater than 10"
.
format
(
args
[
"max_eval"
]))
task_id
=
str
(
uuid
.
uuid1
())
task_id
=
str
(
uuid
.
uuid1
())
parent_conn
,
child_conn
=
Pipe
()
parent_conn
,
child_conn
=
Pipe
()
...
@@ -74,7 +75,7 @@ class Optimizer(Resource):
...
@@ -74,7 +75,7 @@ class Optimizer(Resource):
def
put
(
self
,
task_id
):
def
put
(
self
,
task_id
):
"""provide the method of put"""
"""provide the method of put"""
if
not
task_id
:
if
not
task_id
:
abort
(
404
)
abort
(
404
,
"task id does not exist"
)
task
=
task_cache
.
TasksCache
.
get_instance
().
get
(
task_id
)
task
=
task_cache
.
TasksCache
.
get_instance
().
get
(
task_id
)
if
not
task
:
if
not
task
:
abort
(
404
,
"taskid {0} not found"
.
format
(
task_id
))
abort
(
404
,
"taskid {0} not found"
.
format
(
task_id
))
...
@@ -95,7 +96,7 @@ class Optimizer(Resource):
...
@@ -95,7 +96,7 @@ class Optimizer(Resource):
def
delete
(
self
,
task_id
):
def
delete
(
self
,
task_id
):
"""provide the method of delete"""
"""provide the method of delete"""
if
not
task_id
:
if
not
task_id
:
abort
(
404
)
abort
(
404
,
"task id does not exist"
)
process
=
task_cache
.
TasksCache
.
get_instance
().
get
(
task_id
)
process
=
task_cache
.
TasksCache
.
get_instance
().
get
(
task_id
)
if
not
process
:
if
not
process
:
abort
(
404
,
"{0} {1} not found"
.
format
(
self
.
task_id_info
,
task_id
))
abort
(
404
,
"{0} {1} not found"
.
format
(
self
.
task_id_info
,
task_id
))
...
...
common/checker/elf.go
已删除
100644 → 0
浏览文件 @
38bf68c7
/*
* Copyright (c) 2019 Huawei Technologies Co., Ltd.
* A-Tune is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
* You may obtain a copy of Mulan PSL v1 at:
* http://license.coscl.org.cn/MulanPSL
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
* PURPOSE.
* See the Mulan PSL v1 for more details.
* Create: 2019-10-29
*/
package
checker
import
(
PB
"atune/api/profile"
"atune/common/log"
"atune/common/utils"
)
//ELF file structer
type
ELF
struct
{
FileName
string
}
/*
Check method check the elf file format
*/
func
(
elf
*
ELF
)
Check
(
ch
chan
*
PB
.
AckCheck
)
error
{
log
.
Debugf
(
"Check %s"
,
elf
.
FileName
)
sendChanToAdm
(
ch
,
elf
.
FileName
,
utils
.
SUCCESS
,
"FIXME: NOT Implement"
)
return
nil
}
common/models/optimizer.go
浏览文件 @
fc63b020
...
@@ -17,6 +17,7 @@ import (
...
@@ -17,6 +17,7 @@ import (
"atune/common/config"
"atune/common/config"
"atune/common/http"
"atune/common/http"
"encoding/json"
"encoding/json"
"fmt"
"io/ioutil"
"io/ioutil"
)
)
...
@@ -40,8 +41,9 @@ type Knob struct {
...
@@ -40,8 +41,9 @@ type Knob struct {
// RespPostBody :the body returned of create optimizer task
// RespPostBody :the body returned of create optimizer task
type
RespPostBody
struct
{
type
RespPostBody
struct
{
TaskID
string
`json:"task_id"`
TaskID
string
`json:"task_id"`
Status
string
`json:"status"`
Status
string
`json:"status"`
Message
string
`json:"message"`
}
}
// OptimizerPutBody send to the optimizer service when iterations
// OptimizerPutBody send to the optimizer service when iterations
...
@@ -52,7 +54,8 @@ type OptimizerPutBody struct {
...
@@ -52,7 +54,8 @@ type OptimizerPutBody struct {
// RespPutBody :the body returned of each optimizer iteration
// RespPutBody :the body returned of each optimizer iteration
type
RespPutBody
struct
{
type
RespPutBody
struct
{
Param
string
`json:"param"`
Param
string
`json:"param"`
Message
string
`json:"message"`
}
}
// Post method create a optimizer task
// Post method create a optimizer task
...
@@ -77,6 +80,10 @@ func (o *OptimizerPostBody) Post() (*RespPostBody, error) {
...
@@ -77,6 +80,10 @@ func (o *OptimizerPostBody) Post() (*RespPostBody, error) {
return
nil
,
err
return
nil
,
err
}
}
if
res
.
StatusCode
!=
200
{
return
nil
,
fmt
.
Errorf
(
respPostIns
.
Message
)
}
return
respPostIns
,
nil
return
respPostIns
,
nil
}
}
...
@@ -101,5 +108,9 @@ func (o *OptimizerPutBody) Put(url string) (*RespPutBody, error) {
...
@@ -101,5 +108,9 @@ func (o *OptimizerPutBody) Put(url string) (*RespPutBody, error) {
return
nil
,
err
return
nil
,
err
}
}
if
res
.
StatusCode
!=
200
{
return
nil
,
fmt
.
Errorf
(
respPutIns
.
Message
)
}
return
respPutIns
,
nil
return
respPutIns
,
nil
}
}
common/project/projet.go
浏览文件 @
fc63b020
...
@@ -114,8 +114,7 @@ func (y *YamlPrjCli) BenchMark() (string, error) {
...
@@ -114,8 +114,7 @@ func (y *YamlPrjCli) BenchMark() (string, error) {
benchOutByte
,
err
:=
cmd
.
CombinedOutput
()
benchOutByte
,
err
:=
cmd
.
CombinedOutput
()
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
err
)
return
""
,
fmt
.
Errorf
(
"failed to run benchmark, err: %v"
,
err
)
return
""
,
err
}
}
for
_
,
evaluation
:=
range
y
.
Evaluations
{
for
_
,
evaluation
:=
range
y
.
Evaluations
{
newScript
:=
strings
.
Replace
(
evaluation
.
Info
.
Get
,
"$out"
,
string
(
benchOutByte
),
-
1
)
newScript
:=
strings
.
Replace
(
evaluation
.
Info
.
Get
,
"$out"
,
string
(
benchOutByte
),
-
1
)
...
...
modules/client/profile/profile_check.go
浏览文件 @
fc63b020
...
@@ -28,7 +28,7 @@ import (
...
@@ -28,7 +28,7 @@ import (
var
profileCheckCommand
=
cli
.
Command
{
var
profileCheckCommand
=
cli
.
Command
{
Name
:
"check"
,
Name
:
"check"
,
Usage
:
"check system basic information"
,
Usage
:
"check system basic information"
,
ArgsUsage
:
"[arguments...]
"
,
UsageText
:
"atune-adm check
"
,
Description
:
func
()
string
{
Description
:
func
()
string
{
desc
:=
"
\n
check system basic information
\n
"
desc
:=
"
\n
check system basic information
\n
"
return
desc
return
desc
...
@@ -53,12 +53,8 @@ func newProfileCheckCmd(ctx *cli.Context, opts ...interface{}) (interface{}, err
...
@@ -53,12 +53,8 @@ func newProfileCheckCmd(ctx *cli.Context, opts ...interface{}) (interface{}, err
}
}
func
profileCheck
(
ctx
*
cli
.
Context
)
error
{
func
profileCheck
(
ctx
*
cli
.
Context
)
error
{
appname
:=
""
if
err
:=
utils
.
CheckArgs
(
ctx
,
0
,
utils
.
ConstExactArgs
);
err
!=
nil
{
if
ctx
.
NArg
()
>
2
{
return
err
return
fmt
.
Errorf
(
"only one or zero argument required"
)
}
if
ctx
.
NArg
()
==
1
{
appname
=
ctx
.
Args
()
.
Get
(
0
)
}
}
c
,
err
:=
client
.
NewClientFromContext
(
ctx
)
c
,
err
:=
client
.
NewClientFromContext
(
ctx
)
...
@@ -68,7 +64,7 @@ func profileCheck(ctx *cli.Context) error {
...
@@ -68,7 +64,7 @@ func profileCheck(ctx *cli.Context) error {
defer
c
.
Close
()
defer
c
.
Close
()
svc
:=
PB
.
NewProfileMgrClient
(
c
.
Connection
())
svc
:=
PB
.
NewProfileMgrClient
(
c
.
Connection
())
stream
,
err
:=
svc
.
CheckInitProfile
(
CTX
.
Background
(),
&
PB
.
ProfileInfo
{
Name
:
appname
})
stream
,
err
:=
svc
.
CheckInitProfile
(
CTX
.
Background
(),
&
PB
.
ProfileInfo
{})
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -104,5 +100,6 @@ func profileCheck(ctx *cli.Context) error {
...
@@ -104,5 +100,6 @@ func profileCheck(ctx *cli.Context) error {
utils
.
Print
(
reply
)
utils
.
Print
(
reply
)
}
}
fmt
.
Println
(
"
\n
Check finished"
)
return
nil
return
nil
}
}
modules/client/profile/profile_collection.go
浏览文件 @
fc63b020
...
@@ -99,8 +99,8 @@ func checkCollectionCtx(ctx *cli.Context) error {
...
@@ -99,8 +99,8 @@ func checkCollectionCtx(ctx *cli.Context) error {
return
fmt
.
Errorf
(
"error: filename must be specified"
)
return
fmt
.
Errorf
(
"error: filename must be specified"
)
}
}
if
len
(
ctx
.
String
(
"filename"
))
>
255
{
if
len
(
ctx
.
String
(
"filename"
))
>
128
{
return
fmt
.
Errorf
(
"error: filename length is longer than
255
charaters"
)
return
fmt
.
Errorf
(
"error: filename length is longer than
128
charaters"
)
}
}
if
ctx
.
String
(
"disk"
)
==
""
{
if
ctx
.
String
(
"disk"
)
==
""
{
...
...
modules/client/profile/profile_tuning.go
浏览文件 @
fc63b020
...
@@ -104,6 +104,18 @@ func profileTunning(ctx *cli.Context) error {
...
@@ -104,6 +104,18 @@ func profileTunning(ctx *cli.Context) error {
return
err
return
err
}
}
if
len
(
prj
.
Project
)
<
1
||
len
(
prj
.
Project
)
>
128
{
return
fmt
.
Errorf
(
"project name must be no less than 1 and no greater than 128 in yaml or yml"
)
}
if
len
(
prj
.
Benchmark
)
<
1
{
return
fmt
.
Errorf
(
"benchmark must be specified in yaml or yml"
)
}
if
len
(
prj
.
Evaluations
)
>
10
{
return
fmt
.
Errorf
(
"evaluations must be no greater than 10 in project %s"
,
prj
.
Project
)
}
_
,
err
=
runTuningRPC
(
ctx
,
&
PB
.
ProfileInfo
{
Name
:
prj
.
Project
,
Content
:
[]
byte
(
strconv
.
Itoa
(
prj
.
Iterations
))})
_
,
err
=
runTuningRPC
(
ctx
,
&
PB
.
ProfileInfo
{
Name
:
prj
.
Project
,
Content
:
[]
byte
(
strconv
.
Itoa
(
prj
.
Iterations
))})
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -171,8 +183,8 @@ func checkTuningCtx(ctx *cli.Context) error {
...
@@ -171,8 +183,8 @@ func checkTuningCtx(ctx *cli.Context) error {
return
fmt
.
Errorf
(
"error: project name must be specified"
)
return
fmt
.
Errorf
(
"error: project name must be specified"
)
}
}
if
len
(
ctx
.
String
(
"project"
))
>
255
{
if
len
(
ctx
.
String
(
"project"
))
>
128
{
return
fmt
.
Errorf
(
"error: project name length is longer than
255
charaters"
)
return
fmt
.
Errorf
(
"error: project name length is longer than
128
charaters"
)
}
}
return
nil
return
nil
...
...
modules/server/profile/profile.go
浏览文件 @
fc63b020
...
@@ -15,7 +15,7 @@ package main
...
@@ -15,7 +15,7 @@ package main
import
(
import
(
PB
"atune/api/profile"
PB
"atune/api/profile"
"atune/common/checker"
_
"atune/common/checker"
"atune/common/config"
"atune/common/config"
"atune/common/http"
"atune/common/http"
"atune/common/log"
"atune/common/log"
...
@@ -243,8 +243,6 @@ func (s *ProfileServer) ListWorkload(profileInfo *PB.ProfileInfo, stream PB.Prof
...
@@ -243,8 +243,6 @@ func (s *ProfileServer) ListWorkload(profileInfo *PB.ProfileInfo, stream PB.Prof
// like BIOS version, memory balanced...
// like BIOS version, memory balanced...
func
(
s
*
ProfileServer
)
CheckInitProfile
(
profileInfo
*
PB
.
ProfileInfo
,
func
(
s
*
ProfileServer
)
CheckInitProfile
(
profileInfo
*
PB
.
ProfileInfo
,
stream
PB
.
ProfileMgr_CheckInitProfileServer
)
error
{
stream
PB
.
ProfileMgr_CheckInitProfileServer
)
error
{
elf
:=
profileInfo
.
GetName
()
ch
:=
make
(
chan
*
PB
.
AckCheck
)
ch
:=
make
(
chan
*
PB
.
AckCheck
)
defer
close
(
ch
)
defer
close
(
ch
)
go
func
()
{
go
func
()
{
...
@@ -253,14 +251,6 @@ func (s *ProfileServer) CheckInitProfile(profileInfo *PB.ProfileInfo,
...
@@ -253,14 +251,6 @@ func (s *ProfileServer) CheckInitProfile(profileInfo *PB.ProfileInfo,
}
}
}()
}()
elf
=
strings
.
Trim
(
elf
,
""
)
if
elf
!=
""
{
if
exist
,
_
:=
utils
.
PathExist
(
elf
);
exist
{
program
:=
checker
.
ELF
{
FileName
:
elf
}
_
=
program
.
Check
(
ch
)
}
}
services
:=
registry
.
GetCheckerServices
()
services
:=
registry
.
GetCheckerServices
()
for
_
,
service
:=
range
services
{
for
_
,
service
:=
range
services
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录