From 6f060633ad7ae01e8cc0888a1499f7e218bad73b Mon Sep 17 00:00:00 2001 From: Andrew Chin Date: Thu, 24 Feb 2011 23:06:36 -0500 Subject: [PATCH] Running with -p should be OK now --- world.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/world.py b/world.py index 03d497d..3a2710f 100644 --- a/world.py +++ b/world.py @@ -367,22 +367,23 @@ class WorldRenderer(object): logging.debug("Rendering chunks in {0} processes".format(processes)) pool = multiprocessing.Pool(processes=processes) asyncresults = [] - for col, row, chunkfile in chunks: - if inclusion_set and (col, row) not in inclusion_set: - # Skip rendering, just find where the existing image is - _, imgpath = chunk.find_oldimage(chunkfile, cached, self.caves) - if imgpath: - results[(col, row)] = imgpath - continue + for col, row, chunkXY in chunks: + ##TODO/if inclusion_set and (col, row) not in inclusion_set: + ##TODO/ # Skip rendering, just find where the existing image is + ##TODO/ _, imgpath = chunk.find_oldimage(chunkfile, cached, self.caves) + ##TODO/ if imgpath: + ##TODO/ results[(col, row)] = imgpath + ##TODO/ continue - oldimg = chunk.find_oldimage(chunkfile, cached, self.caves) - if chunk.check_cache(chunkfile, oldimg): + oldimg = chunk.find_oldimage(chunkXY, cached, self.caves) + if oldimg[1]: ## TODO chunk.check_cache(chunkfile, oldimg): result = FakeAsyncResult(oldimg[1]) else: result = pool.apply_async(chunk.render_and_save, - args=(chunkfile,self.cachedir,self, oldimg), + args=(chunkXY,self.cachedir,self, oldimg), kwds=dict(cave=self.caves, queue=q)) - asyncresults.append((col, row, result)) + if result: + asyncresults.append((col, row, result)) pool.close()