def getTier1Queue2(self, cloud):
        """ Download the queuedata for the Tier-1 in the corresponding cloud and get the queue name """

        queuename = ""

        path = self.getTier1InfoFilename()
        ec = self.downloadTier1Info()
        if ec == 0:
            # Process the downloaded T-1 info
            f = open(path, 'r')
            if getExtension() == "json":
                from json import loads
                data = loads(f.read())
            else:
                from pickle import load
                data = load(f)
            f.close()

            # Extract the relevant queue info for the given cloud
            T1_info = [x for x in data if x['cloud'] == cloud]

            # finally get the queue name
            if T1_info != []:
                info = T1_info[0]
                if info.has_key('PanDAQueue'):
                    queuename = info['PanDAQueue']
                else:
                    tolog(
                        "!!WARNING!!1222!! Returned Tier-1 info object does not have key PanDAQueue: %s"
                        % str(info))
            else:
                tolog("!!WARNING!!1223!! Found no Tier-1 info for cloud %s" %
                      (cloud))

        return queuename
    def getTier1InfoFilename(self):
        """ Get the Tier-1 info file name """

        filename = "Tier-1_info.%s" % (getExtension())
        path = "%s/%s" % (os.environ['PilotHomeDir'], filename)

        return path
Ejemplo n.º 3
0
    def rename(self, site, job):
        """
        Rename the job state file. Should only be called for
        holding jobs that have passed the maximum number of recovery attempts.
        """
        status = True

        # get the file extension
        extension = getExtension()

        fileNameOld = "%s/jobState-%s.%s" % (site.workdir, job.jobId, extension)
        fileNameNew = "%s/jobState-%s.%s.MAXEDOUT" % (site.workdir, job.jobId, extension)
        if os.path.isfile(fileNameOld):
            # rename the job state file
            try:
                os.system("mv %s %s" % (fileNameOld, fileNameNew))
            except OSError:
                tolog("JOBSTATE FAILURE: Failed to rename job state file: %s" % (fileNameOld))
                status = False
            else:
                tolog("Job state file renamed to: %s" % (fileNameNew))
        else:
            tolog("JOBSTATE FAILURE: Job state file does not exist: %s" % (fileNameOld))
            status = False
            
        return status
Ejemplo n.º 4
0
    def getTier1Queue2(self, cloud):
        """ Download the queuedata for the Tier-1 in the corresponding cloud and get the queue name """

        queuename = ""

        path = self.getTier1InfoFilename()
        ec = self.downloadTier1Info()
        if ec == 0:
            # Process the downloaded T-1 info
            f = open(path, "r")
            if getExtension() == "json":
                from json import loads

                data = loads(f.read())
            else:
                from pickle import load

                data = load(f)
            f.close()

            # Extract the relevant queue info for the given cloud
            T1_info = [x for x in data if x["cloud"] == cloud]

            # finally get the queue name
            if T1_info != []:
                info = T1_info[0]
                if info.has_key("PanDAQueue"):
                    queuename = info["PanDAQueue"]
                else:
                    tolog("!!WARNING!!1222!! Returned Tier-1 info object does not have key PanDAQueue: %s" % str(info))
            else:
                tolog("!!WARNING!!1223!! Found no Tier-1 info for cloud %s" % (cloud))

        return queuename
Ejemplo n.º 5
0
    def getTier1InfoFilename(self):
        """ Get the Tier-1 info file name """

        filename = "Tier-1_info.%s" % (getExtension())
        path = "%s/%s" % (os.environ["PilotHomeDir"], filename)

        return path
Ejemplo n.º 6
0
    def rename(self, site, job):
        """
        Rename the job state file. Should only be called for
        holding jobs that have passed the maximum number of recovery attempts.
        """
        status = True

        # get the file extension
        extension = getExtension()

        fileNameOld = "%s/jobState-%s.%s" % (site.workdir, job.jobId,
                                             extension)
        fileNameNew = "%s/jobState-%s.%s.MAXEDOUT" % (site.workdir, job.jobId,
                                                      extension)
        if os.path.isfile(fileNameOld):
            # rename the job state file
            try:
                os.system("mv %s %s" % (fileNameOld, fileNameNew))
            except OSError:
                tolog("JOBSTATE FAILURE: Failed to rename job state file: %s" %
                      (fileNameOld))
                status = False
            else:
                tolog("Job state file renamed to: %s" % (fileNameNew))
        else:
            tolog("JOBSTATE FAILURE: Job state file does not exist: %s" %
                  (fileNameOld))
            status = False

        return status