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.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---