[Swift-commit] r3417 - in trunk: resources src/org/griphyn/vdl/karajan src/org/griphyn/vdl/karajan/lib src/org/griphyn/vdl/mapping

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Tue Jun 29 16:16:55 CDT 2010


Author: wozniak
Date: 2010-06-29 16:16:55 -0500 (Tue, 29 Jun 2010)
New Revision: 3417

Modified:
   trunk/resources/Karajan.stg
   trunk/src/org/griphyn/vdl/karajan/Loader.java
   trunk/src/org/griphyn/vdl/karajan/lib/CloseDataset.java
   trunk/src/org/griphyn/vdl/karajan/lib/Execute.java
   trunk/src/org/griphyn/vdl/karajan/lib/New.java
   trunk/src/org/griphyn/vdl/karajan/lib/PartialCloseDataset.java
   trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java
   trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java
   trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java
Log:
New Swift log formatting 


Modified: trunk/resources/Karajan.stg
===================================================================
--- trunk/resources/Karajan.stg	2010-06-29 21:16:24 UTC (rev 3416)
+++ trunk/resources/Karajan.stg	2010-06-29 21:16:55 UTC (rev 3417)
@@ -2,6 +2,7 @@
 
 // TODO can move progress ticker start into vdl:mains so karajan files
 // are smaller
+
 program(types,procedures,declarations,statements,constants,buildversion) ::= <<
 <project><!-- CACHE ID $buildversion$ -->
   <import file="sys.xml"/>
@@ -101,7 +102,7 @@
 >>
 
 vdl_execute(outputs,inputs,application,name,line) ::= <<
-<log level="info" message="PROCEDURE line=$line$ thread={#thread} name=$name$"/>
+<log level="debug" message="PROCEDURE line=$line$ thread={#thread} name=$name$"/>
 <vdl:execute>
   <vdl:tr>$application.exec$</vdl:tr>
   $inputs:vdl_stagein();separator="\n"$
@@ -109,7 +110,7 @@
   $vdl_arguments(arguments=application.arguments, stdin=application.stdin,stdout=application.stdout,stderr=application.stderr)$
 </vdl:execute>
 $outputs:vdl_closedataset();separator="\n"$
-<log level="info" message="PROCEDURE_END line=$line$"/>
+<log level="debug" message="PROCEDURE_END line=$line$"/>
 >>
 
 vdl_log_input() ::= <<
@@ -213,14 +214,14 @@
       <vdl:new type="int" value="{\$\$}"/>
     </set>
 $endif$
