Tasks cleaner module

Edition

Incubator (services)

Git

Git

Latest

1.0

Compatible with Magnolia 6.2, 5.7.

The Tasks cleaner module provides commands for managing tasks like scheduled publications that have been executed.

Tasks that have been successfully executed are marked as "resolved" and retained in the task workspace in your JCR repository. Resolved tasks can be marked as "archived" and will no longer be displaced in the Tasks app. "Archived" tasks can be marked as "removed".

Having many resolved tasks can affect:

  • the time to log in to Admincentral

  • the time to publish

It’s a good idea to periodically archive resolved tasks to prevent Admincentral performance from being adversely impacted.

This module is at the INCUBATOR level.

Installing with Maven

Maven is the easiest way to install the module. Add the following to your bundle:

<dependency>
  <groupId>info.magnolia.taskscleaner</groupId>
  <artifactId>tasks-cleaner</artifactId>
  <version>1.0</version>
</dependency>

Usage

The following commands are defined by the Tasks Cleaner module: cleanup-archiveTasks and cleanup-removeTasks.

The commands cleanup-archiveTasks and cleanup-removeTasks can be run:

  • as scheduled jobs with the Scheduler module

  • through the REST command endpoint

  • invoked by app actions

  • through the console of the Groovy app

Commands

All commands can be found in the cleanup catalog at /module/tasks-cleaner/commands/cleanup.

Command Description

archiveTasks

Check resolved tasks and mark selected tasks as archived according to configurable criteria.

removeTasks

Check archived tasks and mark selected task as removed according to configurable criteria.

Table 1. Properties
Property Description

noop

optional

Do a dry-run, do not modify any tasks and report the results to Magnolia logs.

Default is false.

maxTasks

optional

Sets the maximum number of tasks that will be modified in a run (defaults to 256). If the maximum number of tasks is reached, the command will stop. If set to -1, no limit is imposed and all selected tasks will be modified.

Default is 256.

voters

required

A voter set that will select tasks for modification (either archiving or removal). See the following section on the task voters available.

Task Voters

There are a number of task voters you can use to select tasks for archiving or removing by the archiveTasks and removeTasks commands.

TaskCreatedBeforeVoter

TaskCreatedBeforeVoter returns true if the task was created before a configured date, false otherwise.

Class: info.magnolia.services.taskscleaner.voters.TaskCreatedBeforeVoter

Table 2. Properties
Property Description

date

required

A date. The voter will return true if the task was created before the date.

TaskCreatedSinceVoter

TaskCreatedSinceVoter returns true if the task was created before a configured interval (in milliseconds) from the current time, false otherwise.

For example, if the interval is set to 30 days (2592000000 converted to milliseconds), the voter will return true if the creation date is 30 days before the current time at execution.

Class: info.magnolia.services.taskscleaner.voters.TaskCreatedSinceVoter

Table 3. Properties
Property Description

interval

required

An interval in milliseconds. The voter will return true if the task was created before interval from the current time.

TaskFailedVoter

TaskFailedVoter returns true if the task is marked as "Failed", false otherwise.

Class: info.magnolia.services.taskscleaner.voters.TaskFailedVoter

TaskHasContentValueVoter

TaskHasContentValueVoter returns true if the task content has the configured contentKey key and contentValue, false otherwise.

Class: info.magnolia.services.taskscleaner.voters.TaskHasContentValueVoter

Table 4. Properties
Property Description

contentKey

required

A content key name.

contentValue

required

The content value.

TaskHasContentVoter

TaskHasContentVoter returns true if the task content has the configured contentKey defined, false otherwise.

The value of the contentKey is not checked.

Class: info.magnolia.services.taskscleaner.voters.TaskHasContentVoter

Table 5. Properties
Property Description

contentKey

required

A content key name.

TaskHasResultValueVoter

TaskHasResultValueVoter returns true if the task results has the configured resultKey key and resultValue, false otherwise.

Class: info.magnolia.services.taskscleaner.voters.TaskHasResultValueVoter

Table 6. Properties
Property Description

resultKey

required

A result key name.

resultValue

required

The result value.

TaskHasResultVoter

TaskHasContentVoter returns true if the task results has the configured resultsKey defined, false otherwise.

Note: the value of the resultKey is not checked.

Class: info.magnolia.services.taskscleaner.voters.TaskHasResultVoter

Table 7. Properties
Property Description

resultKey

required

A result key name.

TaskModifiedBeforeVoter

TaskModifiedBeforeVoter returns true if the task was modified before a configured date, false otherwise.

Class: info.magnolia.services.taskscleaner.voters.TaskModifiedBeforeVoter

Table 8. Properties
Property Description

date

required

A date. The voter will return true if the task was modified before the date.

TaskModifiedSinceVoter

TaskModifiedSinceVoter returns true if the task was modified before a configured interval (in milliseconds) from the current time, false otherwise.

For example, if the interval is set to 30 days (2592000000 converted to milliseconds), the voter will return true if the last modified date is 30 days before the current time at execution.

Class: info.magnolia.services.taskscleaner.voters.TaskModifiedSinceVoter

Table 9. Properties
Property Description

interval

required

An interval in milliseconds. The voter will return true if the task was last modified before interval from the current time.

TaskStatusVoter

TaskStatusVoter returns true if the task currently has the configured status, otherwise false.

Class: info.magnolia.services.taskscleaner.voters.TaskStatusVoter

Table 10. Properties
Property Description

status

required

A task status, one of: Created, InProgress, Resolved, Failed, Archived, Removed, Scheduled.

Changelog

Version Notes

1.0

Initial release of the module.

Feedback

Incubators

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the Tasks cleaner module docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules