rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
if not run_tpl: res = RPC.execProductionScript(tpl.apply(x),"") else: res = RPC.execProductionScript(run_tpl.apply(x),tpl.apply(x)) if res['OK']: success.append({ 'ID': x['ID'], 'Body': res['Value'] }) else: | try: if not run_tpl: res = RPC.execProductionScript(tpl.apply(x),"") else: res = RPC.execProductionScript(run_tpl.apply(x),tpl.apply(x)) if res['OK']: success.append({ 'ID': x['ID'], 'Body': res['Value'] }) else: fail.append(str(x['ID'])) except Exception,msg: | def create_workflow(self): """ !!! Note: 1 level parent=master assumed !!! """ rdict = dict(request.params) for x in ['RequestID','Template','Subrequests']: if not x in rdict: return S_ERROR('Required parameter %s is not specified' % x) try: id = long(rdict['RequestID']) tpl_name = str(request.params['Template'])... |
return S_ERROR("Couldn't create workflows for %s." \ | return S_ERROR("Couldn't get results from %s." \ | def create_workflow(self): """ !!! Note: 1 level parent=master assumed !!! """ rdict = dict(request.params) for x in ['RequestID','Template','Subrequests']: if not x in rdict: return S_ERROR('Required parameter %s is not specified' % x) try: id = long(rdict['RequestID']) tpl_name = str(request.params['Template'])... |
if Properties.OPERATOR in getProperties(): | if "SiteManager" in getProperties(): | def display( self ): if Properties.OPERATOR in getProperties(): c.allowActions = True else: c.allowActions = False return render( "web/siteMap.mako" ) |
if selector == "Site" and tier1 and (key not in tier1): try: countryCode = key.rsplit(".",1)[1] except: countryCode = "Unknown" c.result.append({"Key":key,"Value":result[key],"Code":countryCode}) | if selector == "Site" and tier1: if key not in tier1: try: countryCode = key.rsplit(".",1)[1] except: countryCode = "Unknown" c.result.append({"Key":key,"Value":result[key],"Code":countryCode}) | def __getStats(self,selector): req = self.__request() selector = str(selector) RPC = getRPCClient("WorkloadManagement/JobMonitoring") if selector == "Minor status": selector = "MinorStatus" elif selector == "Application status": selector = "ApplicationStatus" result = RPC.getJobStats(selector,req) if result["OK"]: c.re... |
if request.params.has_key("id") and len(request.params["id"]) > 0: | global numberOfJobs global globalSort if request.params.has_key("limit") and len(request.params["limit"]) > 0: numberOfJobs = int(request.params["limit"]) if request.params.has_key("start") and len(request.params["start"]) > 0: pageNumber = int(request.params["start"]) else: pageNumber = 0 else: numberOfJobs = 25 | def __request(self): req = {} lhcbGroup = credentials.getSelectedGroup() lhcbUser = str(credentials.getUsername()) global pageNumber if request.params.has_key("id") and len(request.params["id"]) > 0: pageNumber = 0 req["JobID"] = str(request.params["id"]) else: global numberOfJobs global globalSort if request.params.ha... |
req["JobID"] = str(request.params["id"]) else: global numberOfJobs global globalSort if request.params.has_key("limit") and len(request.params["limit"]) > 0: if request.params.has_key("start") and len(request.params["start"]) > 0: numberOfJobs = int(request.params["limit"]) pageNumber = int(request.params["start"]) els... | if request.params.has_key("pilotId") and len(request.params["pilotId"]) > 0: pageNumber = 0 req["PilotJobReference"] = str(request.params["pilotId"]) else: | def __request(self): req = {} lhcbGroup = credentials.getSelectedGroup() lhcbUser = str(credentials.getUsername()) global pageNumber if request.params.has_key("id") and len(request.params["id"]) > 0: pageNumber = 0 req["JobID"] = str(request.params["id"]) else: global numberOfJobs global globalSort if request.params.ha... |
if not request.params.has_key("getStat") and not len(request.params["getStat"]) > 0: | if not request.params.has_key("getStat"): | def __request(self): req = {} group = credentials.getSelectedGroup() user = str(credentials.getUsername()) global pageNumber global numberOfJobs global globalSort if request.params.has_key("limit") and len(request.params["limit"]) > 0: numberOfJobs = int(request.params["limit"]) if request.params.has_key("start") and l... |
result = RPC.setTransformationStatus(id,status) | result = RPC.setTransformationParameter(id,'Status',status) | def __actProduction(self,prodid,cmd): prodid = prodid.split(",") RPC = getRPCClient("ProductionManagement/ProductionManager") if cmd == 'clean': status = 'Cleaning' elif cmd == 'start': status = 'Active' elif cmd == 'stop': status = 'Stopped' elif cmd == 'flush': status = 'Flush' else: return {"success":"false","error"... |
req["Owner"] = str(user) | if not request.params.has_key("getStat") and not len(request.params["getStat"]) > 0: req["Owner"] = str(user) | def __request(self): req = {} group = credentials.getSelectedGroup() user = str(credentials.getUsername()) global pageNumber global numberOfJobs global globalSort if request.params.has_key("limit") and len(request.params["limit"]) > 0: numberOfJobs = int(request.params["limit"]) if request.params.has_key("start") and l... |
gLogger.info("\033[0;31m R E Q: \033[0m",req) | def __getStats(self,selector): req = self.__request() gLogger.info("\033[0;31m R E Q: \033[0m",req) selector = str(selector) RPC = getRPCClient("WorkloadManagement/JobMonitoring") if selector == "Minor status": selector = "MinorStatus" elif selector == "Application status": selector = "ApplicationStatus" result = RPC.g... | |
c.result = {"success":"false","error":"DIRAC Job ID(s) is not defined"} | c.result = {"success":"false","error":"Transformation ID(s) is not defined"} | def action(self): if request.params.has_key("start") and len(request.params["start"]) > 0: id = str(request.params["start"]) return self.__actProduction(id,"start") elif request.params.has_key("stop") and len(request.params["stop"]) > 0: id = str(request.params["stop"]) return self.__actProduction(id,"stop") elif reque... |
return {"success":"false","error":"getProxyStatus not a number"} else: c.result = {"success":"false","error":"DIRAC Job ID(s) is not defined"} | return {"success":"false","error":"getProxyStatus value is not a number"} else: c.result = {"success":"false","error":"The request parameters can not be recognized or they are not defined"} | def action(self): pagestart = time() if request.params.has_key("getJDL") and len(request.params["getJDL"]) > 0: id = int(request.params["getJDL"]) return self.__getJdl(id) elif request.params.has_key("getStandardOutput") and len(request.params["getStandardOutput"]) > 0: id = int(request.params["getStandardOutput"]) ret... |
c.result = {"success":"true","result":"true"} else: c.result = {"success":"true","result":"false"} return c.result | return True else: return False | def __canRunJobs(self): groupPropertie = credentials.getProperties( credentials.getSelectedGroup() ) if "NormalUser" in groupPropertie: c.result = {"success":"true","result":"true"} else: c.result = {"success":"true","result":"false"} return c.result |
c.result.append({"Key":i,"Value":result[i],"code":countryCode}) | c.result.append({"Key":i,"Value":result[i],"Code":countryCode}) | def __getStats(self,selector): req = self.__request() gLogger.info("\033[0;31m R E Q: \033[0m",req) selector = str(selector) RPC = getRPCClient("WorkloadManagement/JobMonitoring") if selector == "Minor status": selector = "MinorStatus" elif selector == "Application status": selector = "ApplicationStatus" result = RPC.g... |
countryCode = i.rsplit(".",1)[1] c.result.append({"Key":key,"Value":result[key],"code":countryCode}) | try: countryCode = key.rsplit(".",1)[1] except: countryCode = "Unknown" c.result.append({"Key":key,"Value":result[key],"Code":countryCode}) | def __getStats(self,selector): req = self.__request() gLogger.info("\033[0;31m R E Q: \033[0m",req) selector = str(selector) RPC = getRPCClient("WorkloadManagement/JobMonitoring") if selector == "Minor status": selector = "MinorStatus" elif selector == "Application status": selector = "ApplicationStatus" result = RPC.g... |
transferClient = getTransferClient( "Monitoring/Server" ) | transferClient = getTransferClient( "Framework/Monitoring" ) | def getPlotImg( self ): """ Get plot image """ if 'file' not in request.params: c.error( "Maybe you forgot the file?" ) return render( "/error.mako" ) plotImageFile = request.params[ 'file' ] if plotImageFile.find( ".png" ) < -1: c.error( "Not a valid image!" ) return render( "/error.mako" ) transferClient = getTransfe... |
rpcClient = getRPCClient( "Monitoring/Server" ) | rpcClient = getRPCClient( "Framework/Monitoring" ) | def manageViews( self ): """ Return template for managing views """ if not authorizeAction(): return render( "/error.mako" ) rpcClient = getRPCClient( "Monitoring/Server" ) retVal = rpcClient.getViews( False ) if not retVal[ 'OK' ]: c.error = retVal[ 'Message' ] return render( "/error.mako" ) c.viewsList = retVal[ 'Val... |
rpcClient = getRPCClient( "Monitoring/Server" ) | rpcClient = getRPCClient( "Framework/Monitoring" ) | def plotStaticViews( self ): """ Return template for showing views """ if not authorizeAction(): return render( "/error.mako" ) rpcClient = getRPCClient( "Monitoring/Server" ) retVal = rpcClient.getViews( False ) if not retVal[ 'OK' ]: c.error = retVal[ 'Message' ] return render( "/error.mako" ) c.viewsList = retVal[ '... |
rpcClient = getRPCClient( "Monitoring/Server" ) | rpcClient = getRPCClient( "Framework/Monitoring" ) | def deleteView( self ): """ Delete a view """ if not authorizeAction(): return render( "/error.mako" ) if not 'id' in request.params: c.error = "Missing view id to delete!" return render( "/error.mako" ) try: id = int( request.params[ 'id' ] ) except Exception, e: c.error = "View id is not valid" return render( "/error... |
rpcClient = getRPCClient( "Monitoring/Server" ) | rpcClient = getRPCClient( "Framework/Monitoring" ) | def manageActivities( self ): """ Return template for managing views """ if not authorizeAction(): return render( "/error.mako" ) rpcClient = getRPCClient( "Monitoring/Server" ) retVal = rpcClient.getActivities() if not retVal[ 'OK' ]: c.error = retVal[ 'Message' ] return render( "/error.mako" ) c.activitiesDict = retV... |
rpcClient = getRPCClient( "Monitoring/Server" ) | rpcClient = getRPCClient( "Framework/Monitoring" ) | def deleteActivity( self ): """ Delete an activity """ if not authorizeAction(): return render( "/error.mako" ) if not 'sid' in request.params or not 'aid' in request.params: c.error = "Missing ids to delete!" return render( "/error.mako" ) try: sid = int( request.params[ 'sid' ] ) aid = int( request.params[ 'aid' ] ) ... |
rpcClient = getRPCClient( "Monitoring/Server" ) | rpcClient = getRPCClient( "Framework/Monitoring" ) | def deleteActivities( self ): """ Delete a list of activities """ if not authorizeAction(): return render( "/error.mako" ) if not 'dl' in request.params: c.error = "Missing ids to delete!" return render( "/error.mako" ) try: deletionList = simplejson.loads( request.params[ 'dl' ] ) except Exception, e: c.error = "ids a... |
rpcClient = getRPCClient( "Monitoring/Server" ) | rpcClient = getRPCClient( "Framework/Monitoring" ) | def queryAttribs( self ): """ Query a value for a field """ fieldQuery = str( request.params[ 'query' ] ) print request.params[ 'defined' ] definedFields = simplejson.loads( request.params[ 'defined' ] ) rpcClient = getRPCClient( "Monitoring/Server" ) return rpcClient.queryField( fieldQuery, definedFields ) |
rpcClient = getRPCClient( "Monitoring/Server" ) | rpcClient = getRPCClient( "Framework/Monitoring" ) | def tryView( self ): """ Try plotting graphs for a view """ if not authorizeAction(): return S_ERROR( "Unauthorized!" ) try: plotRequest = simplejson.loads( request.params[ 'plotRequest' ] ) if 'timeLength' in request.params: timeLength = str( request.params[ 'timeLength' ] ) toSecs = int( Time.toEpoch() ) if timeLengt... |
rpcClient = getRPCClient( "Monitoring/Server" ) | rpcClient = getRPCClient( "Framework/Monitoring" ) | def saveView( self ): """ Save a view """ if not authorizeAction(): return S_ERROR( "Unauthorized!" ) try: plotRequest = simplejson.loads( request.params[ 'plotRequest' ] ) viewName = str( request.params[ 'viewName' ] ) except Exception, e: return S_ERROR( "Error while processing plot parameters: %s" % str( e ) ) rpcCl... |
c.select = self.__getSelectionData() if not c.select.has_key("extra"): c.select["extra"] = {"mode":"bkSim","adv":"false"} | def display(self): | |
def __getSelectionData(self): callback = {} if len(request.params) > 0: tmp = {} for i in request.params: tmp[i] = str(request.params[i]) callback["extra"] = tmp return callback | # def __getSelectionData(self): | |
return self.__showDir(req) else: return self.__showDir(req) def __showDir(self,request): | return self.__showDir(req,adv,mode) else: return self.__showDir(req,adv,mode) def __showDir(self,request,advOption,mode="Configuration"): | def submit(self): req = () if request.params.has_key("root") and len(request.params["root"]) > 0: req = str(request.params["root"]) else: req = "/" if request.params.has_key("level") and len(request.params["level"]) > 0: level = str(request.params["level"]) if level == "showFiles": sortDict = {} if request.params.has_k... |
tmp[head[j]] = i[j] | gLogger.info("\033[0;31m head[j]:%s i[j]:%s \033[0m" % (head[j],i[j])) if i[j] == "" or i[j] == None: i[j] = "-" tmp[head[j]] = i[j] else: if head[j] == "EventStat" or head[j] == "PhysicStat": tmp[head[j]] = self.__niceNumbers(i[j]) elif head[j] == "FileSize": tmp[head[j]] = i[j] tmp["NormalFileSize"] = self.__bytestr(... | def __showFiles(self,request,sortDict,StartItem,MaxItems): cl = LHCB_BKKDBClient(getRPCClient('Bookkeeping/BookkeepingManager')) lhcbGroup = credentials.getSelectedGroup() if lhcbGroup == "visitor": c.result = {"success":"false","error":"You are not authorised"} else: request = {'fullpath':request} result = cl.getLimit... |
def controller_scan(directory=None): """Scan a directory for python files and use them as controllers""" if directory is None: return [] def find_controllers(dirname, prefix=''): """Locate controllers in a directory""" controllers = [] if type( dirname ) not in ( types.ListType, types.TupleType ): dirs = [ dirname ] e... | def controller_scan( directory = None ): """Scan a directory for python files and use them as controllers""" if directory is None: return [] def find_controllers( dirname, prefix = '' ): """Locate controllers in a directory""" controllers = [] if type( dirname ) not in ( types.ListType, types.TupleType ): dirs = [ dir... | def controller_scan(directory=None): """Scan a directory for python files and use them as controllers""" if directory is None: return [] def find_controllers(dirname, prefix=''): """Locate controllers in a directory""" controllers = [] if type( dirname ) not in ( types.ListType, types.TupleType ): dirs = [ dirname ] e... |
granularity = rawData[ 'granularity' ] data = rawData['data'] tS = int( Time.toEpoch( params[2] ) ) timeStart = tS - tS % granularity strData = "epoch,%s\n" % ",".join( groupKeys ) for timeSlot in range( timeStart, int( Time.toEpoch( params[3] ) ), granularity ): lineData = [ str( timeSlot ) ] for key in groupKeys: if ... | groupKeys.sort() if 'granularity' in rawData: granularity = rawData[ 'granularity' ] data = rawData['data'] tS = int( Time.toEpoch( params[2] ) ) timeStart = tS - tS % granularity strData = "epoch,%s\n" % ",".join( groupKeys ) for timeSlot in range( timeStart, int( Time.toEpoch( params[3] ) ), granularity ): lineData =... | def getPlotData( self ): retVal = self.__parseFormParams() if not retVal[ 'OK' ]: c.error = retVal[ 'Message' ] return render( "/error.mako" ) params = retVal[ 'Value' ] repClient = ReportsClient( rpcClient = getRPCClient( "Accounting/ReportGenerator" ) ) retVal = repClient.getReport( *params ) if not retVal[ 'OK' ]: c... |
Get job sandbox """ print request.params | def getSandbox( self ): """ Get job sandbox """ | |
if selector == "Site" and tier1 and len(tier1) > 0: if key not in tier1: try: countryCode = key.rsplit(".",1)[1] except: countryCode = "Unknown" c.result.append({"Key":key,"Value":result[key],"Code":countryCode}) | if selector == "Site" and tier1 and (key not in tier1): try: countryCode = key.rsplit(".",1)[1] except: countryCode = "Unknown" c.result.append({"Key":key,"Value":result[key],"Code":countryCode}) elif selector == "Site" and not tier1: try: countryCode = key.rsplit(".",1)[1] except: countryCode = "Unknown" c.result.appe... | def __getStats(self,selector): req = self.__request() selector = str(selector) RPC = getRPCClient("WorkloadManagement/JobMonitoring") if selector == "Minor status": selector = "MinorStatus" elif selector == "Application status": selector = "ApplicationStatus" result = RPC.getJobStats(selector,req) if result["OK"]: c.re... |
pDict = dict( cgi.parse_qsl( params ) ) return ( config[ 'routes.map' ].match( ref ), pDict ) | pDict = dict( cgi.parse_qsl( params ) ) if not ref: ref = "/" return ( config[ 'routes.map' ].match( ref ), pDict ) | def __mapReferer(self): ref = request.environ[ 'HTTP_REFERER' ] ref = ref[ ref.find( "/", 8 ) : ] scriptName = request.environ[ 'SCRIPT_NAME' ] if scriptName: if scriptName[0] != "/": scriptName = "/%s" % scriptName if ref.find( scriptName ) == 0: ref = ref[ len( scriptName ): ] pI = ref.find( '?' ); if pI > -1: params... |
random.shuffle(self.teams) | def build(self,db,teams_,description): session = db.sessionmaker() self.teams = teams_ #random.shuffle(self.teams) self.description = description actual_team_num = len(teams_) padded_team_num = int( math.pow( 2, math.ceil( math.log( actual_team_num ) ) + 1 ) ) print 'got %d teams, padded to %d teams'%(actual_team_num,p... | |
padded_team_num = int( math.pow( 2, math.ceil( math.log( actual_team_num ) ) + 1 ) ) | padded_team_num = int( math.pow( 2, math.ceil( math.log( actual_team_num, 2 ) ) ) ) | def build(self,db,teams_,description): session = db.sessionmaker() self.teams = teams_ #random.shuffle(self.teams) self.description = description actual_team_num = len(teams_) padded_team_num = int( math.pow( 2, math.ceil( math.log( actual_team_num ) ) + 1 ) ) print 'got %d teams, padded to %d teams'%(actual_team_num,p... |
rounds = int( math.log( padded_team_num ) + 1 ) | rounds = int( math.log( padded_team_num, 2 ) + 1 ) | def build(self,db,teams_,description): session = db.sessionmaker() self.teams = teams_ #random.shuffle(self.teams) self.description = description actual_team_num = len(teams_) padded_team_num = int( math.pow( 2, math.ceil( math.log( actual_team_num ) ) + 1 ) ) print 'got %d teams, padded to %d teams'%(actual_team_num,p... |
for i in range(254): | for i in range(2054): | def addDefaultData(self): session = self.sessionmaker() self.nullPlayer = Player(nick='nullPlayer') session.add( self.nullPlayer ) self.nullTeam = Team( 'nullTeam' ) self.nullTeam.players.append( self.nullPlayer ) session.add( self.nullTeam ) session.commit() players = [] teams = [] for i in range(254): players.append(... |
for i in range(6): | for i in range(17): | def addDefaultData(self): session = self.sessionmaker() self.nullPlayer = Player(nick='nullPlayer') session.add( self.nullPlayer ) self.nullTeam = Team( 'nullTeam' ) self.nullTeam.players.append( self.nullPlayer ) session.add( self.nullTeam ) session.commit() players = [] teams = [] for i in range(254): players.append(... |
check(isinstance(month, str)) dbapi.return_strs_as_unicode(True) | check(isinstance(month, str), "Value of str should be regular string") return_strs_as_unicode(True) | def checkEqual(var1, var2): check(var1 == var2, "Values not equal: '" + str(var1) + "' !='" + str(var2) + "'") |
check(isinstance(month, unicode)) dbapi.return_strs_as_unicode(False) | check(isinstance(month, unicode), "Value of str should be unicode string") return_strs_as_unicode(False) | def checkEqual(var1, var2): check(var1 == var2, "Values not equal: '" + str(var1) + "' !='" + str(var2) + "'") |
check(isinstance(month, str)) | check(isinstance(month, str), "Value of str should be regular string") | def checkEqual(var1, var2): check(var1 == var2, "Values not equal: '" + str(var1) + "' !='" + str(var2) + "'") |
DebugPrint(4, "DEBUG: Received values " + vo_info['VOName'] + " and " + vo_info['ReportableVOName']) | if vo_info['VOName'] and vo_info['ReportableVOName']): DebugPrint(4, "DEBUG: Received values " + vo_info['VOName'] + " and " + vo_info['ReportableVOName']) elif (vo_info['VOName']): DebugPrint(4, "DEBUG: Received values " + vo_info['VOName'] + " and no reportableVOName") elif (vo_info['ReportableVOName']): DebugPrint(4... | def CheckAndExtendUserIdentity(xmlDoc, userIdentityNode, namespace, prefix): "Check the contents of the UserIdentity block and extend if necessary" result = { } # LocalUserId LocalUserIdNodes = userIdentityNode.getElementsByTagNameNS(namespace, 'LocalUserId') if not LocalUserIdNodes or LocalUserIdNodes.length != 1 or... |
responseString = __postResquest(__connection__, Config.get_CollectorService(), queryString) | responseString = __postRequest(__connection__, Config.get_CollectorService(), queryString) | def SendStatus(meterId): # This function is not yet used. # Use Handshake() and SendHandshake() instead. global __connection__ global __connectionError__ global __connectionRetries__ try: # Connect to the web service, in case we aren't already # connected. If we are already connected, this call will do # nothing ... |
val = self.__getConfigAttribute('grid') | val = self.__getConfigAttribute('Grid') | def get_grid(self): if self.__grid == None: val = self.__getConfigAttribute('grid') if val == None or val == r'': self.__grid = 'OSG' else: self.__grid = val return self.__grid |
result = self.__getConfigAttribute('SuppressgridLocalRecords') | result = self.__getConfigAttribute('SuppressGridLocalRecords') | def get_SuppressgridLocalRecords(self): result = self.__getConfigAttribute('SuppressgridLocalRecords') if result: match = re.search(r'^(True|1|t)$', result, re.IGNORECASE) if match: return True else: return False else: return False # If the config entry is missing, default to false |
self.GenericAddToList('grid', self.__grid, self.__gridDescription) | self.GenericAddToList('Grid', self.__grid, self.__gridDescription) | def XmlAddMembers(self): self.GenericAddToList('ProbeName', self.__ProbeName, self.__ProbeNameDescription) self.GenericAddToList('SiteName', self.__SiteName, self.__SiteNameDescription) self.GenericAddToList('grid', self.__grid, self.__gridDescription) |
gridNodes = recordElement.getElementsByTagNameNS(namespace, 'grid') | gridNodes = recordElement.getElementsByTagNameNS(namespace, 'Grid') | def StandardCheckXmldoc( xmlDoc, recordElement, external, prefix, ): '''Check for and fill in suitable values for important attributes''' if not xmlDoc.documentElement: # Major problem return if external: # Local namespace namespace = xmlDoc.documentElement.namespaceURI # ProbeName probeNameNodes = recordElement... |
node = xmlDoc.createElementNS(namespace, prefix + 'grid') | node = xmlDoc.createElementNS(namespace, prefix + 'Grid') | def StandardCheckXmldoc( xmlDoc, recordElement, external, prefix, ): '''Check for and fill in suitable values for important attributes''' if not xmlDoc.documentElement: # Major problem return if external: # Local namespace namespace = xmlDoc.documentElement.namespaceURI # ProbeName probeNameNodes = recordElement... |
'grid', | 'Grid', | def UsageCheckXmldoc(xmlDoc, external, resourceType=None): '''Fill in missing field in the xml document if needed''' DebugPrint(4, 'DEBUG: In UsageCheckXmldoc') DebugPrint(4, 'DEBUG: Checking xmlDoc integrity') if not xmlDoc.documentElement: # Major problem return 0 DebugPrint(4, 'DEBUG: Checking xmlDoc integrity: OK... |
grid = GetElement(xmlDoc, usageRecord, namespace, prefix, 'grid') | grid = GetElement(xmlDoc, usageRecord, namespace, prefix, 'Grid') | def UsageCheckXmldoc(xmlDoc, external, resourceType=None): '''Fill in missing field in the xml document if needed''' DebugPrint(4, 'DEBUG: In UsageCheckXmldoc') DebugPrint(4, 'DEBUG: Checking xmlDoc integrity') if not xmlDoc.documentElement: # Major problem return 0 DebugPrint(4, 'DEBUG: Checking xmlDoc integrity: OK... |
reason = 'grid == Local' | reason = 'Grid == Local' | def UsageCheckXmldoc(xmlDoc, external, resourceType=None): '''Fill in missing field in the xml document if needed''' DebugPrint(4, 'DEBUG: In UsageCheckXmldoc') DebugPrint(4, 'DEBUG: Checking xmlDoc integrity') if not xmlDoc.documentElement: # Major problem return 0 DebugPrint(4, 'DEBUG: Checking xmlDoc integrity: OK... |
GratiaCore.Config = Gratia.ProbeConfiguration(customConfig) | GratiaCore.Config = GratiaCore.ProbeConfiguration(customConfig) | def main(): """ Body of DebugPrint """ level = 0 customConfig = None try: opts, args = getopt.getopt(sys.argv[1:], "hc:l:", ["help", "conf=" , "level="]) except getopt.GetoptError: Usage() sys.exit(2) for opt, arg in opts: if opt in ["-h", "--help"]: Usage() sys.exit() if opt in ["-c", "--conf"]: customConfig = arg... |
GratiaCore.Config = Gratia.ProbeConfiguration() | GratiaCore.Config = GratiaCore.ProbeConfiguration() | def main(): """ Body of DebugPrint """ level = 0 customConfig = None try: opts, args = getopt.getopt(sys.argv[1:], "hc:l:", ["help", "conf=" , "level="]) except getopt.GetoptError: Usage() sys.exit(2) for opt, arg in opts: if opt in ["-h", "--help"]: Usage() sys.exit() if opt in ["-c", "--conf"]: customConfig = arg... |
result = self.__getConfigAttribute('__bundleSize__') | result = self.__getConfigAttribute('BundleSize') | def get_BundleSize(self): global __bundleSize__ result = self.__getConfigAttribute('__bundleSize__') if result: __bundleSize__ = int(result) elif result == None or result == r'': __bundleSize__ = 100 maxpending = self.get_MaxPendingFiles() if __bundleSize__ > maxpending: __bundleSize__ = maxpending return __bundleSize_... |
gratia_path = pathElement="../../" | gratia_path = pathElement+"/../../" | def configure(): cp = Config() gratia_path = None for pathElement in sys.path: if ( pathElement.find("probe/common") != -1 ): gratia_path = pathElement="../../" break if ( gratia_path == None ): raise Exception("gratia_path can not be determined from python path") if not os.path.exists(gratia_path): raise Exception... |
self._summarize = configuration.get_Summarize(); | self._summarize = configuration.get_Summarize() | def __init__( self, configuration, chkptdir=None ): # Pick up the logger self._log = logging.getLogger( 'DCacheAggregator' ) DBurl = 'postgres://' + configuration.get_DBLoginName() + ':' + \ configuration.get_DBPassword() + '@' + \ configuration.get_DBHostName() + ':5432/billing' |
new_interval = int(interval / 2) new_endtime = = starttime + datetime.timedelta(0, new_interval) | if (interval > 60): new_interval = 60 elif (interval > 30): new_interval = 30 elif (interval > 15): new_interval = 15 elif (interval > 5): new_interval = 5 else: new_interval = 1 new_endtime = starttime + datetime.timedelta(0, new_interval) | def _execute(self, starttime, endtime, maxSelect): """ Execute the select command against the Billing DB return the results (possibly summarized) |
startTime + ' contained undefined initiator field' ); | startTime + ' contained undefined initiator field' ) | def _convertBillingInfoToGratiaUsageRecord(self, row): """ Take a record returned from the database and convert it to a Gratia UsageRecord |
r = Gratia.UsageRecord('Storage') r.Njobs(row['njobs']) r.AdditionalInfo('Source', srcHost) r.AdditionalInfo('Destination', dstHost) r.AdditionalInfo('Protocol', row['protocol']) r.AdditionalInfo('IsNew', isNew) r.LocalJobId(row['transaction']) | rec = Gratia.UsageRecord('Storage') rec.Njobs(row['njobs']) rec.AdditionalInfo('Source', srcHost) rec.AdditionalInfo('Destination', dstHost) rec.AdditionalInfo('Protocol', row['protocol']) rec.AdditionalInfo('IsNew', isNew) rec.LocalJobId(row['transaction']) | def _convertBillingInfoToGratiaUsageRecord(self, row): """ Take a record returned from the database and convert it to a Gratia UsageRecord |
r.Grid("Local") | rec.Grid("Local") | def _convertBillingInfoToGratiaUsageRecord(self, row): """ Take a record returned from the database and convert it to a Gratia UsageRecord |
r.Grid(self._grid) r.StartTime(startTime) r.Network(row['transfersize'], 'b', connectionTimeStr, 'total', | rec.Grid(self._grid) rec.StartTime(startTime) rec.Network(row['transfersize'], 'b', connectionTimeStr, 'total', | def _convertBillingInfoToGratiaUsageRecord(self, row): """ Take a record returned from the database and convert it to a Gratia UsageRecord |
r.WallDuration(connectionTimeStr) | rec.WallDuration(connectionTimeStr) | def _convertBillingInfoToGratiaUsageRecord(self, row): """ Take a record returned from the database and convert it to a Gratia UsageRecord |
r.DN(row['initiator']) | rec.DN(row['initiator']) | def _convertBillingInfoToGratiaUsageRecord(self, row): """ Take a record returned from the database and convert it to a Gratia UsageRecord |
r.SubmitHost(initiatorHost) r.Status(row['errorcode']) | rec.SubmitHost(initiatorHost) rec.Status(row['errorcode']) | def _convertBillingInfoToGratiaUsageRecord(self, row): """ Take a record returned from the database and convert it to a Gratia UsageRecord |
r.LocalUserId( info[0] ) | rec.LocalUserId( info[0] ) | def _convertBillingInfoToGratiaUsageRecord(self, row): """ Take a record returned from the database and convert it to a Gratia UsageRecord |
return r | return rec | def _convertBillingInfoToGratiaUsageRecord(self, row): """ Take a record returned from the database and convert it to a Gratia UsageRecord |
start = checkpt.lastDateStamp() | initDate = checkpt.lastDateStamp() start = initDate | def _sendToGratia( self, tableName, checkpt, selectCMD, makeRecord ): # Pull up the _maxSelect records that are newer than the last checkpoint |
while(numDone == 0 and start<now) : | while(numDone < self._maxSelect and start<now) : | def _sendToGratia( self, tableName, checkpt, selectCMD, makeRecord ): # Pull up the _maxSelect records that are newer than the last checkpoint |
selectCMD = """ | initMaxSelect = self._maxSelect; maxSelect = 0; while (self._maxSelect != maxSelect): maxSelect = self._maxSelect selectCMD = """ | def sendBillingInfoRecordsToGratia( self ): # _sendToGratia will embed the latest datestamp and transaction value # from the checkpoint where %s is embedded in the command. self._log.debug( "sendBillingInfoRecordsToGratia" ) selectCMD = """ |
self._maxSelect) while self._sendToGratia( 'billinginfo', self._BIcheckpoint, selectCMD, self._convertBillingInfoToGratiaUsageRecord ) == self._maxSelect: self._log.debug( 'sendBillingInfoRecordsToGratia: looping' ) | maxSelect) while self._sendToGratia( 'billinginfo', self._BIcheckpoint, selectCMD, self._convertBillingInfoToGratiaUsageRecord ) == self._maxSelect: self._log.debug( 'sendBillingInfoRecordsToGratia: looping' ) self._maxSelect = initMaxSelect | def sendBillingInfoRecordsToGratia( self ): # _sendToGratia will embed the latest datestamp and transaction value # from the checkpoint where %s is embedded in the command. self._log.debug( "sendBillingInfoRecordsToGratia" ) selectCMD = """ |
if (nodeList == None) or (nodeList.length <= nodeIndex): return None | if (nodeList == None) or (nodeList.length <= nodeIndex) or (nodeList.item(0).firstChild == None): return None | def GetNodeData(nodeList, nodeIndex = 0): if (nodeList == None) or (nodeList.length <= nodeIndex): return None return nodeList.item(0).firstChild.data |
DebugPrint(-1, "result = " + str(result)) | def get_BundleSize(self): global BundleSize result = self.__getConfigAttribute("BundleSize") DebugPrint(-1, "result = " + str(result)) if result: BundleSize = int(result) elif result == None or result == "": BundleSize = 100 DebugPrint(-1, "BundleSize = " + str(BundleSize)) maxpending = self.get_MaxPendingFiles() if (B... | |
DebugPrint(-1, "BundleSize = " + str(BundleSize)) | def get_BundleSize(self): global BundleSize result = self.__getConfigAttribute("BundleSize") DebugPrint(-1, "result = " + str(result)) if result: BundleSize = int(result) elif result == None or result == "": BundleSize = 100 DebugPrint(-1, "BundleSize = " + str(BundleSize)) maxpending = self.get_MaxPendingFiles() if (B... | |
DebugPrint(4, "DEBUG: Calling verifyFromCertInfo: No VOName data") | DebugPrint(4, "DEBUG: No VOName data from verifyFromCertInfo") | def CheckAndExtendUserIdentity(xmlDoc, userIdentityNode, namespace, prefix): "Check the contents of the UserIdentity block and extend if necessary" result = { } # LocalUserId LocalUserIdNodes = userIdentityNode.getElementsByTagNameNS(namespace, 'LocalUserId') if not LocalUserIdNodes or LocalUserIdNodes.length != 1 or... |
if vo_info['VOName'] and vo_info['ReportableVOName']: DebugPrint(4, "DEBUG: Received values " + vo_info['VOName'] + " and " + vo_info['ReportableVOName']) elif (vo_info['VOName']): DebugPrint(4, "DEBUG: Received values " + vo_info['VOName'] + " and no reportableVOName") elif (vo_info['ReportableVOName']): DebugPrint(4,... | DebugPrint(4, "DEBUG: Received values VOName: " + str(vo_info['VOName']) + " and ReportableVOName: " + str(vo_info['ReportableVOName'])) | def CheckAndExtendUserIdentity(xmlDoc, userIdentityNode, namespace, prefix): "Check the contents of the UserIdentity block and extend if necessary" result = { } # LocalUserId LocalUserIdNodes = userIdentityNode.getElementsByTagNameNS(namespace, 'LocalUserId') if not LocalUserIdNodes or LocalUserIdNodes.length != 1 or... |
for Subcluster in getSubcluster(xmlDoc): | for Subcluster in getSubclusters(xmlDoc): | def SubclusterCheckXmldoc(xmlDoc,external,resourceType = None): " Fill in missing field in the xml document if needed " " If external is true, also check for ProbeName, SiteName " if not xmlDoc.documentElement: return 0 # Major problem # Local namespace namespace = xmlDoc.documentElement.namespaceURI # Loop over (pos... |
mytime = str(int(time.time())) | mytime = "0" | def emit(self, cur, prev=None): # Just one event if prev == None: if 'GlobalJobId' not in cur: try: hostname = socket.getfqdn() except: hostname = "UNKNOWN" cluster = cur.get("Cluster", "-1") proc = cur.get("Proc", "-1") job = "%s.%s" % (str(cluster), str(proc)) mytime = str(int(time.time())) cur['GlobalJobId'] = "#".j... |
assert endtime > result | assert endtime > starttime | def _execute(self, starttime, endtime, maxSelect): """ Execute the select command against the Billing DB; process the results. |
if (longname != "ATLAS" and longname!=""): | if (longname != "ATLAS" and longname!="" and longname.lower() not in ret): | def GetListOfOSGRegisteredVO(voStatus, beginDate, endDate): filter = "/VOActivation/" + voStatus + "/VO/Name|/VOActivation/" + voStatus + "/VO/LongName" allVos = GetListOfVOs(filter,voStatus,beginDate,endDate) ret = [] printederror = False for pair in allVos: try: (longname,description) = pair; # pair.split(","); exce... |
__grid = None | __Grid = None | def __disconnect_at_exit__(): """ Insure that we properly shutdown the connection at the end of the process. This includes sending any outstanding records and printing the statistics """ if __bundleSize__ > 1 and CurrentBundle.nItems > 0: (responseString, response) = ProcessBundle(CurrentBundle) DebugPrint(0, respons... |
def get_grid(self): if self.__grid == None: | def get_Grid(self): if self.__Grid == None: | def get_grid(self): if self.__grid == None: val = self.__getConfigAttribute('Grid') if val == None or val == r'': self.__grid = 'OSG' else: self.__grid = val return self.__grid |
self.__grid = 'OSG' | self.__Grid = 'OSG' | def get_grid(self): if self.__grid == None: val = self.__getConfigAttribute('Grid') if val == None or val == r'': self.__grid = 'OSG' else: self.__grid = val return self.__grid |
self.__grid = val return self.__grid | self.__Grid = val return self.__Grid | def get_grid(self): if self.__grid == None: val = self.__getConfigAttribute('Grid') if val == None or val == r'': self.__grid = 'OSG' else: self.__grid = val return self.__grid |
__grid = r'' __gridDescription = r'' | __Grid = r'' __GridDescription = r'' | def TimeToString(targ=time.gmtime()): return time.strftime('%Y-%m-%dT%H:%M:%SZ', targ) |
self.__grid = Config.get_grid() | self.__Grid = Config.get_Grid() | def __init__(self): |
self.GenericAddToList('Grid', self.__grid, self.__gridDescription) | self.GenericAddToList('Grid', self.__Grid, self.__GridDescription) | def XmlAddMembers(self): self.GenericAddToList('ProbeName', self.__ProbeName, self.__ProbeNameDescription) self.GenericAddToList('SiteName', self.__SiteName, self.__SiteNameDescription) self.GenericAddToList('Grid', self.__grid, self.__gridDescription) |
def grid(self, value, description=r''): | def Grid(self, value, description=r''): | def grid(self, value, description=r''): ''' Indicates which grid the service accounted for belong to''' |
self.__grid = value self.__gridDescription = description | self.__Grid = value self.__GridDescription = description | def grid(self, value, description=r''): ''' Indicates which grid the service accounted for belong to''' |
textNode = xmlDoc.createTextNode(Config.get_grid()) | textNode = xmlDoc.createTextNode(Config.get_Grid()) | def StandardCheckXmldoc( xmlDoc, recordElement, external, prefix, ): '''Check for and fill in suitable values for important attributes''' if not xmlDoc.documentElement: # Major problem return if external: # Local namespace namespace = xmlDoc.documentElement.namespaceURI # ProbeName probeNameNodes = recordElement... |
grid_info = Config.get_grid() | grid_info = Config.get_Grid() | def StandardCheckXmldoc( xmlDoc, recordElement, external, prefix, ): '''Check for and fill in suitable values for important attributes''' if not xmlDoc.documentElement: # Major problem return if external: # Local namespace namespace = xmlDoc.documentElement.namespaceURI # ProbeName probeNameNodes = recordElement... |
sum = 0 for r in records: if ( fieldName != None and fieldValue != None): if (r[fieldName] == fieldValue ): sum = sum + r['transfersize'] else: sum = sum + r['transfersize'] return sum | return sum | def countBy(records, fieldName, fieldValue): sum = 0 for r in records: if ( fieldName != None and fieldValue != None): if (r[fieldName] == fieldValue ): sum = sum + r['transfersize'] else: sum = sum + r['transfersize'] return sum |
title = """\ OSG Data transfer summary for %s - %s (midnight UTC - midnight UTC) including all data that transferred in that time period. Deltas are the differences with the previous period.""" headline = "For all data transferred between %s and %s (midnight, UTC)" | title = "" headline = "" | def GetData(self, start, end): return RangeSiteData(start, end, self.with_panda) |
select = "select sum(Njobs),sum(TransferDuration) from " + schema + "MasterTransferSummary where StartTime >= \"" + DateToString(begin) + "\" and StartTime < \"" + DateToString(end) + "\"" result = RunQueryAndSplit(select)[0].split('\t'); | select = "select T.SiteName, M.Protocol, sum(M.Njobs) as Njobs, round(sum(M.TransferSize * Multiplier ),0) as SizeTotal, round(sum(M.TransferSize * Multiplier )/sum(TransferDuration),4) as rate, round(sum(TransferDuration),2) as duration from gratia_osg_transfer.MasterTransferSummary M, gratia_osg_transfer.Probe P, gra... | def GetDataTransferTotals(begin,end): global gMySQLConnectString, gDBCurrent schema = gDBSchema[transferDB] + "."; gDBCurrent = transferDB keepConnectionValue = gMySQLConnectString gMySQLConnectString = gMySQLTransferConnectString select = "select sum(Njobs),sum(TransferDuration) from " + schema + "MasterTransferSummar... |
return result | return (njobs,size,avg,dur) | def GetDataTransferTotals(begin,end): global gMySQLConnectString, gDBCurrent schema = gDBSchema[transferDB] + "."; gDBCurrent = transferDB keepConnectionValue = gMySQLConnectString gMySQLConnectString = gMySQLTransferConnectString select = "select sum(Njobs),sum(TransferDuration) from " + schema + "MasterTransferSummar... |
gridDisplayName = "" | gridDisplayName = "OSG" | def DataTransferSumup(range_end = datetime.date.today(), range_begin = None, output = "text", header = True): if not gGrid or gGrid.lower() == 'local': try: gridDisplayName = gConfig.get("local", "grid_name") except: gridDisplayName = "" else: gridDisplayName = 'OSG' if not range_end: if not range_begin: range_end = ... |
gridDisplayName = 'OSG' | gridDisplayName = gGrid | def DataTransferSumup(range_end = datetime.date.today(), range_begin = None, output = "text", header = True): if not gGrid or gGrid.lower() == 'local': try: gridDisplayName = gConfig.get("local", "grid_name") except: gridDisplayName = "" else: gridDisplayName = 'OSG' if not range_end: if not range_begin: range_end = ... |
completeSiteList = list(set(regSites) | set(exceptionSites) | set(reportingSites) | set(pingSites) | set(disabledSites)) | def DataTransferSumup(range_end = datetime.date.today(), range_begin = None, output = "text", header = True): if not gGrid or gGrid.lower() == 'local': try: gridDisplayName = gConfig.get("local", "grid_name") except: gridDisplayName = "" else: gridDisplayName = 'OSG' if not range_end: if not range_begin: range_end = ... | |
allSites = [name for name in regSites if name not in exceptionSites] | allSites = restoreOriginalCase([name for name in listToLower(regSites) if name not in listToLower(exceptionSites)], completeSiteList) | def DataTransferSumup(range_end = datetime.date.today(), range_begin = None, output = "text", header = True): if not gGrid or gGrid.lower() == 'local': try: gridDisplayName = gConfig.get("local", "grid_name") except: gridDisplayName = "" else: gridDisplayName = 'OSG' if not range_end: if not range_begin: range_end = ... |
missingSites = [name for name in allSites if name not in \ reportingSites and name not in pingSites] emptySites = [name for name in allSites if name not in reportingSites \ and name in pingSites] extraSites = [name for name in reportingSites if allSites and name not in \ allSites and disabledSites and name not in disa... | missingSites = restoreOriginalCase([name for name in listToLower(allSites) if name not in \ listToLower(reportingSites) and name not in listToLower(pingSites)], completeSiteList) emptySites = restoreOriginalCase([name for name in listToLower(allSites) if name not in listToLower(reportingSites) \ and name in listToLower... | def DataTransferSumup(range_end = datetime.date.today(), range_begin = None, output = "text", header = True): if not gGrid or gGrid.lower() == 'local': try: gridDisplayName = gConfig.get("local", "grid_name") except: gridDisplayName = "" else: gridDisplayName = 'OSG' if not range_end: if not range_begin: range_end = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.