-	<log level="info" message="FOREACH_IT_START line=$line$ thread={#thread}"/>
-<log level="info"><string>SCOPE thread={#thread}</string></log>
+	<log level="debug" message="FOREACH_IT_START line=$line$ thread={#thread}"/>
+<log level="debug"><string>SCOPE thread={#thread}</string></log>
 
     $declarations;separator="\n"$
     $if(statements)$
       $parallel(statements=statements)$
     $endif$
-    <log level="info" message="FOREACH_IT_END line=$line$ thread={#thread}"/>
+    <log level="debug" message="FOREACH_IT_END line=$line$ thread={#thread}"/>
 </vdl:tparallelFor>
 >>
 
@@ -230,7 +231,7 @@
 
 callInternal(func, outputs, inputs) ::= <<
 <sequential>
-<log level="info" message="INTERNALPROC_START thread={#thread} name=$func$"/>
+<log level="debug" message="INTERNALPROC_START thread={#thread} name=$func$"/>
 <set name="swift#cs"><variable>#thread</variable></set>
 <$func$>
   <parallel>
@@ -238,7 +239,7 @@
     $inputs:callInternal_log_input();separator="\n"$
   </parallel>
 </$func$>
-<log level="info" message="INTERNALPROC_END thread={#thread}"/>
+<log level="debug" message="INTERNALPROC_END thread={#thread}"/>
 </sequential>
 >>
 
@@ -412,12 +413,12 @@
 <if>
   <vdl:getfieldvalue>$condition$</vdl:getfieldvalue>
   <then>
-<log level="info"><string>SCOPE thread={#thread}</string></log>
+<log level="debug"><string>SCOPE thread={#thread}</string></log>
     $vthen$
   </then>
   $if(velse)$
   <else>
-<log level="info"><string>SCOPE thread={#thread}</string></log>
+<log level="debug"><string>SCOPE thread={#thread}</string></log>
     $velse$
   </else>
   $endif$
@@ -544,7 +545,7 @@
   </vdl:slicearray>
  </set>
 
- <log level="info"><concat>
+ <log level="debug"><concat>
    <string>SLICEARRAY thread={#thread} slice=</string>
    <vdl:getdatasetprovenanceid var="{swift#slice}" />
    <string> member=$memberchild$ array=</string>

Modified: trunk/src/org/griphyn/vdl/karajan/Loader.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/Loader.java	2010-06-29 21:16:24 UTC (rev 3416)
+++ trunk/src/org/griphyn/vdl/karajan/Loader.java	2010-06-29 21:16:55 UTC (rev 3417)
@@ -476,6 +476,7 @@
             ca.setThreshold(level);
             ca.activateOptions();
         }
+        Logger.getLogger(Log.class).setLevel(Level.INFO);
         if (ap.isPresent(ARG_TUI)) {
             ma = new MonitorAppender(projectName);
             Logger.getRootLogger().addAppender(ma);

Modified: trunk/src/org/griphyn/vdl/karajan/lib/CloseDataset.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/CloseDataset.java	2010-06-29 21:16:24 UTC (rev 3416)
+++ trunk/src/org/griphyn/vdl/karajan/lib/CloseDataset.java	2010-06-29 21:16:55 UTC (rev 3417)
@@ -23,8 +23,8 @@
 		Path path = parsePath(OA_PATH.getValue(stack), stack);
 		DSHandle var = (DSHandle) PA_VAR.getValue(stack);
 		try {
-			if (logger.isInfoEnabled()) {
-				logger.info("Closing " + var);
+			if (logger.isDebugEnabled()) {
+				logger.debug("Closing " + var);
 			}
 			var = var.getField(path);
 			closeChildren(stack, var);

Modified: trunk/src/org/griphyn/vdl/karajan/lib/Execute.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/Execute.java	2010-06-29 21:16:24 UTC (rev 3416)
+++ trunk/src/org/griphyn/vdl/karajan/lib/Execute.java	2010-06-29 21:16:55 UTC (rev 3417)
@@ -5,6 +5,8 @@
 
 import org.apache.log4j.Logger;
 import org.globus.cog.abstraction.impl.common.StatusEvent;
+import org.globus.cog.abstraction.interfaces.Specification;
+import org.globus.cog.abstraction.interfaces.JobSpecification;
 import org.globus.cog.abstraction.interfaces.Status;
 import org.globus.cog.abstraction.interfaces.Task;
 import org.globus.cog.karajan.arguments.Arg;
@@ -44,12 +46,7 @@
 			Object constraints) throws ExecutionException {
 		try {
 			registerReplica(stack, task);
-			if (logger.isDebugEnabled()) {
-				logger.debug(task);
-				logger.debug("Submitting task " + task);
-			}
-			String jobid = (String)A_JOBID.getValue(stack,null);
-			logger.info("jobid="+jobid+" task=" + task);
+                        log(task, stack);
 			scheduler.addJobStatusListener(this, task);
 			synchronized (tasks) {
 				tasks.put(task, stack);
@@ -64,6 +61,32 @@
 		}
 	}
 
+        void log(Task task, VariableStack stack)
+            throws ExecutionException
+        {
+            if (logger.isDebugEnabled()) {
+                logger.debug(task);
+                logger.debug("Submitting task " + task);
+            }
+            String jobid = (String)A_JOBID.getValue(stack,null);
+            if (logger.isDebugEnabled()) {
+                logger.debug("jobid="+jobid+" task=" + task);
+            }
+            else if (logger.isInfoEnabled()) {
+                Specification spec = task.getSpecification();
+                if (spec instanceof JobSpecification) {
+                    JobSpecification jobspec = (JobSpecification) spec;
+                    logger.info("Submit: " +
+                                "in: " + jobspec.getDirectory() +
+                                " command: " + jobspec.getExecutable() + 
+                                " " + jobspec.getArguments());
+                }
+                else {
+                    logger.info("Submit: " + spec);
+                }
+            }
+        }
+            
 	protected void registerReplica(VariableStack stack, Task task) throws CanceledReplicaException {
 		setTaskIdentity(stack, task);
 		try {

Modified: trunk/src/org/griphyn/vdl/karajan/lib/New.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/New.java	2010-06-29 21:16:24 UTC (rev 3416)
+++ trunk/src/org/griphyn/vdl/karajan/lib/New.java	2010-06-29 21:16:55 UTC (rev 3417)
@@ -134,7 +134,7 @@
 				throw new ExecutionException("vdl:new requires a type specification for value "
 						+ value);
 			}
-			logger.info("NEW id="+handle.getIdentifier());
+			logger.debug("NEW id="+handle.getIdentifier());
 			return handle;
 		}
 		catch (Exception e) {

Modified: trunk/src/org/griphyn/vdl/karajan/lib/PartialCloseDataset.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/PartialCloseDataset.java	2010-06-29 21:16:24 UTC (rev 3416)
+++ trunk/src/org/griphyn/vdl/karajan/lib/PartialCloseDataset.java	2010-06-29 21:16:55 UTC (rev 3417)
@@ -32,15 +32,14 @@
 		boolean hasUnseenToken = false;
 		DSHandle var = (DSHandle) PA_VAR.getValue(stack);
 		String statementID = (String) OA_STATEMENTID.getValue(stack);
-		if (logger.isInfoEnabled()) {
-			logger.info("Partially closing " + var + " for statement " + statementID);
+		if (logger.isDebugEnabled()) {
+			logger.debug("Partially closing " + var +
+                                     " hash: " + var.hashCode() +
+                                     " for statement " + statementID);
 		}
 
-		logger.info("var is "+var);
-		logger.info("var hash is "+var.hashCode());
-
 		if(var.isClosed()) {
-			logger.info("variable already closed - skipping partial close processing");
+			logger.debug("variable already closed - skipping partial close processing");
 			return null;
 		}
 
@@ -53,10 +52,10 @@
 			}
 
 			c.add(statementID);
-			logger.info("Adding token "+statementID+" with hash "+statementID.hashCode());
+			logger.debug("Adding token "+statementID+" with hash "+statementID.hashCode());
 
 			String needToWaitFor = (String) var.getParam("waitfor");
-			logger.info("need to wait for "+needToWaitFor);
+			logger.debug("need to wait for "+needToWaitFor);
 			StringTokenizer stok = new StringTokenizer(needToWaitFor, " ");
 			while(stok.hasMoreTokens()) {
 				String s = stok.nextToken();
@@ -66,16 +65,16 @@
 					// then we have a required element that we have not
 					// seen yet, so...
 					hasUnseenToken = true;
-					logger.info("Container does not contain token "+s);
+					logger.debug("Container does not contain token "+s);
 				} else {
-					logger.info("Container does contain token "+s);
+					logger.debug("Container does contain token "+s);
 				}
 			}
 		}
-		logger.info("hasUnseenToken = "+hasUnseenToken);
+		logger.debug("hasUnseenToken = "+hasUnseenToken);
 		if(!hasUnseenToken) {
-			if(logger.isInfoEnabled()) {
-				logger.info("All partial closes for " + var + " have happened. Closing fully.");
+			if(logger.isDebugEnabled()) {
+				logger.debug("All partial closes for " + var + " have happened. Closing fully.");
 			}
 			var.closeDeep();
 			pendingDatasets.remove(var);

Modified: trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java	2010-06-29 21:16:24 UTC (rev 3416)
+++ trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java	2010-06-29 21:16:55 UTC (rev 3417)
@@ -10,6 +10,7 @@
 import org.globus.cog.karajan.workflow.futures.FutureNotYetAvailable;
 import org.griphyn.vdl.karajan.Pair;
 import org.griphyn.vdl.karajan.PairIterator;
+import org.griphyn.vdl.mapping.AbstractDataNode;
 import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.InvalidPathException;
 import org.griphyn.vdl.mapping.Path;
@@ -32,9 +33,9 @@
 		    Path path = parsePath(OA_PATH.getValue(stack), stack);
 			DSHandle leaf = var.getField(path);
 			DSHandle value = (DSHandle) PA_VALUE.getValue(stack);
-			if (logger.isInfoEnabled()) {
-				logger.info("Setting " + leaf + " to " + value);
-			}
+			
+			log(leaf, value);
+			    
 			synchronized (var.getRoot()) {
             // TODO want to do a type check here, for runtime type checking
             // and pull out the appropriate internal value from value if it
@@ -61,7 +62,24 @@
 		}
 	}
 
-	/** make dest look like source - if its a simple value, copy that
+	private void log(DSHandle leaf, DSHandle value) {
+	    if (logger.isDebugEnabled()) {
+	        logger.debug("Setting " + leaf + " to " + value);
+	    }
+	    else if (logger.isInfoEnabled()) {
+	        if (leaf instanceof AbstractDataNode) {
+	            AbstractDataNode data = (AbstractDataNode) leaf;
+                    Path path = data.getPathFromRoot();
+                    String p = path.toString();
+                    if (p.equals("$"))
+                        p = "";
+	            String name = data.getDisplayableName() + p;
+	            logger.info("Set: " + name + "=" + value);
+	        }
+	    }
+    }
+
+    /** make dest look like source - if its a simple value, copy that
 	    and if its an array then recursively copy */
 	void deepCopy(DSHandle dest, DSHandle source, VariableStack stack) throws ExecutionException {
 		if (source.getType().isPrimitive()) {

Modified: trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java	2010-06-29 21:16:24 UTC (rev 3416)
+++ trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java	2010-06-29 21:16:55 UTC (rev 3417)
@@ -580,12 +580,17 @@
 		return provenanceIDCount++;
 	}
 
-	public static void logProvenanceResult(int id, DSHandle result, String name) throws ExecutionException {
-		logger.info("FUNCTION id="+id+" name="+name+" result="+result.getIdentifier());
+	public static void logProvenanceResult(int id, DSHandle result, 
+	        String name) 
+	throws ExecutionException {
+	    if (logger.isDebugEnabled())
+	        logger.debug("FUNCTION id="+id+" name="+name+" result="+result.getIdentifier());
+	    else if (logger.isInfoEnabled())
+	        logger.info("FUNCTION: " + name + "()");
 	}
 
 	public static void logProvenanceParameter(int id, DSHandle parameter, String paramName) throws ExecutionException {
-		logger.info("FUNCTIONPARAMETER id="+id+" input="+parameter.getIdentifier()+" name="+paramName);
-
+	    if (logger.isDebugEnabled())
+	        logger.debug("FUNCTIONPARAMETER id="+id+" input="+parameter.getIdentifier()+" name="+paramName);
 	}
 }

Modified: trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java	2010-06-29 21:16:24 UTC (rev 3416)
+++ trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java	2010-06-29 21:16:55 UTC (rev 3417)
@@ -151,7 +151,7 @@
 		return sb.toString();
 	}
 
-	protected String getDisplayableName() {
+	public String getDisplayableName() {
 		String prefix = getRoot().getParam("dbgname");
 		if (prefix == null) {
 			prefix = getRoot().getParam("prefix");
@@ -395,7 +395,7 @@
 		this.closed = true;
 		notifyListeners();
 		if (logger.isInfoEnabled()) {
-			logger.info("closed " + this.getIdentifyingString());
+			logger.debug("closed " + this.getIdentifyingString());
 		}
 		// so because its closed, we can dump the contents
 
@@ -563,8 +563,8 @@
 	}
 
 	public synchronized void addListener(DSHandleListener listener) {
-		if (logger.isInfoEnabled()) {
-			logger.info("Adding handle listener \"" + listener + "\" to \""
+		if (logger.isDebugEnabled()) {
+			logger.debug("Adding handle listener \"" + listener + "\" to \""
 					+ getIdentifyingString() + "\"");
 		}
 		if (listeners == null) {
@@ -582,9 +582,9 @@
 			while (i.hasNext()) {
 				DSHandleListener listener = (DSHandleListener) i.next();
 				i.remove();
-				if (logger.isInfoEnabled()) {
-					logger.info("Notifying listener \"" + listener
-							+ "\" about \"" + getIdentifyingString() + "\"");
+				if (logger.isDebugEnabled()) {
+					logger.debug("Notifying listener \"" + listener
+                                                     + "\" about \"" + getIdentifyingString() + "\"");
 				}
 				listener.handleClosed(this);
 			}




More information about the Swift-commit mailing list