From dev-return-16878-archive-asf-public=cust-asf.ponee.io@reef.apache.org Mon Jun 18 23:55:08 2018 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 22E4B180663 for ; Mon, 18 Jun 2018 23:55:06 +0200 (CEST) Received: (qmail 54223 invoked by uid 500); 18 Jun 2018 21:55:06 -0000 Mailing-List: contact dev-help@reef.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@reef.apache.org Delivered-To: mailing list dev@reef.apache.org Received: (qmail 54212 invoked by uid 99); 18 Jun 2018 21:55:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jun 2018 21:55:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id CB3631807BF for ; Mon, 18 Jun 2018 21:55:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.511 X-Spam-Level: X-Spam-Status: No, score=-109.511 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id zbrF7bigIk4h for ; Mon, 18 Jun 2018 21:55:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id E5E235FB46 for ; Mon, 18 Jun 2018 21:55:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id EC927E0E87 for ; Mon, 18 Jun 2018 21:55:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id A3FD221849 for ; Mon, 18 Jun 2018 21:55:00 +0000 (UTC) Date: Mon, 18 Jun 2018 21:55:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@reef.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (REEF-2025) A new module containing the new Java bridge MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/REEF-2025?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16516= 399#comment-16516399 ]=20 ASF GitHub Bot commented on REEF-2025: -------------------------------------- markusweimer commented on a change in pull request #1466: [REEF-2025] A new= module containing the new Java bridge URL: https://github.com/apache/reef/pull/1466#discussion_r196235692 =20 =20 ########## File path: lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/= bridge/client/DriverServiceLauncher.java ########## @@ -0,0 +1,203 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.reef.bridge.client; + +import com.google.protobuf.util.JsonFormat; +import org.apache.commons.lang.StringUtils; +import org.apache.reef.bridge.driver.launch.IDriverLauncher; +import org.apache.reef.bridge.driver.launch.azbatch.AzureBatchLauncher; +import org.apache.reef.bridge.driver.launch.local.LocalLauncher; +import org.apache.reef.bridge.driver.launch.yarn.YarnLauncher; +import org.apache.reef.bridge.driver.service.IDriverServiceConfigurationPr= ovider; +import org.apache.reef.bridge.driver.service.grpc.GRPCDriverServiceConfigu= rationProvider; +import org.apache.reef.bridge.driver.client.JavaDriverClientLauncher; +import org.apache.reef.bridge.proto.ClientProtocol; +import org.apache.reef.client.LauncherStatus; +import org.apache.reef.runtime.azbatch.AzureBatchClasspathProvider; +import org.apache.reef.runtime.common.files.*; +import org.apache.reef.runtime.common.launch.JavaLaunchCommandBuilder; +import org.apache.reef.runtime.local.LocalClasspathProvider; +import org.apache.reef.runtime.yarn.YarnClasspathProvider; +import org.apache.reef.runtime.yarn.util.YarnConfigurationConstructor; +import org.apache.reef.tang.Configuration; +import org.apache.reef.tang.Injector; +import org.apache.reef.tang.Tang; +import org.apache.reef.tang.exceptions.InjectionException; +import org.apache.reef.tang.formats.ConfigurationSerializer; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Collections; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Driver Service Launcher - main class. + */ +public final class DriverServiceLauncher { + + /** + * Standard Java logger. + */ + private static final Logger LOG =3D Logger.getLogger(DriverServiceLaunch= er.class.getName()); + + private static final Tang TANG =3D Tang.Factory.getTang(); + + /** + * This class should not be instantiated. + */ + private DriverServiceLauncher() { + throw new RuntimeException("Do not instantiate this class!"); + } + + public static LauncherStatus submit( + final ClientProtocol.DriverClientConfiguration driverClientConfigura= tionProto, + final Configuration driverClientConfiguration) + throws InjectionException, IOException { + ClientProtocol.DriverClientConfiguration.Builder builder =3D + ClientProtocol.DriverClientConfiguration.newBuilder(driverClientCo= nfigurationProto); + final File driverClientConfigurationFile =3D File.createTempFile("driv= erclient", ".conf"); + try { + // Write driver client configuration to a file + final Injector driverClientInjector =3D TANG.newInjector(driverClien= tConfiguration); + final ConfigurationSerializer configurationSerializer =3D + driverClientInjector.getInstance(ConfigurationSerializer.class); + configurationSerializer.toFile(driverClientConfiguration, driverClie= ntConfigurationFile); + + // Resolve Runtime ClassPath Provider. + final Configuration runtimeClassPathProvider; + switch (driverClientConfigurationProto.getRuntimeCase()) { + case YARN_RUNTIME: + runtimeClassPathProvider =3D TANG.newConfigurationBuilder() + .bind(RuntimeClasspathProvider.class, YarnClasspathProvider.cl= ass) + .bindConstructor(org.apache.hadoop.yarn.conf.YarnConfiguration= .class, + YarnConfigurationConstructor.class) + .build(); + break; + case LOCAL_RUNTIME: + runtimeClassPathProvider =3D TANG.newConfigurationBuilder() + .bind(RuntimeClasspathProvider.class, LocalClasspathProvider.c= lass) + .build(); + break; + case AZBATCH_RUNTIME: + runtimeClassPathProvider =3D TANG.newConfigurationBuilder() + .bind(RuntimeClasspathProvider.class, AzureBatchClasspathProvi= der.class) + .build(); + break; + default: + throw new RuntimeException("unknown runtime " + driverClientConfig= urationProto.getRuntimeCase()); + } + final Injector runtimeInjector =3D TANG.newInjector(runtimeClassPath= Provider); + final REEFFileNames fileNames =3D runtimeInjector.getInstance(REEFFi= leNames.class); + final ClasspathProvider classpathProvider =3D runtimeInjector.getIns= tance(ClasspathProvider.class); + final List launchCommand =3D new JavaLaunchCommandBuilder(Ja= vaDriverClientLauncher.class, null) + .setConfigurationFilePaths( + Collections.singletonList("./" + fileNames.getLocalFolderPat= h() + "/" + + driverClientConfigurationFile.getName())) + .setJavaPath("java") + .setClassPath(driverClientConfigurationProto.getOperatingSystem(= ) =3D=3D + ClientProtocol.DriverClientConfiguration.OS.WINDOWS ? + StringUtils.join(classpathProvider.getDriverClasspath(), ";"= ) : + StringUtils.join(classpathProvider.getDriverClasspath(), ":"= )) + .build(); + final String cmd =3D StringUtils.join(launchCommand, ' '); + builder.setDriverClientLaunchCommand(cmd); + builder.addLocalFiles(driverClientConfigurationFile.getAbsolutePath(= )); + + return launch(driverClientConfigurationProto); + } finally { + driverClientConfigurationFile.deleteOnExit(); + } + } + + private static IDriverLauncher getLocalDriverServiceLauncher() throws In= jectionException { + final Configuration localJobSubmissionClientConfig =3D TANG.newConfigu= rationBuilder() + .bindImplementation(IDriverLauncher.class, LocalLauncher.class) + .bindImplementation(IDriverServiceConfigurationProvider.class, + GRPCDriverServiceConfigurationProvider.class) + .build(); + return TANG.newInjector(localJobSubmissionClientConfig).getInstance(Lo= calLauncher.class); + } + + + private static IDriverLauncher getYarnDriverServiceLauncher() throws Inj= ectionException { + final Configuration yarnJobSubmissionClientConfig =3D TANG.newConfigur= ationBuilder() + .bindImplementation(IDriverLauncher.class, YarnLauncher.class) + .bindImplementation(IDriverServiceConfigurationProvider.class, + GRPCDriverServiceConfigurationProvider.class) + .build(); + return TANG.newInjector(yarnJobSubmissionClientConfig).getInstance(Yar= nLauncher.class); + } + + private static IDriverLauncher getAzureBatchDriverServiceLauncher() thro= ws InjectionException { + final Configuration azbatchJobSubmissionClientConfig =3D TANG.newConfi= gurationBuilder() + .bindImplementation(IDriverLauncher.class, AzureBatchLauncher.clas= s) + .bindImplementation(IDriverServiceConfigurationProvider.class, + GRPCDriverServiceConfigurationProvider.class) + .build(); + return TANG.newInjector(azbatchJobSubmissionClientConfig).getInstance(= AzureBatchLauncher.class); + } + + private static LauncherStatus launch( + final ClientProtocol.DriverClientConfiguration driverClientConfigura= tionProto) { + try { + switch (driverClientConfigurationProto.getRuntimeCase()) { + case YARN_RUNTIME: + final IDriverLauncher yarnDriverServiceLauncher =3D getYarnDriverS= erviceLauncher(); + return yarnDriverServiceLauncher.launch(driverClientConfigurationP= roto); + case LOCAL_RUNTIME: + final IDriverLauncher localDriverServiceLauncher =3D getLocalDrive= rServiceLauncher(); + return localDriverServiceLauncher.launch(driverClientConfiguration= Proto); + case AZBATCH_RUNTIME: + final IDriverLauncher azureBatchDriverServiceLauncher =3D getAzure= BatchDriverServiceLauncher(); + return azureBatchDriverServiceLauncher.launch(driverClientConfigur= ationProto); + default: + throw new RuntimeException("Unknown runtime"); + } + } catch (final InjectionException ex) { + LOG.log(Level.SEVERE, "Job configuration error", ex); + throw new RuntimeException(ex); + } + } + + /** + * Main method that launches the REEF job. =20 Review comment: Does this launch the job or the driver? ---------------------------------------------------------------- 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. =20 For queries about this service, please contact Infrastructure at: users@infra.apache.org > A new module containing the new Java bridge > ------------------------------------------- > > Key: REEF-2025 > URL: https://issues.apache.org/jira/browse/REEF-2025 > Project: REEF > Issue Type: Sub-task > Components: REEF Bridge > Affects Versions: 0.17 > Reporter: Tyson Condie > Assignee: Tyson Condie > Priority: Major > Fix For: 0.17 > > > This Jira introduces the module containing the new bridge.=C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)