예제 #1
0
    def executequery(self, query, data):
        """ run the sql queries and yield a job object for each result """
        cur = self.con.cursor()
        cur.execute(query, data)

        for record in cur:

            hostcur = self.hostcon.cursor()
            hostcur.execute(self.hostquery, (record["job_id"],))

            hostarchives = {}
            hostlist = []
            for h in hostcur:
                if h[0] not in hostarchives:
                    hostlist.append(h[0])
                    hostarchives[h[0]] = []
                hostarchives[h[0]].append(h[1])

            jobpk = record["job_id"]
            del record["job_id"]
            record["host_list"] = hostlist
            job = Job(jobpk, str(record["local_job_id"]), record)
            job.set_nodes(hostlist)
            job.set_rawarchives(hostarchives)

            yield job
예제 #2
0
파일: account.py 프로젝트: iMurfyD/supremm
    def recordtojob(record, hostlist, hostarchivemapping=None):
        """ convert an accounting record to a job class """

        if record['node_list'] == "None assigned":
            record['reqnodes'] = record['nodes']
            record['nodes'] = 0

        # The job primary key value is not used by this class, instead the
        # combination of acct[endtime] acct[localjobid] and resourceid is used
        # to ID thedb rows corresponding to the job

        j = Job(record['id'], record['id'], record)
        j.set_nodes(hostlist)

        if hostarchivemapping != None:
            j.set_rawarchives(hostarchivemapping)

        return j
예제 #3
0
    def executequery(self, query, data):
        """ run the sql queries and yield a job object for each result """
        cur = self.con.cursor()
        cur.execute(query, data)

        for record in cur:

            hostcur = self.hostcon.cursor()
            hostcur.execute(self.hostquery, (record['job_id'], ))

            hostarchives = {}
            hostlist = []
            for h in hostcur:
                if h[0] not in hostarchives:
                    hostlist.append(h[0])
                    hostarchives[h[0]] = []
                hostarchives[h[0]].append(h[1])

            jobpk = record['job_id']
            del record['job_id']
            record['host_list'] = hostlist
            job = Job(jobpk, str(record['local_job_id']), record)
            job.set_nodes(hostlist)
            job.set_rawarchives(hostarchives)

            yield job
예제 #4
0
    def executequery(self, query, data):
        """ run the sql queries and yield a job object for each result """
        if self.con == None:
            self.con = getdbconnection(self.dbsettings, True)
        if self.hostcon == None:
            self.hostcon = getdbconnection(self.dbsettings, False)

        cur = self.con.cursor()
        cur.execute(query, data)

        rows_returned=cur.rowcount
        logging.info("Processing %s jobs", rows_returned)

        for record in cur:

            hostcur = self.hostcon.cursor()
            hostcur.execute(self.hostquery, (record['job_id'], record['job_id']))

            hostarchives = {}
            hostlist = []
            for h in hostcur:
                if h[0] not in hostarchives:
                    hostlist.append(h[0])
                    hostarchives[h[0]] = []
                hostarchives[h[0]].append(h[1])

            jobpk = record['job_id']
            del record['job_id']
            record['host_list'] = hostlist
            job = Job(jobpk, str(record['local_job_id']), record)
            job.set_nodes(hostlist)
            job.set_rawarchives(hostarchives)

            yield job
예제 #5
0
    def recordtojob(record, hostlist, hostarchivemapping=None):
        """ convert an accounting record to a job class """

        if record['node_list'] == "None assigned":
            record['reqnodes'] = record['nodes']
            record['nodes'] = 0

        # The job primary key value is not used by this class, instead the
        # combination of acct[endtime] acct[localjobid] and resourceid is used
        # to ID thedb rows corresponding to the job

        j = Job(record['id'], record['id'], record)
        j.set_nodes(hostlist)

        if hostarchivemapping != None:
            j.set_rawarchives(hostarchivemapping)

        return j