Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMADL2CPP
Commits
c1a5dd3d
Commit
c1a5dd3d
authored
Jan 30, 2019
by
Christopher Jan-Steffen Brix
Browse files
Simplified training logic
parent
011a5882
Pipeline
#101355
failed with stages
in 1 minute and 6 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/emadl/generator/EMADLGenerator.java
View file @
c1a5dd3d
...
...
@@ -225,28 +225,22 @@ public class EMADLGenerator {
String
trainingPath
=
getGenerationTargetPath
()
+
trainerScriptName
;
String
pythonExe
=
"/usr/bin/python"
;
if
(
Files
.
exists
(
Paths
.
get
(
trainingPath
))){
try
{
ProcessBuilder
pb
=
new
ProcessBuilder
(
Arrays
.
asList
(
pythonExe
,
trainingPath
));
ProcessBuilder
pb
=
new
ProcessBuilder
(
Arrays
.
asList
(
pythonExe
,
trainingPath
)).
inheritIO
();
Process
p
=
pb
.
start
();
BufferedReader
bfr1
=
new
BufferedReader
(
new
InputStreamReader
(
p
.
getInputStream
()));
BufferedReader
bfr2
=
new
BufferedReader
(
new
InputStreamReader
(
p
.
getErrorStream
()));
String
line
=
""
;
System
.
out
.
println
(
"Starting training of "
+
trainConfigFilename
);
int
exitCode
=
p
.
waitFor
();
System
.
out
.
println
(
"Exit Code : "
+
exitCode
);
line
=
bfr1
.
readLine
();
System
.
out
.
println
(
"First Line: "
+
line
);
while
(
line
!=
null
){
System
.
out
.
println
(
line
);
line
=
bfr1
.
readLine
();
int
exitCode
=
0
;
try
{
exitCode
=
p
.
waitFor
();
}
line
=
bfr2
.
readLine
();
while
(
line
!=
null
){
System
.
out
.
println
(
line
);
line
=
bfr2
.
readLine
();
catch
(
InterruptedException
e
)
{
//throw new Exception("Error: Training aborted" + e.toString());
System
.
out
.
println
(
"Error: Training aborted"
+
e
.
toString
());
}
if
(
exitCode
!=
0
)
{
//throw new Exception("Error: Training error");
System
.
out
.
println
(
"Error: Training failed"
+
Integer
.
toString
(
exitCode
));
}
}
catch
(
Exception
e
){
System
.
out
.
println
(
e
);}
}
else
{
System
.
out
.
println
(
"Trainingfile not found."
);}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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