Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
08c76edf
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
08c76edf
编写于
5月 09, 2018
作者:
D
Darcy
提交者:
GitHub
5月 09, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10542 from putcn/add-metric-to-csv1
save metrics data to csv file
上级
d2b0c489
55831575
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
42 addition
and
0 deletion
+42
-0
tools/aws_benchmarking/server/cluster_master.py
tools/aws_benchmarking/server/cluster_master.py
+42
-0
未找到文件。
tools/aws_benchmarking/server/cluster_master.py
浏览文件 @
08c76edf
...
@@ -20,6 +20,7 @@ import time
...
@@ -20,6 +20,7 @@ import time
import
threading
import
threading
import
logging
import
logging
import
copy
import
copy
import
csv
import
netaddr
import
netaddr
import
boto3
import
boto3
...
@@ -136,6 +137,12 @@ parser.add_argument(
...
@@ -136,6 +137,12 @@ parser.add_argument(
parser
.
add_argument
(
parser
.
add_argument
(
'--master_server_ip'
,
type
=
str
,
default
=
""
,
help
=
"master server private ip"
)
'--master_server_ip'
,
type
=
str
,
default
=
""
,
help
=
"master server private ip"
)
parser
.
add_argument
(
'--metric_data_identifier'
,
type
=
str
,
default
=
"**metrics_data: "
,
help
=
"key string to identify metrics data"
)
parser
.
add_argument
(
parser
.
add_argument
(
'--no_clean_up'
,
'--no_clean_up'
,
type
=
str2bool
,
type
=
str2bool
,
...
@@ -155,6 +162,11 @@ logging.basicConfig(
...
@@ -155,6 +162,11 @@ logging.basicConfig(
log_files
=
[
"master.log"
]
log_files
=
[
"master.log"
]
metrics
=
{}
metrics_csv_file_name
=
"metrics.csv"
is_metrics_file_created
=
False
def
create_subnet
():
def
create_subnet
():
# if no vpc id provided, list vpcs
# if no vpc id provided, list vpcs
...
@@ -329,12 +341,42 @@ def create_pservers():
...
@@ -329,12 +341,42 @@ def create_pservers():
cleanup
(
args
.
task_name
)
cleanup
(
args
.
task_name
)
def
save_metrics_data
(
str_msg
):
#parse msg
logging
.
info
(
"found metrics data, saving it to csv file"
)
global
is_metrics_file_created
metrics_raw
=
str_msg
.
split
(
","
)
with
open
(
args
.
log_path
+
metrics_csv_file_name
,
'a'
)
as
csvfile
:
csv_fieldnames
=
[]
csv_write_data
=
{}
for
metric
in
metrics_raw
:
metric_data
=
metric
.
split
(
"="
)
metric_key
=
metric_data
[
0
].
strip
()
metric_val
=
float
(
metric_data
[
1
].
strip
())
if
not
metric_key
in
metrics
:
metrics
[
metric_key
]
=
[]
metric_repo
=
metrics
[
metric_key
]
metric_repo
.
append
(
metric_val
)
csv_fieldnames
.
append
(
metric_key
)
csv_write_data
[
metric_key
]
=
metric_val
writer
=
csv
.
DictWriter
(
csvfile
,
fieldnames
=
csv_fieldnames
)
if
not
is_metrics_file_created
:
writer
.
writeheader
()
is_metrics_file_created
=
True
writer
.
writerow
(
csv_write_data
)
logging
.
info
(
"csv file appended"
)
def
log_to_file
(
source
,
filename
):
def
log_to_file
(
source
,
filename
):
if
not
filename
in
log_files
:
if
not
filename
in
log_files
:
log_files
.
append
(
filename
)
log_files
.
append
(
filename
)
with
open
(
args
.
log_path
+
filename
,
"a"
)
as
log_file
:
with
open
(
args
.
log_path
+
filename
,
"a"
)
as
log_file
:
for
line
in
iter
(
source
.
readline
,
""
):
for
line
in
iter
(
source
.
readline
,
""
):
log_file
.
write
(
line
)
log_file
.
write
(
line
)
if
(
line
.
startswith
(
args
.
metric_data_identifier
)):
#found key data, trying to add to csv
line
=
line
.
replace
(
args
.
metric_data_identifier
,
""
)
save_metrics_data
(
line
)
def
parse_command
(
command_raw
,
defaults
=
{}):
def
parse_command
(
command_raw
,
defaults
=
{}):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录