{"action":"created","comment":{"url":"https://api.github.com/repos/h2oai/sparkling-water/pulls/comments/88987306","pull_request_review_id":9541754,"id":88987306,"diff_hunk":"@@ -0,0 +1,138 @@\n+/*\n+* Licensed to the Apache Software Foundation (ASF) under one or more\n+* contributor license agreements.  See the NOTICE file distributed with\n+* this work for additional information regarding copyright ownership.\n+* The ASF licenses this file to You under the Apache License, Version 2.0\n+* (the \"License\"); you may not use this file except in compliance with\n+* the License.  You may obtain a copy of the License at\n+*\n+*    http://www.apache.org/licenses/LICENSE-2.0\n+*\n+* Unless required by applicable law or agreed to in writing, software\n+* distributed under the License is distributed on an \"AS IS\" BASIS,\n+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+* See the License for the specific language governing permissions and\n+* limitations under the License.\n+*/\n+\n+package org.apache.spark.h2o.backends.external\n+\n+import org.apache.spark.h2o.H2OConf\n+import org.apache.spark.h2o.backends.SharedH2OConf\n+\n+/**\n+  * External backend configuration\n+  */\n+trait ExternalBackendConf extends SharedH2OConf {\n+  self: H2OConf =>\n+\n+  import ExternalBackendConf._\n+\n+  def h2oCluster = sparkConf.getOption(PROP_EXTERNAL_CLUSTER_REPRESENTATIVE._1)\n+  def YARNQueue = sparkConf.getOption(PROP_EXTERNAL_CLUSTER_YARN_QUEUE._1)\n+  def h2oDriverPath = sparkConf.getOption(PROP_EXTERNAL_CLUSTER_H2O_DRIVER._1)\n+  def numOfExternalH2ONodes = sparkConf.getOption(PROP_EXTERNAL_H2O_NODES._1)\n+  def HDFSOutputDir = sparkConf.getOption(PROP_EXTERNAL_CLUSTER_HDFS_DIR._1)\n+  def mapperXmx = sparkConf.get(PROP_EXTERNAL_H2O_MEMORY._1, PROP_EXTERNAL_H2O_MEMORY._2)\n+\n+\n+  /**\n+    * Sets node and port representing H2O Cluster to which should H2O connect when started in external mode.\n+    * This method automatically sets external cluster mode\n+    *\n+    * @param host host representing the cluster\n+    * @param port port representing the cluster\n+    * @return H2O Configuration\n+    */\n+  def setH2OCluster(host: String, port: Int): H2OConf = {\n+    setExternalClusterMode()\n+    sparkConf.set(PROP_EXTERNAL_CLUSTER_REPRESENTATIVE._1, host + \":\" + port)\n+    self\n+  }\n+\n+  def setH2OCluster(hostPort: String): H2OConf = {\n+    setExternalClusterMode()\n+    sparkConf.set(PROP_EXTERNAL_CLUSTER_REPRESENTATIVE._1, hostPort)\n+    self\n+  }\n+\n+  def h2oClusterHost = {\n+    val value = sparkConf.getOption(PROP_EXTERNAL_CLUSTER_REPRESENTATIVE._1)\n+    if (value.isDefined) {\n+      Option(value.get.split(\":\")(0))\n+    } else {\n+      None\n+    }\n+  }\n+\n+  def h2oClusterPort = {\n+    val value = sparkConf.getOption(PROP_EXTERNAL_CLUSTER_REPRESENTATIVE._1)\n+    if (value.isDefined) {\n+      Option(value.get.split(\":\")(1))\n+    } else {\n+      None\n+    }\n+  }\n+\n+\n+  def setYARNQueue(queueName: String) = {\n+    sparkConf.set(PROP_EXTERNAL_CLUSTER_YARN_QUEUE._1, queueName)\n+    self\n+  }\n+\n+  def setH2ODriverPath(path: String): H2OConf = {\n+    setExternalClusterMode()\n+    logWarning(\"Using external cluster mode\")\n+    sparkConf.set(PROP_EXTERNAL_CLUSTER_H2O_DRIVER._1, path)\n+    self\n+  }\n+\n+  def setNumOfExternalH2ONodes(numOfExternalH2ONodes: Int): H2OConf = {\n+    sparkConf.set(PROP_EXTERNAL_H2O_NODES._1, numOfExternalH2ONodes.toString)\n+    self\n+  }\n+\n+  def setHDFSOutputDir(dir: String): H2OConf = {\n+    sparkConf.set(PROP_EXTERNAL_CLUSTER_HDFS_DIR._1, dir)\n+    self\n+  }\n+\n+\n+  def setMapperXmx(mem: String): H2OConf = {\n+    sparkConf.set(PROP_EXTERNAL_H2O_MEMORY._1, mem)\n+    self\n+  }\n+\n+\n+  def externalConfString: String =\n+    s\"\"\"Sparkling Water configuration:\n+        |  backend cluster mode : ${backendClusterMode}\n+        |  cloudName            : ${cloudName.getOrElse(\"Not set yet\")}\n+        |  cloud representative : ${h2oCluster.getOrElse(\"Not set, using cloud name only\")}\n+        |  clientBasePort       : ${clientBasePort}\n+        |  h2oClientLog         : ${h2oClientLogLevel}\n+        |  nthreads             : ${nthreads}\"\"\".stripMargin\n+}\n+\n+object ExternalBackendConf {\n+\n+  val PROP_EXTERNAL_H2O_MEMORY = (\"spark.ext.h2o.hadoop.memory\", \"6g\")\n+\n+  val PROP_EXTERNAL_CLUSTER_HDFS_DIR = (\"spark.ext.h2o.external.hdfs.dir\", null.asInstanceOf[String])","path":"core/src/main/scala/org/apache/spark/h2o/backends/external/ExternalBackendConf.scala","position":121,"original_position":121,"commit_id":"b16700baedc1c23995f0c4622a49d2391099cac6","original_commit_id":"b16700baedc1c23995f0c4622a49d2391099cac6","user":{"login":"jakubhava","id":4374603,"avatar_url":"https://avatars.githubusercontent.com/u/4374603?v=3","gravatar_id":"","url":"https://api.github.com/users/jakubhava","html_url":"https://github.com/jakubhava","followers_url":"https://api.github.com/users/jakubhava/followers","following_url":"https://api.github.com/users/jakubhava/following{/other_user}","gists_url":"https://api.github.com/users/jakubhava/gists{/gist_id}","starred_url":"https://api.github.com/users/jakubhava/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakubhava/subscriptions","organizations_url":"https://api.github.com/users/jakubhava/orgs","repos_url":"https://api.github.com/users/jakubhava/repos","events_url":"https://api.github.com/users/jakubhava/events{/privacy}","received_events_url":"https://api.github.com/users/jakubhava/received_events","type":"User","site_admin":false},"body":"I would like to use null for the sake of consistency with rest of the configuration properties at least as part of this change. I'm open up to eliminating `null`s as part of another commit targeting particularly this change. ","created_at":"2016-11-21T21:04:43Z","updated_at":"2016-11-21T21:04:43Z","html_url":"https://github.com/h2oai/sparkling-water/pull/87#discussion_r88987306","pull_request_url":"https://api.github.com/repos/h2oai/sparkling-water/pulls/87","_links":{"self":{"href":"https://api.github.com/repos/h2oai/sparkling-water/pulls/comments/88987306"},"html":{"href":"https://github.com/h2oai/sparkling-water/pull/87#discussion_r88987306"},"pull_request":{"href":"https://api.github.com/repos/h2oai/sparkling-water/pulls/87"}}},"pull_request":{"url":"https://api.github.com/repos/h2oai/sparkling-water/pulls/87","id":86884980,"html_url":"https://github.com/h2oai/sparkling-water/pull/87","diff_url":"https://github.com/h2oai/sparkling-water/pull/87.diff","patch_url":"https://github.com/h2oai/sparkling-water/pull/87.patch","issue_url":"https://api.github.com/repos/h2oai/sparkling-water/issues/87","number":87,"state":"open","locked":false,"title":"External cluster implementation","user":{"login":"jakubhava","id":4374603,"avatar_url":"https://avatars.githubusercontent.com/u/4374603?v=3","gravatar_id":"","url":"https://api.github.com/users/jakubhava","html_url":"https://github.com/jakubhava","followers_url":"https://api.github.com/users/jakubhava/followers","following_url":"https://api.github.com/users/jakubhava/following{/other_user}","gists_url":"https://api.github.com/users/jakubhava/gists{/gist_id}","starred_url":"https://api.github.com/users/jakubhava/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakubhava/subscriptions","organizations_url":"https://api.github.com/users/jakubhava/orgs","repos_url":"https://api.github.com/users/jakubhava/repos","events_url":"https://api.github.com/users/jakubhava/events{/privacy}","received_events_url":"https://api.github.com/users/jakubhava/received_events","type":"User","site_admin":false},"body":"- implements core external cluster functionality\n- add support for testing external cluster locally with existing tests\n- add support to start h2o instances on yarn from sparkling-water\n","created_at":"2016-09-27T08:41:11Z","updated_at":"2016-11-21T21:04:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"690d675aa8f9d87be293c7c9f8758beab2ce8481","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/h2oai/sparkling-water/pulls/87/commits","review_comments_url":"https://api.github.com/repos/h2oai/sparkling-water/pulls/87/comments","review_comment_url":"https://api.github.com/repos/h2oai/sparkling-water/pulls/comments{/number}","comments_url":"https://api.github.com/repos/h2oai/sparkling-water/issues/87/comments","statuses_url":"https://api.github.com/repos/h2oai/sparkling-water/statuses/b16700baedc1c23995f0c4622a49d2391099cac6","head":{"label":"h2oai:JH_SW-178_external_cluster","ref":"JH_SW-178_external_cluster","sha":"b16700baedc1c23995f0c4622a49d2391099cac6","user":{"login":"h2oai","id":1402695,"avatar_url":"https://avatars.githubusercontent.com/u/1402695?v=3","gravatar_id":"","url":"https://api.github.com/users/h2oai","html_url":"https://github.com/h2oai","followers_url":"https://api.github.com/users/h2oai/followers","following_url":"https://api.github.com/users/h2oai/following{/other_user}","gists_url":"https://api.github.com/users/h2oai/gists{/gist_id}","starred_url":"https://api.github.com/users/h2oai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/h2oai/subscriptions","organizations_url":"https://api.github.com/users/h2oai/orgs","repos_url":"https://api.github.com/users/h2oai/repos","events_url":"https://api.github.com/users/h2oai/events{/privacy}","received_events_url":"https://api.github.com/users/h2oai/received_events","type":"Organization","site_admin":false},"repo":{"id":25181584,"name":"sparkling-water","full_name":"h2oai/sparkling-water","owner":{"login":"h2oai","id":1402695,"avatar_url":"https://avatars.githubusercontent.com/u/1402695?v=3","gravatar_id":"","url":"https://api.github.com/users/h2oai","html_url":"https://github.com/h2oai","followers_url":"https://api.github.com/users/h2oai/followers","following_url":"https://api.github.com/users/h2oai/following{/other_user}","gists_url":"https://api.github.com/users/h2oai/gists{/gist_id}","starred_url":"https://api.github.com/users/h2oai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/h2oai/subscriptions","organizations_url":"https://api.github.com/users/h2oai/orgs","repos_url":"https://api.github.com/users/h2oai/repos","events_url":"https://api.github.com/users/h2oai/events{/privacy}","received_events_url":"https://api.github.com/users/h2oai/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/h2oai/sparkling-water","description":"Sparkling Water provides H2O functionality inside Spark cluster","fork":false,"url":"https://api.github.com/repos/h2oai/sparkling-water","forks_url":"https://api.github.com/repos/h2oai/sparkling-water/forks","keys_url":"https://api.github.com/repos/h2oai/sparkling-water/keys{/key_id}","collaborators_url":"https://api.github.com/repos/h2oai/sparkling-water/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/h2oai/sparkling-water/teams","hooks_url":"https://api.github.com/repos/h2oai/sparkling-water/hooks","issue_events_url":"https://api.github.com/repos/h2oai/sparkling-water/issues/events{/number}","events_url":"https://api.github.com/repos/h2oai/sparkling-water/events","assignees_url":"https://api.github.com/repos/h2oai/sparkling-water/assignees{/user}","branches_url":"https://api.github.com/repos/h2oai/sparkling-water/branches{/branch}","tags_url":"https://api.github.com/repos/h2oai/sparkling-water/tags","blobs_url":"https://api.github.com/repos/h2oai/sparkling-water/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/h2oai/sparkling-water/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/h2oai/sparkling-water/git/refs{/sha}","trees_url":"https://api.github.com/repos/h2oai/sparkling-water/git/trees{/sha}","statuses_url":"https://api.github.com/repos/h2oai/sparkling-water/statuses/{sha}","languages_url":"https://api.github.com/repos/h2oai/sparkling-water/languages","stargazers_url":"https://api.github.com/repos/h2oai/sparkling-water/stargazers","contributors_url":"https://api.github.com/repos/h2oai/sparkling-water/contributors","subscribers_url":"https://api.github.com/repos/h2oai/sparkling-water/subscribers","subscription_url":"https://api.github.com/repos/h2oai/sparkling-water/subscription","commits_url":"https://api.github.com/repos/h2oai/sparkling-water/commits{/sha}","git_commits_url":"https://api.github.com/repos/h2oai/sparkling-water/git/commits{/sha}","comments_url":"https://api.github.com/repos/h2oai/sparkling-water/comments{/number}","issue_comment_url":"https://api.github.com/repos/h2oai/sparkling-water/issues/comments{/number}","contents_url":"https://api.github.com/repos/h2oai/sparkling-water/contents/{+path}","compare_url":"https://api.github.com/repos/h2oai/sparkling-water/compare/{base}...{head}","merges_url":"https://api.github.com/repos/h2oai/sparkling-water/merges","archive_url":"https://api.github.com/repos/h2oai/sparkling-water/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/h2oai/sparkling-water/downloads","issues_url":"https://api.github.com/repos/h2oai/sparkling-water/issues{/number}","pulls_url":"https://api.github.com/repos/h2oai/sparkling-water/pulls{/number}","milestones_url":"https://api.github.com/repos/h2oai/sparkling-water/milestones{/number}","notifications_url":"https://api.github.com/repos/h2oai/sparkling-water/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/h2oai/sparkling-water/labels{/name}","releases_url":"https://api.github.com/repos/h2oai/sparkling-water/releases{/id}","deployments_url":"https://api.github.com/repos/h2oai/sparkling-water/deployments","created_at":"2014-10-13T23:06:35Z","updated_at":"2016-11-21T15:34:06Z","pushed_at":"2016-11-21T14:44:12Z","git_url":"git://github.com/h2oai/sparkling-water.git","ssh_url":"git@github.com:h2oai/sparkling-water.git","clone_url":"https://github.com/h2oai/sparkling-water.git","svn_url":"https://github.com/h2oai/sparkling-water","homepage":"","size":13616,"stargazers_count":410,"watchers_count":410,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":171,"mirror_url":null,"open_issues_count":19,"forks":171,"open_issues":19,"watchers":410,"default_branch":"master"}},"base":{"label":"h2oai:master","ref":"master","sha":"215d36e78dcf61354b2bb98002fe39f1b521f145","user":{"login":"h2oai","id":1402695,"avatar_url":"https://avatars.githubusercontent.com/u/1402695?v=3","gravatar_id":"","url":"https://api.github.com/users/h2oai","html_url":"https://github.com/h2oai","followers_url":"https://api.github.com/users/h2oai/followers","following_url":"https://api.github.com/users/h2oai/following{/other_user}","gists_url":"https://api.github.com/users/h2oai/gists{/gist_id}","starred_url":"https://api.github.com/users/h2oai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/h2oai/subscriptions","organizations_url":"https://api.github.com/users/h2oai/orgs","repos_url":"https://api.github.com/users/h2oai/repos","events_url":"https://api.github.com/users/h2oai/events{/privacy}","received_events_url":"https://api.github.com/users/h2oai/received_events","type":"Organization","site_admin":false},"repo":{"id":25181584,"name":"sparkling-water","full_name":"h2oai/sparkling-water","owner":{"login":"h2oai","id":1402695,"avatar_url":"https://avatars.githubusercontent.com/u/1402695?v=3","gravatar_id":"","url":"https://api.github.com/users/h2oai","html_url":"https://github.com/h2oai","followers_url":"https://api.github.com/users/h2oai/followers","following_url":"https://api.github.com/users/h2oai/following{/other_user}","gists_url":"https://api.github.com/users/h2oai/gists{/gist_id}","starred_url":"https://api.github.com/users/h2oai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/h2oai/subscriptions","organizations_url":"https://api.github.com/users/h2oai/orgs","repos_url":"https://api.github.com/users/h2oai/repos","events_url":"https://api.github.com/users/h2oai/events{/privacy}","received_events_url":"https://api.github.com/users/h2oai/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/h2oai/sparkling-water","description":"Sparkling Water provides H2O functionality inside Spark cluster","fork":false,"url":"https://api.github.com/repos/h2oai/sparkling-water","forks_url":"https://api.github.com/repos/h2oai/sparkling-water/forks","keys_url":"https://api.github.com/repos/h2oai/sparkling-water/keys{/key_id}","collaborators_url":"https://api.github.com/repos/h2oai/sparkling-water/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/h2oai/sparkling-water/teams","hooks_url":"https://api.github.com/repos/h2oai/sparkling-water/hooks","issue_events_url":"https://api.github.com/repos/h2oai/sparkling-water/issues/events{/number}","events_url":"https://api.github.com/repos/h2oai/sparkling-water/events","assignees_url":"https://api.github.com/repos/h2oai/sparkling-water/assignees{/user}","branches_url":"https://api.github.com/repos/h2oai/sparkling-water/branches{/branch}","tags_url":"https://api.github.com/repos/h2oai/sparkling-water/tags","blobs_url":"https://api.github.com/repos/h2oai/sparkling-water/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/h2oai/sparkling-water/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/h2oai/sparkling-water/git/refs{/sha}","trees_url":"https://api.github.com/repos/h2oai/sparkling-water/git/trees{/sha}","statuses_url":"https://api.github.com/repos/h2oai/sparkling-water/statuses/{sha}","languages_url":"https://api.github.com/repos/h2oai/sparkling-water/languages","stargazers_url":"https://api.github.com/repos/h2oai/sparkling-water/stargazers","contributors_url":"https://api.github.com/repos/h2oai/sparkling-water/contributors","subscribers_url":"https://api.github.com/repos/h2oai/sparkling-water/subscribers","subscription_url":"https://api.github.com/repos/h2oai/sparkling-water/subscription","commits_url":"https://api.github.com/repos/h2oai/sparkling-water/commits{/sha}","git_commits_url":"https://api.github.com/repos/h2oai/sparkling-water/git/commits{/sha}","comments_url":"https://api.github.com/repos/h2oai/sparkling-water/comments{/number}","issue_comment_url":"https://api.github.com/repos/h2oai/sparkling-water/issues/comments{/number}","contents_url":"https://api.github.com/repos/h2oai/sparkling-water/contents/{+path}","compare_url":"https://api.github.com/repos/h2oai/sparkling-water/compare/{base}...{head}","merges_url":"https://api.github.com/repos/h2oai/sparkling-water/merges","archive_url":"https://api.github.com/repos/h2oai/sparkling-water/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/h2oai/sparkling-water/downloads","issues_url":"https://api.github.com/repos/h2oai/sparkling-water/issues{/number}","pulls_url":"https://api.github.com/repos/h2oai/sparkling-water/pulls{/number}","milestones_url":"https://api.github.com/repos/h2oai/sparkling-water/milestones{/number}","notifications_url":"https://api.github.com/repos/h2oai/sparkling-water/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/h2oai/sparkling-water/labels{/name}","releases_url":"https://api.github.com/repos/h2oai/sparkling-water/releases{/id}","deployments_url":"https://api.github.com/repos/h2oai/sparkling-water/deployments","created_at":"2014-10-13T23:06:35Z","updated_at":"2016-11-21T15:34:06Z","pushed_at":"2016-11-21T14:44:12Z","git_url":"git://github.com/h2oai/sparkling-water.git","ssh_url":"git@github.com:h2oai/sparkling-water.git","clone_url":"https://github.com/h2oai/sparkling-water.git","svn_url":"https://github.com/h2oai/sparkling-water","homepage":"","size":13616,"stargazers_count":410,"watchers_count":410,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":171,"mirror_url":null,"open_issues_count":19,"forks":171,"open_issues":19,"watchers":410,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/h2oai/sparkling-water/pulls/87"},"html":{"href":"https://github.com/h2oai/sparkling-water/pull/87"},"issue":{"href":"https://api.github.com/repos/h2oai/sparkling-water/issues/87"},"comments":{"href":"https://api.github.com/repos/h2oai/sparkling-water/issues/87/comments"},"review_comments":{"href":"https://api.github.com/repos/h2oai/sparkling-water/pulls/87/comments"},"review_comment":{"href":"https://api.github.com/repos/h2oai/sparkling-water/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/h2oai/sparkling-water/pulls/87/commits"},"statuses":{"href":"https://api.github.com/repos/h2oai/sparkling-water/statuses/b16700baedc1c23995f0c4622a49d2391099cac6"}}}}
{"actor":{"display_login":"jakubhava"}}