← All modules

Magento 2 module · foundation

Task

Framework for background tasks of Infrangible modules: run history in the admin, per-task settings, log files and summary emails after each run.

Task is the common base for longer-running jobs of Infrangible modules, such as building product feeds or sitemaps or cleaning up collected data. It takes care of everything around a job: starting it from the admin, by cron or on the command line, keeping a history of every run, writing log files and informing the right people by email when a run succeeded or failed.

Merchants normally don’t install Task on its own: it is pulled in automatically by modules that offer background tasks, such as “Cache Usage”.

Features

  • Infrangible > Tasks > Runs lists every run with store, task name, status, success, start and finish time, duration and memory usage. Each run can be opened to read its log.
  • Tasks can be started from the admin, by cron or on the command line, for one or several store views, and optionally in a test mode.
  • Summary emails after a run, separately for successful and failed runs, with sender, recipients, copy and blind copy recipients and subject.
  • Optional suppression of summary emails for runs that had nothing to do.
  • Tasks can depend on other tasks and wait for a still-running previous run of the same task.
  • Adjustable log level, optional treatment of warnings as errors, and a memory limit per task.
  • Runs that were interrupted are detected automatically and marked as finished. Runs and their log files older than 90 days are removed every night.

Configuration

Settings are made in the Tasks tab under Stores > Configuration. The General section holds the defaults for all tasks (Settings, Logging, Success Summary, Error Summary). Every task module adds its own section there, in which each group can either use the general values or overwrite them (“Overwrite Task General”), and where dependencies on other tasks can be entered.

Good to know

Task is a building block of modules such as “Cache Usage”, “Catalog Product Feed” and “Sitemap”. Summary emails are sent with “Simple Mail”.

Installation

Install the module with Composer in your Magento root directory:

composer require infrangible/m2-task

Then enable it and update the store as described in the installation guide. Composer installs the required modules listed on this page automatically.