Skip to content

Commit

Permalink
Improve redirection of logs
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Mar 23, 2017
1 parent a2f53d6 commit ac21d5c
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/main/java/org/hobbit/podigg/PodiggGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,21 @@ public class PodiggGenerator extends AbstractComponent {

public static final String DEFAULT_QUEUE_NAME = "hobbit.podigg.queuename";

protected void generate() throws Exception {
// Call the generator
FileUtils.forceMkdir(new File("output_data"));
String memory = System.getenv().getOrDefault("NODE_MEM", "2056");
ProcessBuilder processBuilder = new ProcessBuilder("node", "--max_old_space_size=" + memory, "bin/generate-env", "output_data");
processBuilder.inheritIO();
processBuilder.start().waitFor();
}

@Override
public void run() throws Exception {
String queueName = System.getenv().getOrDefault(Constants.DATA_QUEUE_NAME_KEY, DEFAULT_QUEUE_NAME);
SimpleFileSender sender = SimpleFileSender.create(this, queueName);

// Call the generator
FileUtils.forceMkdir(new File("output_data"));
String memory = System.getenv().getOrDefault("NODE_MEM", "2056");
Process process = Runtime.getRuntime().exec("node --harmony_destructuring --max_old_space_size=" + memory + " bin/generate-env output_data");
process.waitFor();
System.err.println(IOUtils.toString(process.getErrorStream()));
System.out.println(IOUtils.toString(process.getInputStream()));
generate();

// Forward the output
InputStream is = new FileInputStream("output_data/lc.ttl");
Expand All @@ -42,4 +45,8 @@ public void run() throws Exception {
IOUtils.closeQuietly(is);
}
}

public static void main(String[] args) throws Exception {
new PodiggGenerator().generate();
}
}

0 comments on commit ac21d5c

Please sign in to comment.