Book Image

Drush for Developers - Second Edition

By : Juan Pablo Novillo Requena, Juan P Novillo Requena
Book Image

Drush for Developers - Second Edition

By: Juan Pablo Novillo Requena, Juan P Novillo Requena

Overview of this book

Table of Contents (13 chapters)
Drush for Developers Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
2
Keeping Database Configuration and Code Together
Index

Chapter 3. Running and Monitoring Tasks in Drupal Projects

Looking at Wikipedia for the definition of a task (http://en.wikipedia.org/wiki/Task), I found two of them. Here they are:

  • In project management, an activity that needs to be accomplished within a defined period of time

  • In computing, a program execution context

Some examples of tasks in Drupal projects are clearing caches, indexing content into a search engine, or importing content from a third-party API. These can be classified in the following types:

  • One-off: This includes Drupal's database updates

  • On demand: This includes reindexing all content in Apache Solr

  • Periodic: This would be the case of Drupal's cron

Drush is really good at running long tasks in an isolated process. It supports both Batch and Queue APIs, so the workload can be either split into batches or workers, respectively. In this chapter, we will see some tips and examples of best practices to run tasks against a Drupal project using Drush. Here are the main topics...