[Swift-commit] cog r3760

swift at ci.uchicago.edu swift at ci.uchicago.edu
Mon Aug 12 23:35:04 CDT 2013


------------------------------------------------------------------------
r3760 | hategan | 2013-08-12 23:32:34 -0500 (Mon, 12 Aug 2013) | 1 line

fixed worker shell
------------------------------------------------------------------------
Index: modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/WorkerShellHandler.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/WorkerShellHandler.java	(revision 3759)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/WorkerShellHandler.java	(working copy)
@@ -34,8 +34,13 @@
         try {
             ChannelManager manager = ChannelManager.getManager();
             CoasterChannel worker = bqp.getWorkerChannel(workerId);
-            CoasterChannel reserved = manager.reserveChannel(worker);
-            wsc.executeAsync(reserved, this);
+            if (worker == null) {
+                sendReply("Error: worker not found");
+            }
+            else {
+                CoasterChannel reserved = manager.reserveChannel(worker);
+                wsc.executeAsync(reserved, this);
+            }
         }
         catch (ChannelException e) {
             sendError("Cannot contact worker", e);
Index: modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/Node.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/Node.java	(revision 3759)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/Node.java	(working copy)
@@ -165,4 +165,8 @@
         Block.totalFailedWorkers += settings.getJobsPerNode();
         block.getAllocationProcessor().getRLogger().log("WORKER_LOST blockid=" + block.getId());
     }
+
+    public int getId() {
+        return id;
+    }
 }
Index: modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/BlockQueueProcessor.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/BlockQueueProcessor.java	(revision 3759)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/BlockQueueProcessor.java	(working copy)
@@ -24,6 +24,7 @@
 import org.globus.cog.abstraction.interfaces.ExecutionService;
 import org.globus.cog.abstraction.interfaces.Task;
 import org.globus.cog.coaster.channels.ChannelContext;
+import org.globus.cog.coaster.channels.ChannelException;
 import org.globus.cog.coaster.channels.CoasterChannel;
 
 public class BlockQueueProcessor
@@ -898,6 +899,22 @@
        Get the KarajanChannel for the worker with given id
      */
     public CoasterChannel getWorkerChannel(String id) {
+        int sep = id.indexOf(':');
+        String blockID = id.substring(0, sep);
+        String workerID = id.substring(sep + 1);
+        Block b = getBlock(blockID);
+        if (b != null) {
+            Node n = b.findNode(workerID);
+            if (n != null) {
+                try {
+                    return n.getChannel();
+                }
+                catch (ChannelException e) {
+                    logger.info("Cannot get node channel", e);
+                    return null;
+                }
+            }
+        }
         return null;
     }
 
Index: modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/Block.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/Block.java	(revision 3759)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/Block.java	(working copy)
@@ -424,9 +424,21 @@
         return "Block " + id + " (" + workers + "x" + walltime + ")";
     }
     
-    public List<Node> getNodes(){
+    public List<Node> getNodes() {
         return nodes;
     }
+    
+    public Node findNode(String nodeID) {
+        Integer id = Integer.parseInt(nodeID);
+        synchronized (cpus) {
+            for (Node n : nodes) {
+                if (n.getId() == id) {
+                    return n;
+                }
+            }
+        }
+        return null;
+    }
 
     public void statusChanged(StatusEvent event) {
         if (logger.isInfoEnabled()) {



More information about the Swift-commit mailing list