[Swift-commit] r2953 - SwiftApps/SIDGrid/uchicago_tools

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Wed Jun 3 14:30:07 CDT 2009


Author: skenny
Date: 2009-06-03 14:30:07 -0500 (Wed, 03 Jun 2009)
New Revision: 2953

Modified:
   SwiftApps/SIDGrid/uchicago_tools/tgsites_cnari
Log:
checks for proxy and probes cnari tg sites

Modified: SwiftApps/SIDGrid/uchicago_tools/tgsites_cnari
===================================================================
--- SwiftApps/SIDGrid/uchicago_tools/tgsites_cnari	2009-06-01 20:21:07 UTC (rev 2952)
+++ SwiftApps/SIDGrid/uchicago_tools/tgsites_cnari	2009-06-03 19:30:07 UTC (rev 2953)
@@ -1,6 +1,10 @@
 #!/usr/bin/python
 import os,sys
 
+#------------------------------global variables------------
+
+SWIFT_HOME = "/disks/ci-gpfs/fmri/cnari/swift/swift/bin/"
+
 class gridData(dict):
     def add(self,table,tablename,primary="ResourceID",secondary=""):
         # make this user opt? mercury == dtf
@@ -9,9 +13,7 @@
             for site in site_list:
                 if (str(row).find(site)>-1):
                     id=row["ResourceID"]
-                    print "id is.........."+id
                     if not id in self.keys():
-                        print "adding site!!!!!!!"+str(site)
                         self[id]={}
                     if secondary:
                         if not tablename in self[id].keys():
@@ -100,18 +102,19 @@
     if not username:
         username=os.getlogin()
     print "Checking for a valid proxy...."
-    infocommand="grid-proxy-info -timeleft"
+    infocommand=SWIFT_HOME+"grid-proxy-info -timeleft"
     status=os.popen4(infocommand)[1].read().strip()
 
-    error=re.search('not found',status) 
-    if error:
+    error=re.search('not found',status)
+    error2=re.search('ERROR',status)
+    if error or error2:
         sys.stderr.write('you do not have a valid proxy running, please initialize one.')
         os.system("grid-proxy-init")
 
     else:
         timeleftstr=status.split(' ')
-        print "time str is "+timeleftstr[4]
         timeleft = int(timeleftstr[4])
+        #timeleft = int(status)
         if timeleft < 3:
             print "Your proxy has less 3 hours left, please initialize a new one."
             os.system("grid-proxy-init")
@@ -261,11 +264,13 @@
     print usagestring
 
 def main():
+    
     import getopt
     tginfo_dir="."
     verbose=True
     csvGen=False
-    xmlGen=False
+    # defaulting to true...may remove cmdline opt
+    xmlGen=True
     WriteToFile=False
     OutDict={}
     username=""
@@ -308,7 +313,7 @@
         checkProxies()
         xmlout,xmlactive=getXML(resourceMapper,siteTable,verbose=verbose)
         OutDict['xml']="".join(xmlout)
-        OutDict['xml_active']="".join(xmlactive)
+        #OutDict['xml_active']="".join(xmlactive)
 
     
     if not WriteToFile:




More information about the Swift-commit mailing list