def PopConCronjobTailFetcherShort(self, *args, **kwargs): #if we have correct parameter in page query to get info if "hashName" in kwargs: #if parameter value is one of correct possibilities if kwargs["hashName"] in self.tabsNames: #add .log to fileName for db query fileName = kwargs["hashName"] + ".log" #set the tab name as loaded(that later we won't load it again) self.page = kwargs["hashName"] #if parameter value is bad else: #raise error raise cherrypy.HTTPError(405, "Bad parameter value after #!!!!! You typed: [" + kwargs["hashName"] +"]" ) #if there is no needed parameter in page query to get info else: #raise error raise cherrypy.HTTPError(405, "Error while receiving data from server!!!") #If everything was good get information from db about tha tab (return value dict) CTF = popconSQL.popconSQL().PopConCronjobTailFetcher(self.auth, "where filename='{0}'".format(fileName)) #if tab name was OfflineDropBox if self.page == "OfflineDropBox": #check if in information there is errors or warnings and mark up them if true CTF["aaData"]["OfflineDropBox"] = self.insertWarningAndErrorMarkups(CTF["aaData"]["OfflineDropBox"], self.page) #if tab name is not DropBox else: #do error , warnings check and markup for that tab CTF["aaData"] = self.insertWarningAndErrorMarkups(CTF["aaData"], self.page) #put data in dict items = {'items' : [CTF]} #return information to page as json dict return json.dumps(items)
def checkLongTail(self, *args, **kwargs): serviceName = kwargs['serviceName'] if serviceName in self.tabsNames: CTF = popconSQL.popconSQL().checkLongTail(self.auth,serviceName=serviceName) return json.dumps(CTF) else: raise cherrypy.HTTPError(405, "Bad serviceName: '" + serviceName + "' not in allowed list.") return
def PopConCronjobTailFetcherStatus(self, *args, **kwargs): serviceName = kwargs['serviceName'] if serviceName in self.tabsNames: CTF = popconSQL.popconSQL().PopConCronjobTailFetcherStatus(self.auth,serviceName=serviceName) return json.dumps(CTF) else: raise cherrypy.HTTPError(405, "Bad serviceName: '" + serviceName + "' not in allowed list.") return
def PopConRecentActivityRecorded(self, *args, **kwargs): rownumbers=500 account="" payloadContainer="" iovTag="" startDate="" endDate="" if len(args) == 0 and len(kwargs) == 0: RACData = popconSQL.popconSQL().PopConRecentActivityRecorded(self.auth, rownumbers, account, payloadContainer, iovTag, startDate, endDate) else: raise cherrypy.HTTPError(405, "There has to be no arguments or parameters!!!!!") return json.dumps(RACData)
def popconActivityHisto(self, *args, **kwargs): account="" startDate="" endDate="" if len(args) == 0 and len(kwargs) == 0: AHData = popconSQL.popconSQL().popconActivityHisto(self.auth, account) #AHDataInJson = json_provider.JsonProvider().json_dict_output(data_dict=AHData, title="Activity History recorded") AHDataInJson = json_provider.JsonProvider().json_dict_output_barstack2(data_dict=AHData, title="Activity History recorded") AHDataInJson2 =""" { "elements": [ { "type": "bar_stack", "colours": [ "#C4D318", "#50284A", "#7D7B6A" ], "values": [ [ 2.5, 5, 2.5 ], [ 2.5, 5, 1.25, 1.25 ], [ 5, { "val": 5, "colour": "#ff0000" } ], [ 2, 2, 2, 2, { "val": 2, "colour": "#ff00ff" } ] ], "keys": [ { "colour": "#C4D318", "text": "Kiting", "font-size": 13 }, { "colour": "#50284A", "text": "Work", "font-size": 13 }, { "colour": "#7D7B6A", "text": "Drinking", "font-size": 13 }, { "colour": "#ff0000", "text": "XXX", "font-size": 13 }, { "colour": "#ff00ff", "text": "What rhymes with purple? Nurple?", "font-size": 13 } ], "tip": "X label [#x_label#], Value [#val#] Total [#total#]" } ], "title": { "text": "Stuff I'm thinking about, Tue May 18 2010", "style": "{font-size: 20px; color: #F24062; text-align: center;}" }, "x_axis": { "labels": { "labels": [ "Winter", "Spring", "Summer", "Autmn" ] } }, "y_axis": { "min": 0, "max": 14, "steps": 2 }, "tooltip": { "mouse": 2 } } """ else: raise cherrypy.HTTPError(405, "No arguments or parameters allowed for this function !!!!!") return AHDataInJson
def PopConCronjobTailFetcher(self, *args, **kwargs): #if there is no params in url between / ... /.../ and if there is correct parameter hashName if len(args) == 0 and len(kwargs) == 1 and "hashName" in kwargs: #get informaion about all tabs from db CTF = popconSQL.popconSQL().PopConCronjobTailFetcher(self.auth) #if in url there were selected tab if self.page != "": #if that selected tab is OfflneDropBox if self.page == "OfflineDropBox": # delete information about that tab because it was loaded and we don't have to reload del CTF["aaData"][self.page] # set selected tab to null self.page = "" #if selected tab is not OfflinDropBox else: # check if there is errors or warnings in given information # if yes add html class that we could mark up that info returns new data with marked classes # if no just return the same information CTF["aaData"] = self.insertWarningAndErrorMarkups(CTF["aaData"], self.page) # do the same as above to OfflineDropBox(OfflineDropBox needs separate call because its information is different than others) return new data CTF["aaData"]["OfflineDropBox"] = self.insertWarningAndErrorMarkups(CTF["aaData"]["OfflineDropBox"], "OfflineDropBox") # delete info about that tab which was loaded alone del CTF["aaData"][self.page] self.page = "" #if in url there were no selected tabs - load all tabs at once else: #checks for the errors and warnings as described above CTF["aaData"] = self.insertWarningAndErrorMarkups(CTF["aaData"], self.page) CTF["aaData"]["OfflineDropBox"] = self.insertWarningAndErrorMarkups(CTF["aaData"]["OfflineDropBox"], "OfflineDropBox") #put information in dictionary items = {'items' : [CTF]} #if url were not like it has to be else: #raise error raise cherrypy.HTTPError(405, "There has to be no arguments or parameters!!!!!") #if everything went fine return information in json return json.dumps(items)