/** * Writes out the workflow metrics file in the submit directory * * @param metrics the metrics to be written out. * @return the path to metrics file in the submit directory * @throws IOException in case of error while writing out file. */ private File writeOutMetricsFile(PlannerMetrics metrics) throws IOException { if (metrics == null) { throw new IOException("NULL Metrics passed"); } // create a writer to the braindump.txt in the directory. File f = metrics.getMetricsFileLocationInSubmitDirectory(); if (f == null) { throw new IOException("The metrics file location is not yet initialized"); } PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(f))); writer.println(metrics.toPrettyJson()); writer.write("\n"); writer.close(); return f; }