nemo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] wynot12 commented on a change in pull request #192: [NEMO-335] DB for storing metrics
Date Wed, 13 Feb 2019 10:33:14 GMT
wynot12 commented on a change in pull request #192: [NEMO-335] DB for storing metrics
URL: https://github.com/apache/incubator-nemo/pull/192#discussion_r256293608
 
 

 ##########
 File path: runtime/master/src/main/java/org/apache/nemo/runtime/master/metric/MetricStore.java
 ##########
 @@ -206,17 +210,106 @@ public synchronized String dumpAllMetricToJson() throws IOException
{
    * @param filePath path to dump JSON.
    */
   public void dumpAllMetricToFile(final String filePath) {
-    try {
+    try (final BufferedWriter writer = new BufferedWriter(new FileWriter(filePath))) {
       final String jsonDump = dumpAllMetricToJson();
-      final BufferedWriter writer = new BufferedWriter(new FileWriter(filePath));
-
       writer.write(jsonDump);
-      writer.close();
     } catch (final IOException e) {
-      throw new RuntimeException(e);
+      throw new MetricException(e);
     }
   }
 
+  /**
+   * Save the job metrics for the optimization to the DB, in the form of LibSVM, to SQLite.
+   * The metrics are as follows: the JCT (duration), and the IR DAG execution properties.
+   */
+  public void saveOptimizationMetricsToSQLite() {
+    final String optimizationDBName = "jdbc:sqlite:" + MetricUtils.fetchProjectRootPath()
+ "/optimization_db.sqlite3";
+    final String[] syntax = {"INTEGER PRIMARY KEY AUTOINCREMENT"};
+
+    try (final Connection c = DriverManager.getConnection(optimizationDBName)) {
+      LOG.info("Opened database successfully at {}", optimizationDBName);
+      saveOptimizationMetrics(c, syntax);
+    } catch (SQLException e) {
+      LOG.error("Error while saving optimization metrics to SQLite: {}", e);
+    }
+  }
+
+  /**
+   * Save the job metrics for the optimization to the DB, in the form of LibSVM, to PostgreSQL.
+   * The metrics are as follows: the JCT (duration), and the IR DAG execution properties.
+   */
+  public void saveOptimizationMetricsToPostgreSQL() {
+    final String optimizationDBName = "jdbc:postgresql://nemo-optimization."
+      + "cabbufr3evny.us-west-2.rds.amazonaws.com:5432/nemo_optimization";
 
 Review comment:
   Shouldn't it be configurable?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message