Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Stansberry, Dale
spark_on_demand
Commits
16353e6f
Commit
16353e6f
authored
May 06, 2016
by
Stansberry, Dale
Browse files
- Clean-up collectNodeInfo function
parent
bdfe6e1b
Pipeline
#2795
skipped
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
spark_deploy.py
View file @
16353e6f
...
@@ -25,18 +25,20 @@ def collectNodeInfo():
...
@@ -25,18 +25,20 @@ def collectNodeInfo():
nodenameset
.
add
(
line
.
strip
())
nodenameset
.
add
(
line
.
strip
())
nodenamelist
=
list
(
nodenameset
)
nodenamelist
=
list
(
nodenameset
)
# TODO This impl is inefficient
hostsfile
=
open
(
'/etc/hosts'
,
'r'
)
for
nodename
in
nodenamelist
:
# need to replace with re.match
for
line
in
hostsfile
:
hostsfile
=
open
(
'/etc/hosts'
,
'r'
)
tokens
=
line
.
strip
().
split
()
output
=
[]
for
nodename
in
nodenamelist
:
for
line
in
hostsfile
:
if
len
(
tokens
)
>
2
:
if
len
(
line
.
strip
().
split
())
>
2
:
if
re
.
match
(
nodename
+
'
\\
b'
,
tokens
[
2
]):
if
re
.
match
(
nodename
+
'
\\
b'
,
line
.
strip
().
split
()[
2
]):
hostdict
=
{
hostdict
=
{
"IP"
:
line
.
strip
().
split
()[
0
],
\
"IP"
:
tokens
[
0
],
"FULLNAME"
:
line
.
strip
().
split
()[
1
],
\
"FULLNAME"
:
tokens
[
1
],
"NAME"
:
line
.
strip
().
split
()[
2
].
lower
()}
"NAME"
:
tokens
[
2
].
lower
()
hostlist
.
append
(
hostdict
)
}
hostlist
.
append
(
hostdict
)
break
return
hostlist
return
hostlist
def
createConfigDirs
(
hostname
):
def
createConfigDirs
(
hostname
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment