Tasks cleaner module
Edition |
Incubator (services) |
||
Git |
|||
Latest |
1.0
|
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 |
---|---|
|
Check resolved tasks and mark selected tasks as archived according to configurable criteria. |
|
Check archived tasks and mark selected task as removed according to configurable criteria. |
Property | Description |
---|---|
|
optional Do a dry-run, do not modify any tasks and report the results to Magnolia logs. Default is |
|
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 |
|
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
Property | Description |
---|---|
|
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
Property | Description |
---|---|
|
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
Property | Description |
---|---|
|
required A content key name. |
|
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
Property | Description |
---|---|
|
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
Property | Description |
---|---|
|
required A result key name. |
|
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
Property | Description |
---|---|
|
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
Property | Description |
---|---|
|
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
Property | Description |
---|---|
|
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
Property | Description |
---|---|
|
required A task status, one of: |