Skip to content

Commit

Permalink
Merge pull request #182 from tilezen/iandees/cleanup-gardener
Browse files Browse the repository at this point in the history
A couple cleanups from running the gardener locally
  • Loading branch information
iandees authored Apr 6, 2017
2 parents 80e64e0 + 06e6707 commit 9d1e0c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion tilequeue/cache/redis_cache_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ def intersect(self, coords, tiles_of_interest=None):
yield coord

def remove_tiles_of_interest(self, coord_ints):
return self.redis_client.srem(self.cache_set_key, coord_ints)
# Note that this will end up as a single SREM call to Redis,
# so you should probably group the coords into ~1000s.
return self.redis_client.srem(self.cache_set_key, *coord_ints)

def fetch_tiles_of_interest(self):
raw_tiles_of_interest = self.redis_client.smembers(self.cache_set_key)
Expand Down
8 changes: 6 additions & 2 deletions tilequeue/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,8 +984,9 @@ def tilequeue_prune_tiles_of_interest(cfg, peripherals):
and (z between 0 and 15)
and (x between 0 and pow(2,z)-1)
and (y between 0 and pow(2,z)-1)
group by z, x, y
order by z, x, y;""".format(days=redshift_days_to_query))
group by z, x, y, tilesize
order by z, x, y, tilesize
""".format(days=redshift_days_to_query))
n_trr = cur.rowcount
for (x, y, z, tile_size) in cur:
coord = create_coord(x, y, z)
Expand Down Expand Up @@ -1020,6 +1021,9 @@ def tilequeue_prune_tiles_of_interest(cfg, peripherals):
for l in f
)

# Filter out nulls that might sneak in for various reasons
immortal_tiles = filter(None, immortal_tiles)

n_inc = len(immortal_tiles)
new_toi = new_toi.union(immortal_tiles)

Expand Down

0 comments on commit 9d1e0c5

Please sign in to comment.