def getPilotSite(self): """ __getPilotSite__ get pilot site information using config file """ print 'PilotJob: getPilotSite()' if ( isVariableSet('CMS_PATH') ): configPath = os.path.join(os.environ.get('CMS_PATH'),\ 'SITECONF/local/JobConfig/site-local-config.xml') try: doc = xml.dom.minidom.parse(configPath) sites = doc.getElementsByTagName('site') if ( sites != None): site = sites[0] siteName = site.getAttribute('name') localStageOut = site.getElementsByTagName('local-stage-out')[0] node = localStageOut.getElementsByTagName('se-name')[0] self.pilotSite = node.getAttribute('value') return True else: print 'there is no site tag in site-local-config.xml' return False except: print 'getPilotSite():Problem %s:%s' \ (sys.exc_info()[0], sys.exc_info()[1]) return False else: print 'could not find CMS_PATH variable' return False
def pilotEnvironmentCheck ( self ): """ __pilotEnvironmentCheck__ """ envList = ["CMS_PATH", "VO_CMS_SW_DIR", "HOME"] notSetEnv = [] for env in envList: if ( not isVariableSet ( env ) ): notSetEnv.append(env) #if notSetEnv list is not empty if ( len( notSetEnv ) > 0 ): print "Some of env variables are not set" print "Env Not Found :%s" % notSetEnv return False return True