Return-Path: X-Original-To: apmail-apex-dev-archive@minotaur.apache.org Delivered-To: apmail-apex-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6F38419BF9 for ; Tue, 5 Apr 2016 18:54:14 +0000 (UTC) Received: (qmail 43698 invoked by uid 500); 5 Apr 2016 18:54:14 -0000 Delivered-To: apmail-apex-dev-archive@apex.apache.org Received: (qmail 43631 invoked by uid 500); 5 Apr 2016 18:54:14 -0000 Mailing-List: contact dev-help@apex.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@apex.incubator.apache.org Delivered-To: mailing list dev@apex.incubator.apache.org Received: (qmail 43620 invoked by uid 99); 5 Apr 2016 18:54:14 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Apr 2016 18:54:14 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id F2521C0227 for ; Tue, 5 Apr 2016 18:54:12 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.021 X-Spam-Level: X-Spam-Status: No, score=-4.021 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] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id aV1-XHcNcKIX for ; Tue, 5 Apr 2016 18:54:11 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 4E5205F19B for ; Tue, 5 Apr 2016 18:54:11 +0000 (UTC) Received: (qmail 43616 invoked by uid 99); 5 Apr 2016 18:54:10 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Apr 2016 18:54:10 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 99649E0211; Tue, 5 Apr 2016 18:54:10 +0000 (UTC) From: davidyan74 To: dev@apex.incubator.apache.org Reply-To: dev@apex.incubator.apache.org References: In-Reply-To: Subject: [GitHub] incubator-apex-core pull request: APEXCORE-411 support restarting ... Content-Type: text/plain Message-Id: <20160405185410.99649E0211@git1-us-west.apache.org> Date: Tue, 5 Apr 2016 18:54:10 +0000 (UTC) Github user davidyan74 commented on a diff in the pull request: https://github.com/apache/incubator-apex-core/pull/294#discussion_r58595340 --- Diff: engine/src/main/java/com/datatorrent/stram/client/StramAppLauncher.java --- @@ -210,14 +239,67 @@ public StramAppLauncher(FileSystem fs, Path path, Configuration conf) throws Exc public StramAppLauncher(String name, Configuration conf) throws Exception { this.propertiesBuilder = new LogicalPlanConfiguration(conf); + this.conf = conf; init(name); } + public StramAppLauncher(FileSystem fs, Configuration conf) throws Exception + { + this.propertiesBuilder = new LogicalPlanConfiguration(conf); + this.fs = fs; + this.conf = conf; + init(); + } + public String getMvnBuildClasspathOutput() { return mvnBuildClasspathOutput.toString(); } + /** + * This is for recovering an app without specifying apa or appjar file + * @throws Exception + */ + private void init() throws Exception + { + String originalAppId = propertiesBuilder.conf.get(ORIGINAL_APP_ID); + if (originalAppId == null) { + throw new AssertionError("Need original app id if launching without apa or appjar"); + } + Path appsBasePath = new Path(StramClientUtils.getDTDFSRootDir(fs, conf), StramClientUtils.SUBDIR_APPS); + Path origAppPath = new Path(appsBasePath, originalAppId); + StringWriter writer = new StringWriter(); + try (FSDataInputStream in = fs.open(new Path(origAppPath, "meta.json"))) { + IOUtils.copy(in, writer); + } + JSONObject metaJson = new JSONObject(writer.toString()); + String originalLibJars = null; + try { + JSONObject attributes = metaJson.getJSONObject("attributes"); + originalLibJars = attributes.getString(LogicalPlan.LIBRARY_JARS.getSimpleName()); + recoveryAppName = attributes.getString(Context.DAGContext.APPLICATION_NAME.getSimpleName()); + } catch (JSONException ex) { + // ignore + } + + LinkedHashSet clUrls = new LinkedHashSet<>(); --- End diff -- That was what I thought too. But StramClient.copyInitialState itself needs all the operator classes to be loaded before we can even launch. Here's the exception stack trace if you remove all that code: {code} com.esotericsoftware.kryo.KryoException: Unable to find class: com.datatorrent.lib.testbench.RandomEventGenerator at com.esotericsoftware.kryo.util.DefaultClassResolver.readName(DefaultClassResolver.java:138) at com.esotericsoftware.kryo.util.DefaultClassResolver.readClass(DefaultClassResolver.java:115) at com.esotericsoftware.kryo.Kryo.readClass(Kryo.java:641) at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:752) at com.datatorrent.common.util.FSStorageAgent.retrieve(FSStorageAgent.java:193) at com.datatorrent.stram.plan.logical.LogicalPlan$OperatorMeta.readObject(LogicalPlan.java:857) ... ... at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370) at com.datatorrent.stram.FSRecoveryHandler.restore(FSRecoveryHandler.java:247) at com.datatorrent.stram.StramClient.copyInitialState(StramClient.java:275) at com.datatorrent.stram.StramClient.startApplication(StramClient.java:513) at com.datatorrent.stram.client.StramAppLauncher.launchApp(StramAppLauncher.java:616) at com.datatorrent.stram.cli.DTCli$LaunchCommand.execute(DTCli.java:2067) at com.datatorrent.stram.cli.DTCli$3.run(DTCli.java:1454) {code} --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---