| version 1.45, 2008/08/07 22:49:21 |
version 1.46, 2008/09/17 16:55:30 |
| Line 983 class PGLoader(threading.Thread): |
|
| Line 983 class PGLoader(threading.Thread): |
|
| thread will read the input file and distribute the processing |
thread will read the input file and distribute the processing |
| on a round-robin fashion""" |
on a round-robin fashion""" |
| self.prepare_processing() |
self.prepare_processing() |
| |
|
| |
try: |
| |
from RRRtools import RRReader |
| |
except ImportError, e: |
| |
raise PGLoader_Error, \ |
| |
"Please upgrade to python 2.4 or newer: %s" % e |
| |
|
| from tools import RRReader |
|
| queues = {} |
queues = {} |
| locks = {} |
locks = {} |
| sem = threading.BoundedSemaphore(self.section_threads) |
sem = threading.BoundedSemaphore(self.section_threads) |
| Line 1046 class PGLoader(threading.Thread): |
|
| Line 1051 class PGLoader(threading.Thread): |
|
| c = 0 # current |
c = 0 # current |
| p = c # previous |
p = c # previous |
| |
|
| for line, columns in self.reader.readlines(): |
for offsets, line, columns in self.reader.readlines(): |
| if p != c: |
if p != c: |
| self.log.debug("read %d lines, queue to thread %s" % (n, c)) |
self.log.debug("read %d lines, queue to thread %s" % (n, c)) |
| |
|
| Line 1065 class PGLoader(threading.Thread): |
|
| Line 1070 class PGLoader(threading.Thread): |
|
| self.log.debug("locks[%d].acquire" % c) |
self.log.debug("locks[%d].acquire" % c) |
| locks[c].acquire() |
locks[c].acquire() |
| |
|
| queues[c].append((line, columns)) |
queues[c].append((offsets, line, columns)) |
| n += 1 |
n += 1 |
| p = c |
p = c |
| c = (n / self.rrqueue_size) % self.section_threads |
c = (n / self.rrqueue_size) % self.section_threads |