Database Reference
In-Depth Information
with g_state_lock:
g_state['status'] = 'IDLE'
class MainHandler(webapp2.RequestHandler):
@login_required
def get(self):
current = ZERO_STATE.copy()
with g_state_lock:
current.update(g_state)
if current['status'] == 'RUNNING':
current['refresh'] = '<meta
http-equiv="refresh" content="6"/>'
self.response.write(_PAGE % current)
def post(self):
if not users.is_current_user_admin():
self.abort(401, 'Must be an admin to start a
mapreduce.')
background_thread.start_new_background_thread(run_attempt,
[])
self.redirect(self.request.route.build(self.request,
[], {}))
app = webapp2.WSGIApplication([
webapp2.Route(r'/', handler=MainHandler,
name='main'),
], debug=True)
Before you can run this code, you'll need to load the zip codes source file into
BigQuery. You can do this with the following commands:
$ bq mk ch12
$ bq load --source_format=NEWLINE_DELIMITED_JSON \
ch12.add_zip_input add_zip_sample.json \
"id:string,lat:float,lng:float "
Search WWH ::




Custom Search