Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
a7483fee
Commit
a7483fee
authored
9 years ago
by
Jon Maron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redirect output from python scripts to files
parent
5bc3501a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
7 deletions
+13
-7
metadata_config.py
src/bin/metadata_config.py
+10
-4
metadata_start.py
src/bin/metadata_start.py
+1
-1
TestMetadata.py
src/test/python/scripts/TestMetadata.py
+2
-2
No files found.
src/bin/metadata_config.py
View file @
a7483fee
...
...
@@ -109,7 +109,7 @@ def executeEnvSh(confDir):
proc
.
communicate
()
def
java
(
classname
,
args
,
classpath
,
jvm_opts_list
):
def
java
(
classname
,
args
,
classpath
,
jvm_opts_list
,
logdir
=
None
):
if
os
.
environ
[
"JAVA_HOME"
]
is
not
None
and
os
.
environ
[
"JAVA_HOME"
]:
prg
=
os
.
path
.
join
(
os
.
environ
[
"JAVA_HOME"
],
"bin"
,
"java"
)
else
:
...
...
@@ -121,7 +121,7 @@ def java(classname, args, classpath, jvm_opts_list):
commandline
.
append
(
classpath
)
commandline
.
append
(
classname
)
commandline
.
extend
(
args
)
return
runProcess
(
commandline
)
return
runProcess
(
commandline
,
logdir
)
def
jar
(
path
):
if
os
.
environ
[
"JAVA_HOME"
]
is
not
None
and
os
.
environ
[
"JAVA_HOME"
]:
...
...
@@ -153,7 +153,7 @@ def which(program):
return
None
def
runProcess
(
commandline
):
def
runProcess
(
commandline
,
logdir
=
None
):
"""
Run a process
:param commandline: command line
...
...
@@ -161,7 +161,13 @@ def runProcess(commandline):
"""
global
finished
debug
(
"Executing :
%
s"
%
commandline
)
return
subprocess
.
Popen
(
commandline
)
timestr
=
time
.
strftime
(
"metadata.
%
Y
%
m
%
d-
%
H
%
M
%
S"
)
stdoutFile
=
None
stderrFile
=
None
if
logdir
:
stdoutFile
=
open
(
os
.
path
.
join
(
logdir
,
timestr
+
".out"
),
"w"
)
stderrFile
=
open
(
os
.
path
.
join
(
logdir
,
timestr
+
".err"
),
"w"
)
return
subprocess
.
Popen
(
commandline
,
stdout
=
stdoutFile
,
stderr
=
stderrFile
)
def
print_output
(
name
,
src
,
toStdErr
):
"""
...
...
This diff is collapsed.
Click to expand it.
src/bin/metadata_start.py
View file @
a7483fee
...
...
@@ -64,7 +64,7 @@ def main():
args
=
[
"-app"
,
os
.
path
.
join
(
web_app_dir
,
"metadata"
)]
args
.
extend
(
sys
.
argv
[
1
:])
process
=
mc
.
java
(
"org.apache.hadoop.metadata.Main"
,
args
,
metadata_classpath
,
jvm_opts_list
)
process
=
mc
.
java
(
"org.apache.hadoop.metadata.Main"
,
args
,
metadata_classpath
,
jvm_opts_list
,
logdir
)
mc
.
writePid
(
metadata_pid_file
,
process
)
print
"Metadata Server started!!!
\n
"
...
...
This diff is collapsed.
Click to expand it.
src/test/python/scripts/TestMetadata.py
View file @
a7483fee
...
...
@@ -50,13 +50,13 @@ class TestMetadata(unittest.TestCase):
'org.apache.hadoop.metadata.Main'
,
[
'-app'
,
'metadata_home/server/webapp/metadata'
],
'metadata_home/conf:metadata_home/server/webapp/metadata/WEB-INF/classes:metadata_home/server/webapp/metadata/WEB-INF/lib
\\
*:metadata_home/libext
\\
*'
,
[
'-Dmetadata.log.dir=metadata_home/logs'
,
'-Dmetadata.log.file=application.log'
,
'-Dmetadata.home=metadata_home'
,
'-Dmetadata.conf=metadata_home/conf'
,
'-Xmx1024m'
])
[
'-Dmetadata.log.dir=metadata_home/logs'
,
'-Dmetadata.log.file=application.log'
,
'-Dmetadata.home=metadata_home'
,
'-Dmetadata.conf=metadata_home/conf'
,
'-Xmx1024m'
]
,
'metadata_home/logs'
)
else
:
java_mock
.
assert_called_with
(
'org.apache.hadoop.metadata.Main'
,
[
'-app'
,
'metadata_home/server/webapp/metadata'
],
'metadata_home/conf:metadata_home/server/webapp/metadata/WEB-INF/classes:metadata_home/server/webapp/metadata/WEB-INF/lib/*:metadata_home/libext/*'
,
[
'-Dmetadata.log.dir=metadata_home/logs'
,
'-Dmetadata.log.file=application.log'
,
'-Dmetadata.home=metadata_home'
,
'-Dmetadata.conf=metadata_home/conf'
,
'-Xmx1024m'
])
[
'-Dmetadata.log.dir=metadata_home/logs'
,
'-Dmetadata.log.file=application.log'
,
'-Dmetadata.home=metadata_home'
,
'-Dmetadata.conf=metadata_home/conf'
,
'-Xmx1024m'
]
,
'metadata_home/logs'
)
pass
...
...
This diff is collapsed.
Click to expand it.
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