Merge remote-tracking branch 'ion1/master'
This commit is contained in:
@@ -115,6 +115,9 @@ Bounds = namedtuple("Bounds", ("mincol", "maxcol", "minrow", "maxrow"))
|
|||||||
# For render-tiles, render all whose chunks have an mtime greater than
|
# For render-tiles, render all whose chunks have an mtime greater than
|
||||||
# the mtime of the tile on disk, and their composite-tile ancestors.
|
# the mtime of the tile on disk, and their composite-tile ancestors.
|
||||||
#
|
#
|
||||||
|
# Also rerender any tiles rendered before forcerendertime. It is nonzero
|
||||||
|
# whenever a mode=2 render has been interrupted.
|
||||||
|
#
|
||||||
# Also check all other composite-tiles and render any that have children
|
# Also check all other composite-tiles and render any that have children
|
||||||
# with more rencent mtimes than itself.
|
# with more rencent mtimes than itself.
|
||||||
#
|
#
|
||||||
@@ -283,6 +286,7 @@ class TileSet(object):
|
|||||||
self.config = config
|
self.config = config
|
||||||
|
|
||||||
self.last_rendertime = config.get('last_rendertime', 0)
|
self.last_rendertime = config.get('last_rendertime', 0)
|
||||||
|
self.forcerendertime = config.get('forcerendertime', 0)
|
||||||
|
|
||||||
if "renderchecks" not in self.options:
|
if "renderchecks" not in self.options:
|
||||||
# renderchecks was not given, this indicates it was not specified
|
# renderchecks was not given, this indicates it was not specified
|
||||||
@@ -347,6 +351,11 @@ class TileSet(object):
|
|||||||
self.options['renderchecks'] = 2
|
self.options['renderchecks'] = 2
|
||||||
os.mkdir(self.outputdir)
|
os.mkdir(self.outputdir)
|
||||||
|
|
||||||
|
if self.options['renderchecks'] == 2:
|
||||||
|
# Set forcerendertime so that upon an interruption the next render
|
||||||
|
# will continue where we left off.
|
||||||
|
self.forcerendertime = int(time.time())
|
||||||
|
|
||||||
# Set the image format according to the options
|
# Set the image format according to the options
|
||||||
if self.options['imgformat'] == 'png':
|
if self.options['imgformat'] == 'png':
|
||||||
self.imgextension = 'png'
|
self.imgextension = 'png'
|
||||||
@@ -502,8 +511,11 @@ class TileSet(object):
|
|||||||
# following exceptions:
|
# following exceptions:
|
||||||
# * last_rendertime is not changed
|
# * last_rendertime is not changed
|
||||||
# * A key "render_in_progress" is set to True
|
# * A key "render_in_progress" is set to True
|
||||||
|
# * forcerendertime is set so that an interrupted mode=2 render will
|
||||||
|
# finish properly.
|
||||||
d['last_rendertime'] = self.last_rendertime
|
d['last_rendertime'] = self.last_rendertime
|
||||||
d['render_in_progress'] = True
|
d['render_in_progress'] = True
|
||||||
|
d['forcerendertime'] = self.forcerendertime
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def get_persistent_data(self):
|
def get_persistent_data(self):
|
||||||
@@ -1063,8 +1075,10 @@ class TileSet(object):
|
|||||||
"information")
|
"information")
|
||||||
logging.warning("Tile was: %s", imgpath)
|
logging.warning("Tile was: %s", imgpath)
|
||||||
|
|
||||||
if max_chunk_mtime > tile_mtime:
|
if max_chunk_mtime > tile_mtime or tile_mtime < self.forcerendertime:
|
||||||
# chunks have a more recent mtime than the tile. Render the tile
|
# chunks have a more recent mtime than the tile or the tile has
|
||||||
|
# an older mtime than the forcerendertime from an interrupted
|
||||||
|
# render. Render the tile.
|
||||||
yield (path, None, True)
|
yield (path, None, True)
|
||||||
else:
|
else:
|
||||||
# This doesn't need rendering. Return mtime to parent in case
|
# This doesn't need rendering. Return mtime to parent in case
|
||||||
@@ -1428,7 +1442,7 @@ class RendertileSet(object):
|
|||||||
for p in roundrobin(gens) if robin else chain(*gens):
|
for p in roundrobin(gens) if robin else chain(*gens):
|
||||||
yield p
|
yield p
|
||||||
|
|
||||||
if onlydepth is None and children:
|
if onlydepth is None and any(children_list):
|
||||||
yield path
|
yield path
|
||||||
|
|
||||||
def query_path(self, path):
|
def query_path(self, path):
|
||||||
@@ -1466,14 +1480,28 @@ class RendertileSet(object):
|
|||||||
"""Returns the total number of render-tiles in this set.
|
"""Returns the total number of render-tiles in this set.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.num_tiles
|
# XXX There seems to be something wrong with the num_tiles calculation.
|
||||||
|
# Calculate the number of tiles by iteration and emit a warning if it
|
||||||
|
# does not match.
|
||||||
|
from itertools import imap
|
||||||
|
num = sum(imap(lambda _: 1, self.iterate()))
|
||||||
|
if num != self.num_tiles:
|
||||||
|
logging.error("Please report this to the developers: RendertileSet num_tiles=%r, count=%r, children=%r", self.num_tiles, num, self.children)
|
||||||
|
return num
|
||||||
|
|
||||||
def count_all(self):
|
def count_all(self):
|
||||||
"""Returns the total number of render-tiles plus implicitly marked
|
"""Returns the total number of render-tiles plus implicitly marked
|
||||||
upper-tiles in this set
|
upper-tiles in this set
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.num_tiles_all
|
# XXX There seems to be something wrong with the num_tiles calculation.
|
||||||
|
# Calculate the number of tiles by iteration and emit a warning if it
|
||||||
|
# does not match.
|
||||||
|
from itertools import imap
|
||||||
|
num = sum(imap(lambda _: 1, self.posttraversal()))
|
||||||
|
if num != self.num_tiles_all:
|
||||||
|
logging.error("Please report this to the developers: RendertileSet num_tiles_all=%r, count_all=%r, children=%r", self.num_tiles, num, self.children)
|
||||||
|
return num
|
||||||
|
|
||||||
def distance_sort(children, (off_x, off_y)):
|
def distance_sort(children, (off_x, off_y)):
|
||||||
order = []
|
order = []
|
||||||
|
|||||||
Reference in New Issue
Block a user