'This method parses qacct -j output and makes a neat array and
calculates some statistics.
Takes the string to parse, and a datetime object of the remote
host\'s current time.'

def parse_qacct(self, string, dtnow):

    job_id = None
    qd = None
    start = None
    end = None
    counter = 0
    lines = string.split('\n')
    for l in lines:
        l = l.strip()
        if (l.find('jobnumber') != (-1)):
            job_id = int(l[13:len(l)])
        if (l.find('qsub_time') != (-1)):
            qd = self.qacct_to_datetime_tuple(l[13:len(l)])
        if (l.find('start_time') != (-1)):
            if (l.find('-/-') > 0):
                start = dtnow
            else:
                start = self.qacct_to_datetime_tuple(l[13:len(l)])
        if (l.find('end_time') != (-1)):
            if (l.find('-/-') > 0):
                end = dtnow
            else:
                end = self.qacct_to_datetime_tuple(l[13:len(l)])
        if (l.find('==========') != (-1)):
            if (qd is not None):
                self.max_job_id = job_id
                hash = {'queued': qd, 'start': start, 'end': end}
                self.jobstats[(job_id % self.jobstat_cachesize)] = hash
            qd = None
            start = None
            end = None
            counter = (counter + 1)
    log.debug(('added    %d    new    jobs' % counter))
    log.debug(('There    are    %d    items    in    the    jobstats    cache' % len(self.jobstats)))
    return self.jobstats
