Exemplo n.º 1
0
    def __call__(self):
        self.logger.debug("uploadlog started")
        taskname = None
        #veryfing the log file exist
        if self.options.logpath is not None:
            logfilename = str(time.strftime("%Y-%m-%d_%H%M%S")) + '_crab.log'
            self.logfile = self.options.logpath
        elif os.path.isfile(self.logfile):
            self.logger.debug("crab.log exists")
            try:
                taskname = self.cachedinfo['RequestName']
                logfilename = str(taskname) + ".log"
            except:
                self.logger.info(
                    "Couldn't get information from .requestcache (file likely not created due to submission failure), try\n"
                    "'crab uploadlog --logpath=<path-to-log-file-in-project-dir>'"
                )
                return
        else:
            msg = "%sError%s: Could not locate log file." % (colors.RED,
                                                             colors.NORMAL)
            self.logger.info(msg)
            raise ConfigurationException

        self.logger.info("Will upload file %s." % (self.logfile))
        logfileurl = uploadlogfile(self.logger, self.proxyfilename, taskname = taskname, logfilename = logfilename, \
                                   logpath = str(self.logfile), instance = self.instance, \
                                   serverurl = self.serverurl)
        return {'result': {'status': 'SUCCESS', 'logurl': logfileurl}}
Exemplo n.º 2
0
    def __call__(self):
        self.logger.debug("uploadlog started")
        #veryfing the log file exist
        if hasattr(self.options, 'logpath') and self.options.logpath != None:
            logfilename = str(time.strftime("%Y-%m-%d_%H%M%S"))+'_crab.log'
            self.logfile = self.options.logpath
        elif path.isfile(self.logfile):
            self.logger.debug("crab.log exists")
            logfilename=str(self.cachedinfo['RequestName'])+".log"
        else:
            self.logger.info("%sError:%s Could not locate log file" % (colors.RED, colors.NORMAL))
            raise ConfigurationException

        logfileurl = uploadlogfile(self.logger, self.proxyfilename, logfilename = logfilename, \
                                   logpath = str(self.logfile), instance = self.instance, \
                                   serverurl = self.serverurl)
        return {'result' : {'status' : 'SUCCESS' , 'logurl' : logfileurl}}
Exemplo n.º 3
0
    def __call__(self):
        self.logger.debug("uploadlog started")
        #veryfing the log file exist
        if hasattr(self.options, 'logpath') and self.options.logpath != None:
            logfilename = str(time.strftime("%Y-%m-%d_%H%M%S")) + '_crab.log'
            self.logfile = self.options.logpath
        elif path.isfile(self.logfile):
            self.logger.debug("crab.log exists")
            logfilename = str(self.cachedinfo['RequestName']) + ".log"
        else:
            self.logger.info("%sError:%s Could not locate log file" %
                             (colors.RED, colors.NORMAL))
            raise ConfigurationException

        logfileurl = uploadlogfile(self.logger, self.proxyfilename, logfilename = logfilename, \
                                   logpath = str(self.logfile), instance = self.instance, \
                                   serverurl = self.serverurl)
        return {'result': {'status': 'SUCCESS', 'logurl': logfileurl}}
Exemplo n.º 4
0
    def __call__(self):
        self.logger.debug("uploadlog started")
        # veryfing the log file exist
        if self.options.logpath is not None:
            logfilename = str(time.strftime("%Y-%m-%d_%H%M%S")) + "_crab.log"
            self.logfile = self.options.logpath
        elif os.path.isfile(self.logfile):
            self.logger.debug("crab.log exists")
            logfilename = str(self.cachedinfo["RequestName"]) + ".log"
        else:
            msg = "%sError%s: Could not locate log file." % (colors.RED, colors.NORMAL)
            self.logger.info(msg)
            raise ConfigurationException

        self.logger.info("Will upload file %s." % (self.logfile))
        logfileurl = uploadlogfile(
            self.logger,
            self.proxyfilename,
            logfilename=logfilename,
            logpath=str(self.logfile),
            instance=self.instance,
            serverurl=self.serverurl,
        )
        return {"result": {"status": "SUCCESS", "logurl": logfileurl}}
Exemplo n.º 5
0
    def __call__(self):
        self.logger.debug("uploadlog started")
        #veryfing the log file exist
        if self.options.logpath is not None:
            logfilename = str(time.strftime("%Y-%m-%d_%H%M%S"))+'_crab.log'
            self.logfile = self.options.logpath
        elif os.path.isfile(self.logfile):
            self.logger.debug("crab.log exists")
            if hasattr(self, 'cachedinfo') and 'RequestName' in self.cachedinfo:
                logfilename = str(self.cachedinfo['RequestName'])+".log"
            else:
                self.logger.info("Couldn't get information from .requestcache (file likely not created due to submission failure), try\n"
                        "'crab uploadlog --logpath=<path-to-log-file-in-project-dir>'")
                return
        else:
            msg = "%sError%s: Could not locate log file." % (colors.RED, colors.NORMAL)
            self.logger.info(msg)
            raise ConfigurationException

        self.logger.info("Will upload file %s." % (self.logfile))
        logfileurl = uploadlogfile(self.logger, self.proxyfilename, logfilename = logfilename, \
                                   logpath = str(self.logfile), instance = self.instance, \
                                   serverurl = self.serverurl)
        return {'result' : {'status' : 'SUCCESS' , 'logurl' : logfileurl}}