Skip to content

Commit

Permalink
Added synchronous flag as argument to aggregate function.
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowcap committed Dec 18, 2018
1 parent 85e51bc commit 819ff6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions tesselate/aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tesselate.utils import layers_dict


def aggregate(client, area, composite, formula, grouping='continuous', zoom=None):
def aggregate(client, area, composite, formula, grouping='continuous', zoom=None, synchronous=True):
"""
Request aggregation data.
"""
Expand Down Expand Up @@ -35,8 +35,8 @@ def aggregate(client, area, composite, formula, grouping='continuous', zoom=None
return result[0]
else:
# If valuecount has not been precomputed, do it now synchronously.
logging.info('Value count not precomputed, requesting synchronous calculation.')
return client.post('valuecountresult?synchronous=True', data=post_params)
logging.info('Value count not precomputed, requesting {} calculation.'.format('synchronous' if synchronous else 'asynchronous'))
return client.post('valuecountresult{}'.format('?synchronous' if synchronous else ''), data=post_params)


def regional_aggregate(valuecounts):
Expand Down
4 changes: 2 additions & 2 deletions tesselate/tesselate.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def predictedlayer(self, id=None, **filters):
def export(self, region, composite, formula, file_path, tilez=14):
export(self.client, region, composite, formula, file_path, tilez=tilez)

def aggregate(self, area, composite, formula, grouping='continuous', zoom=None):
return aggregate(self.client, area, composite, formula, grouping, zoom)
def aggregate(self, area, composite, formula, grouping='continuous', zoom=None, synchronous=True):
return aggregate(self.client, area, composite, formula, grouping, zoom, synchronous)

def build(self, compositebuild):
return build(self.client, compositebuild)
Expand Down

0 comments on commit 819ff6c

Please sign in to comment.