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

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Thu Feb 12 12:36:44 CST 2009


Author: hategan
Date: 2009-02-12 12:36:43 -0600 (Thu, 12 Feb 2009)
New Revision: 2531

Modified:
   trunk/src/org/griphyn/vdl/karajan/lib/TCProfile.java
   trunk/src/org/griphyn/vdl/karajan/lib/replication/ReplicationManager.java
Log:
prevent ben from being unhappy

Modified: trunk/src/org/griphyn/vdl/karajan/lib/TCProfile.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/TCProfile.java	2009-02-12 15:51:57 UTC (rev 2530)
+++ trunk/src/org/griphyn/vdl/karajan/lib/TCProfile.java	2009-02-12 18:36:43 UTC (rev 2531)
@@ -3,7 +3,6 @@
  */
 package org.griphyn.vdl.karajan.lib;
 
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -71,40 +70,27 @@
 
 			attrs = attributesFromTC(tce, attrs);
 		}
-
-		attrs = checkWalltime(tr, attrs);
-
+		checkWalltime(tr, attrs);
 		addAttributes(named, attrs);
 		return null;
 	}
 	
-	private Map checkWalltime(String tr, Map attrs) {
+	private void 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";
+            return;
         }
-        int seconds;
         try {
-            seconds = WallTime.timeToSeconds(walltime.toString());
+        	//validate walltime
+            WallTime.timeToSeconds(walltime.toString());
         }
         catch (IllegalArgumentException e) {
             warn(tr, "Warning: invalid walltime specification for \"" + tr
-                    + "\" (" + walltime + "). Assuming 10 minutes.");
-            walltime = "10";
+                    + "\" (" + walltime + ").");
         }
-        if (attrs == null) {
-            attrs = new HashMap();
-            attrs.put("maxwalltime", walltime);
-        }
-        else {
-            attrs.put("maxwalltime", walltime);
-        }
-        return attrs;
 	}
 	
 	private static final Set warnedAboutWalltime = new HashSet();

Modified: trunk/src/org/griphyn/vdl/karajan/lib/replication/ReplicationManager.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/replication/ReplicationManager.java	2009-02-12 15:51:57 UTC (rev 2530)
+++ trunk/src/org/griphyn/vdl/karajan/lib/replication/ReplicationManager.java	2009-02-12 18:36:43 UTC (rev 2531)
@@ -5,10 +5,8 @@
 
 import java.util.Date;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Set;
 
 import org.apache.log4j.Logger;
 import org.globus.cog.abstraction.impl.common.execution.WallTime;
@@ -26,6 +24,8 @@
     public static final int INITIAL_QUEUE_TIME_ESTIMATE = 30; // seconds
     
     public static final int WALLTIME_DEADLINE_MULTIPLIER = 2;
+    
+    public static final int VERY_LARGE_WALLTIME = 360 * 24 * 60 * 60; //about one year
 
     private int n;
     private long s;
@@ -96,7 +96,13 @@
     protected void registerRunning(Task task, Date time) {
         JobSpecification spec = (JobSpecification) task.getSpecification();
         Object walltime = spec.getAttribute("maxwalltime");
-        int seconds = WallTime.timeToSeconds(walltime.toString());
+        int seconds;
+        if (walltime == null) {
+        	seconds = VERY_LARGE_WALLTIME;
+        }
+        else {
+       		seconds = WallTime.timeToSeconds(walltime.toString());
+        }
         Date deadline = new Date(time.getTime() + WALLTIME_DEADLINE_MULTIPLIER * seconds * 1000);
         running.put(task, deadline);
     }




More information about the Swift-commit mailing list