def __call__(self): server = HTTPRequests(self.serverurl, self.proxyfilename, self.proxyfilename, version=__version__) self.logger.debug('Looking up detailed status of task %s' % self.cachedinfo['RequestName']) dictresult, status, reason = server.get(self.uri, data = { 'workflow' : self.cachedinfo['RequestName']}) dictresult = dictresult['result'][0] #take just the significant part if status != 200: msg = "Problem retrieving status:\ninput:%s\noutput:%s\nreason:%s" % (str(self.cachedinfo['RequestName']), str(dictresult), str(reason)) raise RESTCommunicationException(msg) self.logger.debug(dictresult) #should be something like {u'result': [[123, u'ciao'], [456, u'ciao']]} self.logger.info("Task name:\t\t\t%s" % self.cachedinfo['RequestName']) self.logger.info("Task status:\t\t\t%s" % dictresult['status']) def logJDefErr(jdef): """Printing job def failures if any""" if jdef['jobdefErrors']: self.logger.error("%sFailed to inject %s\t%s out of %s:" %(colors.RED, colors.NORMAL,\ jdef['failedJobdefs'], jdef['totalJobdefs'])) for error in jdef['jobdefErrors']: self.logger.info("\t%s" % error) #Print the url of the panda monitor if dictresult['taskFailureMsg']: self.logger.error("%sError during task injection:%s\t%s" % (colors.RED,colors.NORMAL,dictresult['taskFailureMsg'])) # We might also have more information in the job def errors logJDefErr(jdef=dictresult) elif dictresult['jobSetID']: username = urllib.quote(getUserName(self.logger)) self.logger.info("Panda url:\t\t\thttp://pandamon-cms-dev.cern.ch/jobinfo?jobtype=*&jobsetID=%s&prodUserName=%s" % (dictresult['jobSetID'], username)) # We have cases where the job def errors are there but we have a job def id logJDefErr(jdef=dictresult) #Print information about jobs states = dictresult['jobsPerStatus'] total = sum( states[st] for st in states ) frmt = '' for status in states: frmt += status + ' %s\t' % self._percentageString(states[status], total) if frmt: self.logger.info('Details:\t\t\t%s' % frmt)
def printShort(self, dictresult, username): self.logger.debug(dictresult) #should be something like {u'result': [[123, u'ciao'], [456, u'ciao']]} self.logger.info("Task name:\t\t\t%s" % self.cachedinfo['RequestName']) self.logger.info("Task status:\t\t\t%s" % dictresult['status']) def logJDefErr(jdef): """Printing job def failures if any""" if jdef['jobdefErrors']: self.logger.error("%sFailed to inject %s\t%s out of %s:" %(colors.RED, colors.NORMAL,\ jdef['failedJobdefs'], jdef['totalJobdefs'])) for error in jdef['jobdefErrors']: self.logger.info("\t%s" % error) #Print the url of the panda monitor if dictresult['taskFailureMsg']: self.logger.error("%sError during task injection:%s\t%s" % (colors.RED,colors.NORMAL,dictresult['taskFailureMsg'])) # We might also have more information in the job def errors logJDefErr(jdef=dictresult) elif self.cachedinfo['RequestName'] == dictresult['jobSetID']: # CRAB3-HTCondor taskname = urllib.quote(dictresult['jobSetID']) self.logger.info("Glidemon monitoring URL:\thttp://glidemon.web.cern.ch/glidemon/jobs.php?taskname=%s" % taskname) dashurl = 'http://dashb-cms-job.cern.ch/dashboard/templates/task-analysis/#user='******'&refresh=0&table=Jobs&p=1&records=25&activemenu=2&status=&site=&tid='+taskname self.logger.info("Dashboard monitoring URL:\t%s" % dashurl) elif dictresult['jobSetID']: username = urllib.quote(getUserName(self.voRole, self.voGroup, self.logger)) self.logger.info("Panda url:\t\t\thttp://pandamon-cms-dev.cern.ch/jobinfo?jobtype=*&jobsetID=%s&prodUserName=%s" % (dictresult['jobSetID'], username)) # We have cases where the job def errors are there but we have a job def id logJDefErr(jdef=dictresult) #Print information about jobs states = dictresult['jobsPerStatus'] if states: total = sum( states[st] for st in states ) state_list = sorted(states) self.logger.info("Details:\t\t\t{0} {1}".format(self._printState(state_list[0], 13), self._percentageString(state_list[0], states[state_list[0]], total))) for status in state_list[1:]: self.logger.info("\t\t\t\t{0} {1}".format(self._printState(status, 13), self._percentageString(status, states[status], total)))