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
c8eaeb92
Commit
c8eaeb92
authored
Jan 22, 2019
by
nilsfreyer
Browse files
added task 5 auto train
parent
e4c6eff0
Pipeline
#99126
passed with stages
in 5 minutes and 1 second
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/emadl/generator/EMADLGenerator.java
View file @
c8eaeb92
...
...
@@ -44,14 +44,13 @@ import de.se_rwth.commons.Splitters;
import
de.se_rwth.commons.logging.Log
;
import
freemarker.template.TemplateException
;
import
java.io.
IOException
;
import
java.io.
*
;
import
java.nio.charset.Charset
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.*
;
import
java.io.InputStream
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.DigestInputStream
;
...
...
@@ -180,6 +179,25 @@ public class EMADLGenerator {
}
else
{
System
.
out
.
println
(
"Not trained yet"
);
String
trainingPath
=
getGenerationTargetPath
()
+
trainerScriptName
;
String
pythonExe
=
"/usr/bin/python"
;
if
(
Files
.
exists
(
Paths
.
get
(
trainingPath
))){
try
{
ProcessBuilder
pb
=
new
ProcessBuilder
(
Arrays
.
asList
(
pythonExe
,
trainingPath
));
Process
p
=
pb
.
start
();
BufferedReader
bfr
=
new
BufferedReader
(
new
InputStreamReader
(
p
.
getInputStream
()));
String
line
=
""
;
System
.
out
.
println
(
"Starting training of "
+
trainConfigFilename
);
int
exitCode
=
p
.
waitFor
();
System
.
out
.
println
(
"Exit Code : "
+
exitCode
);
line
=
bfr
.
readLine
();
System
.
out
.
println
(
"First Line: "
+
line
);
while
((
line
=
bfr
.
readLine
())
!=
null
){
System
.
out
.
println
(
"python output:"
+
line
);
}
}
catch
(
Exception
e
){
System
.
out
.
println
(
e
);}
}
else
{
System
.
out
.
println
(
"Trainingfile not found."
);}
}
fileContents
.
add
(
new
FileContent
(
trainingHash
,
componentConfigFilename
+
".training_hash"
));
...
...
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