Get started for free

The following is an excerpt from "The Infinite Machine"

yccloudpickle.png

In the article I’ve linked above, I presented the following problem:

Say I’ve got an App Engine app managing user accounts. They have a store credit “balance”. As a promotion, I’d like to add $10 of free credit to everyone’s account.

I had a model class Account, with an attribute balance , and I wanted to increment every Account entity’s balance by 10.

That article was talking about the idea of serialising code, and presented the decorator @task to let me do this in background tasks. Here’s the code:

snip2.png

This was great, it made sure we could map over (ie: visit) every entity no matter how many there were, by using App Engine tasks...


Emlyn O'Regan is a Co-Founder and CTO of xapiapps, and the author of "The Infinite Machine"

THIS EBOOK MIGHT INTEREST YOU

LX-Designer-Book

The LX Designer’s Handbook

A comprehensive guide to the changing world of learning design

Download ebook for free

Comments

Get the latest updates by email