ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: #YARN WIP
Date Fri, 05 Jun 2015 16:37:11 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/yarn-debug 85f4a8915 -> 12d9c02cf


#YARN WIP


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/12d9c02c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/12d9c02c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/12d9c02c

Branch: refs/heads/yarn-debug
Commit: 12d9c02cf6443551cf903e6caac455201cfc0043
Parents: 85f4a89
Author: nikolay tikhonov <ntikhonov@gridgain.com>
Authored: Fri Jun 5 19:37:23 2015 +0300
Committer: nikolay tikhonov <ntikhonov@gridgain.com>
Committed: Fri Jun 5 19:37:23 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/yarn/ApplicationMaster.java   | 35 ++++++++++++--------
 1 file changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12d9c02c/modules/yarn/src/main/java/org/apache/ignite/yarn/ApplicationMaster.java
----------------------------------------------------------------------
diff --git a/modules/yarn/src/main/java/org/apache/ignite/yarn/ApplicationMaster.java b/modules/yarn/src/main/java/org/apache/ignite/yarn/ApplicationMaster.java
index 95197b7..fe065a3 100644
--- a/modules/yarn/src/main/java/org/apache/ignite/yarn/ApplicationMaster.java
+++ b/modules/yarn/src/main/java/org/apache/ignite/yarn/ApplicationMaster.java
@@ -19,6 +19,7 @@ package org.apache.ignite.yarn;
 
 import org.apache.commons.io.*;
 import org.apache.hadoop.fs.*;
+import org.apache.hadoop.service.Service;
 import org.apache.hadoop.yarn.api.records.*;
 import org.apache.hadoop.yarn.client.api.*;
 import org.apache.hadoop.yarn.client.api.async.*;
@@ -198,29 +199,37 @@ public class ApplicationMaster implements AMRMClientAsync.CallbackHandler
{
         Priority priority = Records.newRecord(Priority.class);
         priority.setPriority(0);
 
-        // Resource requirements for worker containers
-        Resource capability = Records.newRecord(Resource.class);
-        capability.setMemory(1024);
-        capability.setVirtualCores(2);
+        // Check ignite cluster.
+        while (!nmClient.isInState(Service.STATE.STOPPED)) {
+            Resource availableRes = rmClient.getAvailableResources();
 
-        // Make container requests to ResourceManager
-        for (int i = 0; i < 1; ++i) {
-            AMRMClient.ContainerRequest containerAsk =
-                new AMRMClient.ContainerRequest(capability, null, null, priority);
+            if (containers.size() < props.instances() || availableRes.getMemory() >=
props.cpusPerNode()
+                || availableRes.getVirtualCores() >= props.cpus()) {
+                // Resource requirements for worker containers
+                Resource capability = Records.newRecord(Resource.class);
+                capability.setMemory(1024);
+                capability.setVirtualCores(2);
 
-            System.out.println("[AM] Making res-req " + i);
+                for (int i = 0; i < 1; ++i) {
+                    // Make container requests to ResourceManager
+                    AMRMClient.ContainerRequest containerAsk =
+                            new AMRMClient.ContainerRequest(capability, null, null, priority);
 
-            rmClient.addContainerRequest(containerAsk);
+                    System.out.println("[AM] Making res-req " + i);
+
+                    rmClient.addContainerRequest(containerAsk);
+                }
+            }
+
+            TimeUnit.SECONDS.sleep(5);
         }
 
         System.out.println("[AM] waiting for containers to finish");
 
-        TimeUnit.MINUTES.sleep(10);
-
         System.out.println("[AM] unregisterApplicationMaster 0");
 
         // Un-register with ResourceManager
-        rmClient.unregisterApplicationMaster(FinalApplicationStatus.SUCCEEDED, "", "");
+        rmClient.unregisterApplicationMaster(FinalApplicationStatus.KILLED, "", "");
 
         System.out.println("[AM] unregisterApplicationMaster 1");
     }


Mime
View raw message