示例#1
0
    def setupHPCEvent(self):
        self.__jobSite = Site.Site()
        self.__jobSite.setSiteInfo(self.argumentParser())
        ## For HPC job, we don't need to reassign the workdir
        # reassign workdir for this job
        self.__jobSite.workdir = self.__jobSite.wntmpdir
        if not os.path.exists(self.__jobSite.workdir):
            os.makedirs(self.__jobSite.workdir)


        tolog("runJobHPCEvent.getPilotLogFilename=%s"% self.getPilotLogFilename())
        if self.getPilotLogFilename() != "":
            pUtil.setPilotlogFilename(self.getPilotLogFilename())

        # set node info
        self.__node = Node.Node()
        self.__node.setNodeName(os.uname()[1])
        self.__node.collectWNInfo(self.__jobSite.workdir)

        # redirect stderr
        #sys.stderr = open("%s/runJobHPCEvent.stderr" % (self.__jobSite.workdir), "w")

        tolog("Current job workdir is: %s" % os.getcwd())
        tolog("Site workdir is: %s" % self.__jobSite.workdir)

        # get the experiment object
        self.__thisExperiment = getExperiment(self.getExperiment())
        tolog("runEvent will serve experiment: %s" % (self.__thisExperiment.getExperiment()))
示例#2
0
    def setupHPCEvent(self):
        self.__jobSite = Site.Site()
        self.__jobSite.setSiteInfo(self.argumentParser())
        ## For HPC job, we don't need to reassign the workdir
        # reassign workdir for this job
        self.__jobSite.workdir = self.__jobSite.wntmpdir
        if not os.path.exists(self.__jobSite.workdir):
            os.makedirs(self.__jobSite.workdir)

        tolog("runJobHPCEvent.getPilotLogFilename=%s" %
              self.getPilotLogFilename())
        if self.getPilotLogFilename() != "":
            pUtil.setPilotlogFilename(self.getPilotLogFilename())

        # set node info
        self.__node = Node.Node()
        self.__node.setNodeName(os.uname()[1])
        self.__node.collectWNInfo(self.__jobSite.workdir)

        # redirect stderr
        #sys.stderr = open("%s/runJobHPCEvent.stderr" % (self.__jobSite.workdir), "w")

        tolog("Current job workdir is: %s" % os.getcwd())
        tolog("Site workdir is: %s" % self.__jobSite.workdir)

        # get the experiment object
        self.__thisExperiment = getExperiment(self.getExperiment())
        tolog("runEvent will serve experiment: %s" %
              (self.__thisExperiment.getExperiment()))
示例#3
0
    def __exit__(self, *args):
        global log_useful

        if not self.same:
            log("Staging down log file")

            self.useful = self.useful and log_useful
            log_useful = self.__old_useful

            os.chdir(os.path.dirname(self.__global_old))
            pUtil.setPilotlogFilename(self.__old_name)

            if not self.useful:
                os.remove(self.__global)
示例#4
0
    def __exit__(self, *args):
        global log_useful

        if not self.same:
            log("Staging down log file")

            self.useful = self.useful and log_useful
            log_useful = self.__old_useful

            os.chdir(os.path.dirname(self.__global_old))
            pUtil.setPilotlogFilename(self.__old_name)

            if not self.useful:
                os.remove(self.__global)
示例#5
0
    def __enter__(self):
        global log_useful
        self.__old_name = pUtil.getPilotlogFilename()

        if not self.__name or self.__name == self.__old_name:
            self.same = True
        else:
            log("Staging up log file, new log file is %s" % self.__name)

            self.__global_old = os.path.abspath(self.__old_name)
            self.__global = os.path.abspath(self.__name)
            pUtil.setPilotlogFilename(self.__global)

            self.__old_useful = log_useful
            log_useful = False

        return self
示例#6
0
    def __enter__(self):
        global log_useful
        self.__old_name = pUtil.getPilotlogFilename()

        if not self.__name or self.__name == self.__old_name:
            self.same = True
        else:
            log("Staging up log file, new log file is %s" % self.__name)

            self.__global_old = os.path.abspath(self.__old_name)
            self.__global = os.path.abspath(self.__name)
            pUtil.setPilotlogFilename(self.__global)

            self.__old_useful = log_useful
            log_useful = False

        return self
示例#7
0
        # always use this filename as the new jobDef module name
        import newJobDef

        jobSite = Site.Site()

        return_tuple = runJob.argumentParser()
        tolog("argumentParser returned: %s" % str(return_tuple))
        jobSite.setSiteInfo(return_tuple)

