Skip to Content
Python Microservices Development
book

Python Microservices Development

by Tarek Ziadé
July 2017
Beginner to intermediate
340 pages
7h 43m
English
Packt Publishing
Content preview from Python Microservices Development

Background tasks

The code that fetches new runs from Strava to add them in the Runnerly database can poll Strava regularly, like every hour. The monthly report can also be called once per month to generate a report and send it to the user by email. Both features are part of the Flask application and use the SQLAlchemy models to do their work.

But unlike user requests, they are background tasks, and they need to run on their own outside the HTTP request/response cycle.

If not using simple cron jobs, a popular way to run repetitive background tasks in Python web apps is to use Celery (http://docs.celeryproject.org), a distributed task queue that can execute some work in a standalone process.

To do this, an intermediate called a message broker ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Microservices Development - Second Edition

Python Microservices Development - Second Edition

Simon Fraser, Tarek Ziadé
Python Web Development with Sanic

Python Web Development with Sanic

Stephen Sadowski, Adam Hopkins

Publisher Resources

ISBN: 9781785881114Supplemental Content