Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A16AA200D23 for ; Thu, 19 Oct 2017 19:49:25 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9FEC31609EE; Thu, 19 Oct 2017 17:49:25 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 182331609D7 for ; Thu, 19 Oct 2017 19:49:24 +0200 (CEST) Received: (qmail 85791 invoked by uid 500); 19 Oct 2017 17:49:24 -0000 Mailing-List: contact dev-help@gearpump.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@gearpump.incubator.apache.org Delivered-To: mailing list dev@gearpump.incubator.apache.org Delivered-To: moderator for dev@gearpump.incubator.apache.org Received: (qmail 71141 invoked by uid 99); 19 Oct 2017 05:13:13 -0000 X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.02 X-Spam-Level: X-Spam-Status: No, score=-4.02 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled From: manuzhang To: dev@gearpump.incubator.apache.org Reply-To: dev@gearpump.incubator.apache.org References: In-Reply-To: Subject: [GitHub] incubator-gearpump pull request #231: [GEARPUMP-355] Fix YarnAppMaster addre... Content-Type: text/plain Message-Id: <20171019051308.7FBD7DF9F1@git1-us-west.apache.org> Date: Thu, 19 Oct 2017 05:13:08 +0000 (UTC) archived-at: Thu, 19 Oct 2017 17:49:25 -0000 Github user manuzhang commented on a diff in the pull request: https://github.com/apache/incubator-gearpump/pull/231#discussion_r145601399 --- Diff: experiments/yarn/src/main/scala/org/apache/gearpump/experiments/yarn/client/AppMasterResolver.scala --- @@ -75,3 +64,38 @@ class AppMasterResolver(yarnClient: YarnClient, system: ActorSystem) { result } } + +object AppMasterResolver { + + val LOG = LogUtil.getLogger(getClass) + + def resolveAppMasterAddress(report: ApplicationReport, system: ActorSystem): ActorRef = { + val appMasterPath = s"${report.getOriginalTrackingUrl}" + "supervisor-actor-path" + LOG.info(s"appMasterPath=$appMasterPath") + + val connectionFactory: URLConnectionFactory = URLConnectionFactory + .newDefaultURLConnectionFactory(new YarnConfiguration()) + val url: URL = new URL(appMasterPath) + val connection: HttpURLConnection = connectionFactory.openConnection(url) + .asInstanceOf[HttpURLConnection] + connection.setInstanceFollowRedirects(true) + connection.connect() + val status = connection.getResponseCode + + var stream: java.io.InputStream = connection.getErrorStream + if(stream == null) { + stream = connection.getInputStream + } + if(status == 200) { --- End diff -- fix style: need a space before `(` ---