#            jobSite.setSiteInfo(argParser(sys.argv[1:]))

        # reassign workdir for this job
        jobSite.workdir = jobSite.wntmpdir

        if runJob.getPilotLogFilename() != "":
            pUtil.setPilotlogFilename(runJob.getPilotLogFilename())

        # set node info
        node = Node.Node()
        node.setNodeName(os.uname()[1])
        node.collectWNInfo(jobSite.workdir)

        # redirect stder
        sys.stderr = open("%s/runjob.stderr" % (jobSite.workdir), "w")

        tolog("Current job workdir is: %s" % os.getcwd())
        tolog("Site workdir is: %s" % jobSite.workdir)
        # get the experiment object
        thisExperiment = getExperiment(runJob.getExperiment())

        tolog("RunJob will serve experiment: %s" % (thisExperiment.getExperiment()))
示例#8
0
        # always use this filename as the new jobDef module name
        import newJobDef

        jobSite = Site.Site()

        return_tuple = runJob.argumentParser()
        tolog("argumentParser returned: %s" % str(return_tuple))
        jobSite.setSiteInfo(return_tuple)

        #            jobSite.setSiteInfo(argParser(sys.argv[1:]))

        # reassign workdir for this job
        jobSite.workdir = jobSite.wntmpdir

        if runJob.getPilotLogFilename() != "":
            pUtil.setPilotlogFilename(runJob.getPilotLogFilename())

        # set node info
        node = Node.Node()
        node.setNodeName(os.uname()[1])
        node.collectWNInfo(jobSite.workdir)

        # redirect stder
        sys.stderr = open("%s/runjob.stderr" % (jobSite.workdir), "w")

        tolog("Current job workdir is: %s" % os.getcwd())
        tolog("Site workdir is: %s" % jobSite.workdir)
        # get the experiment object
        thisExperiment = getExperiment(runJob.getExperiment())

        tolog("RunJob will serve experiment: %s" %
示例#9
0
            except Exception, e:
                self.__pilotErrorDiag = "Failed to create recovery reports dir: %s" % (e)
                tolog(self.__errorString % self.__pilotErrorDiag)
            else:
                tolog("Created %s" % (_path))
                status = True
        else:
            status = True

        if status:
            # proceed to set the log file
            fileName = os.path.join(_path, "recovery_report-%s-%d.txt" % (self.__jobId, self.__recoveryAttempt))
            msg = "Redirecting log messages to: " % (fileName)
            print msg
            tolog(msg)
            setPilotlogFilename(fileName)

        return status

    def updateJobStateTest(self, job, thisSite, workerNode, recoveryAttempt=0, mode=""):
        """ update the job state file """

        # NOTE: this function will eventually replace pilot::updateJobState() when new job rec is in place

        status = False

        # IGNORE TEST MODE
        mode = ""

        # create a job state object and give it the current job state information
        JS = JobState()
示例#10
0
    # get error handler
    error = PilotErrors()

    # protect the runJob code with exception handling
    hP_ret = False
    try:
        # always use this filename as the new jobDef module name
        import newJobDef

        jobSite = Site.Site()
        jobSite.setSiteInfo(argParser(sys.argv[1:]))
        # reassign workdir for this job
        jobSite.workdir = jobSite.wntmpdir
    
        if pilotlogfilename != "":
            pUtil.setPilotlogFilename(pilotlogfilename)
    
        # set node info
        node = Node.Node()
        node.setNodeName(os.uname()[1])
        node.collectWNInfo(jobSite.workdir)
    
        # redirect stder
        sys.stderr = open("%s/runjob.stderr" % (jobSite.workdir), "w")
    
        tolog("Current job workdir is: %s" % os.getcwd())
        tolog("Site workdir is: %s" % jobSite.workdir)

        # get the experiment object
        thisExperiment = getExperiment(experiment)
        tolog("runJob will serve experiment: %s" % (thisExperiment.getExperiment()))
示例#11
0
                tolog(self.__errorString % self.__pilotErrorDiag)
            else:
                tolog("Created %s" % (_path))
                status = True
        else:
            status = True

        if status:
            # proceed to set the log file
            fileName = os.path.join(
                _path, "recovery_report-%s-%d.txt" %
                (self.__jobId, self.__recoveryAttempt))
            msg = "Redirecting log messages to: " % (fileName)
            print msg
            tolog(msg)
            setPilotlogFilename(fileName)

        return status

    def updateJobStateTest(self,
                           job,
                           thisSite,
                           workerNode,
                           recoveryAttempt=0,
                           mode=""):
        """ update the job state file """

        # NOTE: this function will eventually replace pilot::updateJobState() when new job rec is in place

        status = False