[Swift-commit] r2525 - in trunk/src/org/griphyn/vdl/karajan/lib: . replication

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Wed Feb 11 19:16:27 CST 2009


Author: hategan
Date: 2009-02-11 19:16:26 -0600 (Wed, 11 Feb 2009)
New Revision: 2525

Modified:
   trunk/src/org/griphyn/vdl/karajan/lib/TCProfile.java
   trunk/src/org/griphyn/vdl/karajan/lib/replication/ReplicationManager.java
Log:
moved walltime check to TCProfile to avoid passing the tr in an attribute (which causes GT2 to bark)

Modified: trunk/src/org/griphyn/vdl/karajan/lib/TCProfile.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/TCProfile.java	2009-02-11 15:17:05 UTC (rev 2524)
+++ trunk/src/org/griphyn/vdl/karajan/lib/TCProfile.java	2009-02-12 01:16:26 UTC (rev 2525)
@@ -3,11 +3,15 @@
  */
 package org.griphyn.vdl.karajan.lib;
 
+import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
+import org.globus.cog.abstraction.impl.common.execution.WallTime;
 import org.globus.cog.karajan.arguments.Arg;
 import org.globus.cog.karajan.arguments.ArgUtil;
 import org.globus.cog.karajan.arguments.NamedArguments;
@@ -67,9 +71,50 @@
 
 			attrs = attributesFromTC(tce, attrs);
 		}
+
+		attrs = checkWalltime(tr, attrs);
+
 		addAttributes(named, attrs);
 		return null;
 	}
+	
+	private Map checkWalltime(String tr, Map attrs) {
+	    Object walltime = null;
+	    if (attrs != null) {
+	    	walltime = attrs.get("maxwalltime");
+	    }
+        if (walltime == null) {
+            warn(tr, "Warning: missing walltime specification for \"" + tr
+                    + "\". Assuming 10 minutes.");
+            walltime = "10";
+        }
+        int seconds;
+        try {
+            seconds = WallTime.timeToSeconds(walltime.toString());
+        }
+        catch (IllegalArgumentException e) {
+            warn(tr, "Warning: invalid walltime specification for \"" + tr
+                    + "\" (" + walltime + "). Assuming 10 minutes.");
+            walltime = "10";
+        }
+        if (attrs == null) {
+            attrs = Collections.singletonMap("maxwalltime", walltime);
+        }
+        else {
+            attrs.put("maxwalltime", walltime);
+        }
+        return attrs;
+	}
+	
+	private static final Set warnedAboutWalltime = new HashSet();
+	
+	private void warn(String tr, String message) {
+        synchronized (warnedAboutWalltime) {
+            if (warnedAboutWalltime.add(tr)) {
+                System.out.println(message);
+            }
+        }
+    }
 
 	private void addEnvironment(Map m, TransformationCatalogEntry tce) {
 		List l = tce.getProfiles(Profile.ENV);

Modified: trunk/src/org/griphyn/vdl/karajan/lib/replication/ReplicationManager.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/replication/ReplicationManager.java	2009-02-11 15:17:05 UTC (rev 2524)
+++ trunk/src/org/griphyn/vdl/karajan/lib/replication/ReplicationManager.java	2009-02-12 01:16:26 UTC (rev 2525)
@@ -93,38 +93,14 @@
         }
     }
 
-    private static final Set warnedAboutWalltime = new HashSet();
-
     protected void registerRunning(Task task, Date time) {
         JobSpecification spec = (JobSpecification) task.getSpecification();
         Object walltime = spec.getAttribute("maxwalltime");
-        String tr = (String) spec.getAttribute("tr");
-        if (walltime == null) {
-            warn(tr, "Warning: missing walltime specification for \"" + tr
-                    + "\". Assuming 10 minutes.");
-            walltime = "10";
-        }
-        int seconds;
-        try {
-            seconds = WallTime.timeToSeconds(walltime.toString());
-        }
-        catch (IllegalArgumentException e) {
-            warn(tr, "Warning: invalid walltime specification for \"" + tr
-                    + "\" (" + walltime + "). Assuming 10 minutes.");
-            seconds = 10 * 60;
-        }
+        int seconds = WallTime.timeToSeconds(walltime.toString());
         Date deadline = new Date(time.getTime() + WALLTIME_DEADLINE_MULTIPLIER * seconds * 1000);
         running.put(task, deadline);
     }
 
-    private void warn(String tr, String message) {
-        synchronized (warnedAboutWalltime) {
-            if (warnedAboutWalltime.add(tr)) {
-                System.out.println(message);
-            }
-        }
-    }
-
     public synchronized int getN() {
         return n;
     }




More information about the Swift-commit mailing list