Commit c1a5dd3d authored by Christopher Jan-Steffen Brix's avatar Christopher Jan-Steffen Brix
Browse files

Simplified training logic

parent 011a5882
Pipeline #101355 failed with stages
in 1 minute and 6 seconds
......@@ -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.");}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment