[Swift-commit] r4999 - trunk/bin

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Wed Aug 24 11:16:40 CDT 2011


Author: davidk
Date: 2011-08-24 11:16:39 -0500 (Wed, 24 Aug 2011)
New Revision: 4999

Modified:
   trunk/bin/chxml
Log:
Bug fixes and improved error messages


Modified: trunk/bin/chxml
===================================================================
--- trunk/bin/chxml	2011-08-24 16:04:14 UTC (rev 4998)
+++ trunk/bin/chxml	2011-08-24 16:16:39 UTC (rev 4999)
@@ -3,7 +3,7 @@
 # ensures that that there is a sites file specified and that it contains
 # well-formed xml as well as essential attributes for the specified provider
 
-import xml.parsers.expat,sys,os,commands
+import xml.parsers.expat,sys,os,commands,pprint
 from glob import glob
 
 class siteProps:
@@ -44,11 +44,14 @@
     def start_element(self, name, attrs):
         self.startTags.append(name)
         for x, y in attrs.iteritems():
-            if (name=="execution" and x=="provider" and y=="local"):
-                self.execProvider = "local"
+            if (name=="execution" and x=="provider"):
+                self.execProvider = y
             if (y=="globus"):
                 self.globusParams = 1
-
+	    if (mysite.globusParams == 1 and mysite.execProvider == "local"):
+    		pp = pprint.PrettyPrinter()
+    		print "Warning: "+mysite.sites_file+" contains globus parameters that do not apply to the local execution provider ("+name+" "+pp.pformat(attrs)+")"
+		sys.exit()
     def end_element(self, name):
         self.endTags.append(name)
 
@@ -59,7 +62,7 @@
 try:
     mysite.parsefile()
 except Exception, e:
-    print "Error: there is a problem with your sites file"
+    print "Error: XML parsing error in "+mysite.sites_file
     print "%s is %s" % (mysite.sites_file, e)
     sys.exit()
 
@@ -78,9 +81,10 @@
         if tag=="pool":
             pool= 1
 
-if (pool<1 or config<1):
-    print "Error: there is a problem with your sites file "+mysite.sites_file
-if (mysite.globusParams == 1 and mysite.execProvider == "local"):
-    print "Error: "+mysite.sites_file+" contains parameters that do not apply to the selected execution provider"
+if (pool<1):
+    print "Warning: Your sites file, "+mysite.sites_file+" is missing a pool entry"
     sys.exit()
+if (config<1):
+    print "Warning: Your site file, "+mysite.sites_file+" is missing a config entry"
+    sys.exit()
     




More information about the Swift-commit mailing list