Book Image

Mastering Flask

By : Jack Stouffer
Book Image

Mastering Flask

By: Jack Stouffer

Overview of this book

Starting from a simple Flask app, this book will walk through advanced topics while providing practical examples of the lessons learned. After building a simple Flask app, a proper app structure is demonstrated by transforming the app to use a Model-View-Controller (MVC) architecture. With a scalable structure in hand, the next chapters use Flask extensions to provide extra functionality to the app, including user login and registration, NoSQL querying, a REST API, an admin interface, and more. Next, you’ll discover how to use unit testing to take the guesswork away from making sure the code is performing as it should. The book closes with a discussion of the different platforms that are available to deploy a Flask app on, the pros and cons of each one, and how to deploy on each one.
Table of Contents (20 chapters)
Mastering Flask
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Monitoring Celery


When our code is pushed to the server, our Celery worker will not be run in the terminal window, it will be run as a background task. Because of this, Celery provides many command-line arguments to monitor the status of your Celery worker and tasks. These commands take the following form:

$ celery –A celery_runner <command>

The main tasks to view the status of your workers are as follows:

  • status: This prints the running workers and if they are up

  • result: When passed a task id, this shows the return value and final status of the task

  • purge: Using this, all messages in the broker will be deleted

  • inspect active: This lists all active tasks

  • inspect scheduled: This lists all tasks that have been scheduled with the eta argument

  • inspect registered: This lists all of the tasks waiting to be processed

  • inspect stats: This returns a dictionary full of statistics on the currently running workers and the broker

Web-based monitoring with Flower

Flower is a web-based, real-time management...