[ 
https://issues.apache.org/jira/browse/APEXCORE-411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15233057#comment-15233057
 ] 

ASF GitHub Bot commented on APEXCORE-411:
-----------------------------------------

Github user tweise commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/294#discussion_r59096681
  
    --- 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<URL> clUrls = new LinkedHashSet<>();
    --- End diff --
    
    Should just add a comment that this is necessary to construct the class 
loader because during launch it needs to update the serialized state with new 
app id. This may become unnecessary if we don't relay on object serialization 
for this in the future. 


> Restart app without specifying app package
> ------------------------------------------
>
>                 Key: APEXCORE-411
>                 URL: https://issues.apache.org/jira/browse/APEXCORE-411
>             Project: Apache Apex Core
>          Issue Type: New Feature
>            Reporter: David Yan
>            Assignee: David Yan
>             Fix For: 3.4.0
>
>
> In the CLI, the launch command with -originalAppId requires the specification 
> of the app package.  This should be made optional because the app directory 
> of the original app already contains the jar files necessary to restart the 
> app.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to