From notifications-return-101-archive-asf-public=cust-asf.ponee.io@nemo.apache.org Wed Feb 13 10:33:16 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id B07F21807AA for ; Wed, 13 Feb 2019 11:33:15 +0100 (CET) Received: (qmail 77711 invoked by uid 500); 13 Feb 2019 10:33:14 -0000 Mailing-List: contact notifications-help@nemo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@nemo.apache.org Delivered-To: mailing list notifications@nemo.apache.org Received: (qmail 77701 invoked by uid 99); 13 Feb 2019 10:33:14 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Feb 2019 10:33:14 +0000 From: GitBox To: notifications@nemo.apache.org Subject: [GitHub] wynot12 commented on a change in pull request #192: [NEMO-335] DB for storing metrics Message-ID: <155005399430.14071.9817529205292589363.gitbox@gitbox.apache.org> Date: Wed, 13 Feb 2019 10:33:14 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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_r256302933 ########## 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() { Review comment: ```suggestion public void saveOptimizationMetrics() { if (remoteDBConfigured) { saveToRemoteDB() } else { saveToLocalDB() } } ``` ---------------------------------------------------------------- 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