From 7e73faf61965ad76a1ce6876906f05a9eda75afc Mon Sep 17 00:00:00 2001 From: niphlod Date: Thu, 21 Aug 2014 22:49:26 +0200 Subject: [PATCH] doc fixes --- gluon/scheduler.py | 7 ++++++- gluon/tools.py | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gluon/scheduler.py b/gluon/scheduler.py index d27e2b8e..3bbef86c 100644 --- a/gluon/scheduler.py +++ b/gluon/scheduler.py @@ -169,9 +169,14 @@ class JobGraph(object): self.db = db def add_deps(self, task_parent, task_child): + """Creates a dependency between task_parent and task_child""" self.db.scheduler_task_deps.insert(task_parent=task_parent, task_child=task_child, job_name=self.job_name) def validate(self, job_name): + """Validates if all tasks job_name can be completed, i.e. there + are no mutual dependencies among tasks. + Commits at the end if successfull, or it rollbacks the entire + transaction. Handle with care!""" db = self.db sd = db.scheduler_task_deps if job_name: @@ -1380,7 +1385,7 @@ class Scheduler(MetaScheduler): return rtn def get_workers(self, only_ticker=False): - """ Returns a dict holding worker_name : {**columns} + """ Returns a dict holding `worker_name : {**columns}` representing all "registered" workers only_ticker returns only the workers running as a TICKER, if there are any diff --git a/gluon/tools.py b/gluon/tools.py index df2ba579..58d35465 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -4425,8 +4425,10 @@ def geocode(address): return (0.0, 0.0) -def reverse_geocode(lat, lng, lang=current.T.accepted_language): +def reverse_geocode(lat, lng, lang=None): """ Try to get an approximate address for a given latitude, longitude. """ + if not lang: + lang = current.T.accepted_language try: return json_parser.loads(fetch('http://maps.googleapis.com/maps/api/geocode/json?latlng=%(lat)s,%(lng)s&language=%(lang)s' % locals()))['results'][0]['formatted_address'] except: