Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
cc10c50a
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cc10c50a
编写于
10月 08, 2018
作者:
B
Brian Johnson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replaced hard coded directory names with common parameters and methods. GH #5674
上级
9758eea3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
20 deletion
+27
-20
tests/Cluster.py
tests/Cluster.py
+27
-20
未找到文件。
tests/Cluster.py
浏览文件 @
cc10c50a
...
...
@@ -30,6 +30,8 @@ class Cluster(object):
__BiosPort
=
8788
__LauncherCmdArr
=
[]
__bootlog
=
"eosio-ignition-wd/bootlog.txt"
__configDir
=
"etc/eosio/"
__dataDir
=
"var/lib/"
# pylint: disable=too-many-arguments
# walletd [True|False] Is keosd running. If not load the wallet plugin
...
...
@@ -745,6 +747,14 @@ class Cluster(object):
m
=
re
.
search
(
r
"node_([\d]+)"
,
name
)
return
int
(
m
.
group
(
1
))
@
staticmethod
def
nodeExtensionToName
(
ext
):
r
"""Convert node extension (bios, 0, 1, etc) to node name. """
prefix
=
"node_"
if
ext
==
"bios"
:
return
prefix
+
ext
return
"node_%02d"
%
(
ext
)
@
staticmethod
def
parseProducerKeys
(
configFile
,
nodeName
):
...
...
@@ -783,8 +793,7 @@ class Cluster(object):
def
parseProducers
(
nodeNum
):
"""Parse node config file for producers."""
node
=
"node_%02d"
%
(
nodeNum
)
configFile
=
"etc/eosio/%s/config.ini"
%
(
node
)
configFile
=
Cluster
.
__configDir
+
Cluster
.
nodeExtensionToName
(
nodeNum
)
+
"/config.ini"
if
Utils
.
Debug
:
Utils
.
Print
(
"Parsing config file %s"
%
configFile
)
configStr
=
None
with
open
(
configFile
,
'r'
)
as
f
:
...
...
@@ -802,20 +811,20 @@ class Cluster(object):
def
parseClusterKeys
(
totalNodes
):
"""Parse cluster config file. Updates producer keys data members."""
node
=
"node_bios"
configFile
=
"etc/eosio/%s/config.ini"
%
(
node
)
node
Name
=
Cluster
.
nodeExtensionToName
(
"bios"
)
configFile
=
Cluster
.
__configDir
+
nodeName
+
"/config.ini"
if
Utils
.
Debug
:
Utils
.
Print
(
"Parsing config file %s"
%
configFile
)
producerKeys
=
Cluster
.
parseProducerKeys
(
configFile
,
node
)
producerKeys
=
Cluster
.
parseProducerKeys
(
configFile
,
node
Name
)
if
producerKeys
is
None
:
Utils
.
Print
(
"ERROR: Failed to parse eosio private keys from cluster config files."
)
return
None
for
i
in
range
(
0
,
totalNodes
):
node
=
"node_%02d"
%
(
i
)
configFile
=
"etc/eosio/%s/config.ini"
%
(
node
)
node
Name
=
Cluster
.
nodeExtensionToName
(
i
)
configFile
=
Cluster
.
__configDir
+
nodeName
+
"/config.ini"
if
Utils
.
Debug
:
Utils
.
Print
(
"Parsing config file %s"
%
configFile
)
keys
=
Cluster
.
parseProducerKeys
(
configFile
,
node
)
keys
=
Cluster
.
parseProducerKeys
(
configFile
,
node
Name
)
if
keys
is
not
None
:
producerKeys
.
update
(
keys
)
keyMsg
=
"None"
if
keys
is
None
else
len
(
keys
)
...
...
@@ -1183,11 +1192,8 @@ class Cluster(object):
@
staticmethod
def
pgrepEosServerPattern
(
nodeInstance
):
if
isinstance
(
nodeInstance
,
str
):
return
r
"[\n]?(\d+) (.* --data-dir var/lib/node_%s .*)\n"
%
nodeInstance
else
:
nodeInstanceStr
=
"%02d"
%
nodeInstance
return
Cluster
.
pgrepEosServerPattern
(
nodeInstanceStr
)
dataLocation
=
Cluster
.
__dataDir
+
Cluster
.
nodeExtensionToName
(
nodeInstance
)
return
r
"[\n]?(\d+) (.* --data-dir %s .*)\n"
%
(
dataLocation
)
# Populates list of EosInstanceInfo objects, matched to actual running instances
def
discoverLocalNodes
(
self
,
totalNodes
,
timeout
=
None
):
...
...
@@ -1268,17 +1274,18 @@ class Cluster(object):
Utils
.
Print
(
"File %s not found."
%
(
fileName
))
def
dumpErrorDetails
(
self
):
fileName
=
"etc/eosio/node_bios
/config.ini"
fileName
=
Cluster
.
__configDir
+
Cluster
.
nodeExtensionToName
(
"bios"
)
+
"
/config.ini"
Cluster
.
dumpErrorDetailImpl
(
fileName
)
fileName
=
"var/lib/node_bios
/stderr.txt"
fileName
=
Cluster
.
__dataDir
+
Cluster
.
nodeExtensionToName
(
"bios"
)
+
"
/stderr.txt"
Cluster
.
dumpErrorDetailImpl
(
fileName
)
for
i
in
range
(
0
,
len
(
self
.
nodes
)):
fileName
=
"etc/eosio/node_%02d/config.ini"
%
(
i
)
configLocation
=
Cluster
.
__configDir
+
Cluster
.
nodeExtensionToName
(
i
)
+
"/"
fileName
=
configLocation
+
"config.ini"
Cluster
.
dumpErrorDetailImpl
(
fileName
)
fileName
=
"etc/eosio/node_%02d/genesis.json"
%
(
i
)
fileName
=
configLocation
+
"genesis.json"
Cluster
.
dumpErrorDetailImpl
(
fileName
)
fileName
=
"var/lib/node_%02d/stderr.txt"
%
(
i
)
fileName
=
Cluster
.
__dataDir
+
Cluster
.
nodeExtensionToName
(
i
)
+
"/stderr.txt"
Cluster
.
dumpErrorDetailImpl
(
fileName
)
if
self
.
useBiosBootFile
:
...
...
@@ -1350,9 +1357,9 @@ class Cluster(object):
return
node
.
waitForNextBlock
(
timeout
)
def
cleanup
(
self
):
for
f
in
glob
.
glob
(
"var/lib/
node_*"
):
for
f
in
glob
.
glob
(
Cluster
.
__dataDir
+
"
node_*"
):
shutil
.
rmtree
(
f
)
for
f
in
glob
.
glob
(
"etc/eosio/
node_*"
):
for
f
in
glob
.
glob
(
Cluster
.
__configDir
+
"
node_*"
):
shutil
.
rmtree
(
f
)
for
f
in
self
.
filesToCleanup
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录