helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swaroop...@apache.org
Subject git commit: made changes to client to copy appspec
Date Sat, 18 Jan 2014 07:02:03 GMT
Updated Branches:
  refs/heads/helix-provisioning e03a9228c -> ae77f9149


made changes to client to copy appspec


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/ae77f914
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/ae77f914
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/ae77f914

Branch: refs/heads/helix-provisioning
Commit: ae77f9149656fa152e006913f6a710015ff28112
Parents: e03a922
Author: Swaroop <swaroop.aj@gmail.com>
Authored: Fri Jan 17 23:01:53 2014 -0800
Committer: Swaroop <swaroop.aj@gmail.com>
Committed: Fri Jan 17 23:01:53 2014 -0800

----------------------------------------------------------------------
 .../helix/provisioning/yarn/ApplicationSpec.java  |  3 ++-
 .../apache/helix/provisioning/yarn/Client.java    | 18 ++++++++++++++++++
 .../yarn/YamlApplicationSpecFactory.java          | 14 ++++++++++----
 3 files changed, 30 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/ae77f914/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/ApplicationSpec.java
----------------------------------------------------------------------
diff --git a/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/ApplicationSpec.java
b/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/ApplicationSpec.java
index 6773b4a..16b23fa 100644
--- a/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/ApplicationSpec.java
+++ b/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/ApplicationSpec.java
@@ -7,5 +7,6 @@ public interface ApplicationSpec {
 	public int getMinContainers();
 	public int getMaxContainers();
 	public AppConfig getConfig();
-	public List<ServiceConfig> getServices();
+	public List<String> getServices();
+	public ServiceConfig getServiceConfig(String name);
 }

http://git-wip-us.apache.org/repos/asf/helix/blob/ae77f914/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/Client.java
----------------------------------------------------------------------
diff --git a/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/Client.java
b/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/Client.java
index 15b43a6..6611ec6 100644
--- a/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/Client.java
+++ b/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/Client.java
@@ -137,6 +137,8 @@ public class Client {
   private String appMasterArchive = "";
   // Main class to invoke application master
   private final String appMasterMainClass;
+  
+  private String appSpecFile = "";
 
   // No. of containers in which helix participants will be started
   private int numContainers = 1;
@@ -205,6 +207,7 @@ public class Client {
     opts.addOption("master_memory", true,
         "Amount of memory in MB to be requested to run the application master");
     opts.addOption("archive", true, "Archive file containing the app code");
+    opts.addOption("appSpec", true, "Application specification");
     opts.addOption("num_containers", true,
         "No. of containers on which Helix Participants will be launched");
     opts.addOption("log_properties", true, "log4j.properties file");
@@ -368,6 +371,21 @@ public class Client {
     amJarRsrc.setTimestamp(destStatus.getModificationTime());
     amJarRsrc.setSize(destStatus.getLen());
     localResources.put("app-pkg", amJarRsrc);
+    
+    Path localAppSpec = new Path(appSpecFile);
+    pathSuffix = appName + "/" + appId.getId() + "/app-spec.yaml";
+    Path dstAppSpec = new Path(fs.getHomeDirectory(), pathSuffix);
+    fs.copyFromLocalFile(false, true, localAppSpec, dstAppSpec);
+    destStatus = fs.getFileStatus(dst);
+    LocalResource appSpecResource = Records.newRecord(LocalResource.class);
+
+    appSpecResource.setType(LocalResourceType.FILE);
+    appSpecResource.setVisibility(LocalResourceVisibility.APPLICATION);
+    appSpecResource.setResource(ConverterUtils.getYarnUrlFromPath(dstAppSpec));
+    appSpecResource.setTimestamp(destStatus.getModificationTime());
+    appSpecResource.setSize(destStatus.getLen());
+    localResources.put("app-spec", appSpecResource);
+
 
     // Set the log4j properties if needed
     if (!log4jPropFile.isEmpty()) {

http://git-wip-us.apache.org/repos/asf/helix/blob/ae77f914/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/YamlApplicationSpecFactory.java
----------------------------------------------------------------------
diff --git a/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/YamlApplicationSpecFactory.java
b/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/YamlApplicationSpecFactory.java
index 0c50fc0..d5ac2c0 100644
--- a/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/YamlApplicationSpecFactory.java
+++ b/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/YamlApplicationSpecFactory.java
@@ -2,6 +2,7 @@ package org.apache.helix.provisioning.yarn;
 
 import java.io.InputStream;
 import java.util.List;
+import java.util.Map;
 
 import org.yaml.snakeyaml.Yaml;
 
@@ -12,7 +13,8 @@ class DefaultApplicationSpec implements ApplicationSpec {
 	
 	public AppConfig appConfig;
 
-	public List<ServiceConfig> serviceConfig;
+	public List<String> services;
+	public Map<String, ServiceConfig> serviceConfigMap;
 
 	@Override
 	public String getAppName() {
@@ -35,10 +37,14 @@ class DefaultApplicationSpec implements ApplicationSpec {
 	}
 
 	@Override
-	public List<ServiceConfig> getServices() {
-		return serviceConfig;
+	public List<String> getServices() {
+		return services;
+	}
+
+	@Override
+	public ServiceConfig getServiceConfig(String name) {
+		return serviceConfigMap.get(name);
 	}
-	
 }
 
 public class YamlApplicationSpecFactory {


Mime
View raw message