Tasks

The tasks page can be accessed via the monitor menu:

Monitor > Tasks

Actions performed in orcharhino that may require an extended period of time to execute or can be scheduled to run regularly or at a specific point in time are often run as so called tasks. Tasks may also be used for the interaction between separate orcharhino background services. One service might schedule a task that is performed by a different service.

The following is an incomplete list of actions that are run as tasks:

  • Most actions performed by orcharhino’s content management.

  • All remote execution actions.

  • Bulk actions, which will generally create a parent task, with sub tasks for each object the bulk action is performed on.

The tasks page lists all tasks performed throughout orcharhino. The list is sorted by start time, with newer tasks on top. It also reports the state and result of each task, as well as the user that performed it, which may be an internal administrative user.

As a result, the troubleshooting tasks page shares some overlap and similarities with the audits page, though its purpose is different: The tasks page lists actions that run as a task, while the audits page shows which orcharhino users have performed which actions.


At the top of the tasks page there are some widgets providing an overview over all your tasks:

Overview of all tasks
  • The focus of the displayed tasks can be altered by clicking the 24h drop down menu (1). This lets you set the focus alternatively to 12 hours or a week.

  • The table on the bottom left (2) displays all already stopped tasks in three categories: Error, Warning, and Success. This widget is also separated by time into all and the focused time frame.

There is a list of tasks according to your selection beneath:

Overview of all running tasks
  • The Active Filters field (1) displays all currently active filters. This helps to narrow down tasks to specific categories. Clicking the small white cross disables a filter.

  • The Export button (2) will export the currently displayed list of tasks as a .csv file.

  • The Select Action menu (3) allows you to cancel or resume selected tasks.

  • Clicking on the name of a task will open the task overview page for the selected task.

Task Attributes

The comprehension of the State and Result attributes is of particular importance when dealing with tasks. The following tables detail the possible values of these attributes.

The state attribute may have various values as listed below:

Value Description

planned

The task is waiting for the foreman-tasks service to run it.

running

The task has started running but is not finished yet.

stopped

The task has stopped running.

paused

The task has encountered a problem and is waiting for a manual resolution. (Recovery from the error may still be possible).

The result attribute may have various values as listed below:

Value Description

pending

A result has yet to be established. (The task may not have started yet or still be running).

success

The task was completed successfully.

error

The task has encountered an error. (Check the state attribute to see if manual recovery may be possible).

warning

The task encountered an error but was manually resumed and then completed successfully.

cancelled

The task was manually cancelled.

Viewing a Task

The task overview page can be accessed via the list of tasks:

Monitor > Tasks >> list of tasks > Action column > description of task

We will consider the following (trivial) remote execution task as an example. The example task issues the command echo $HOSTNAME to two hosts:

Creating a sample task
  • Select command in the Job category (1) drop down menu.

  • Select run command - SSH default in the Job template drop down menu (2).

  • You may optionally choose to use a bookmark from the Bookmark drop down menu (3).

  • The Search Query field (4) displays the hosts the command will be executed on. This comes from the selection made on the all hosts page when clicking the Schedule Remote Job action.

  • The resolve button (5) allows you to calculate the number of hosts the command will be executed on. This comes in handy when working with regular expressions in the search query field.

  • Clicking the preview button (6) displays the list of hosts the command will be executed on.

  • The command field (7) allows you to enter any shell command to be executed on the selected hosts.

  • The Type of query checkboxes (8) allow for a static or dynamic evaluation of the search query. Selecting dynamic implies that the search query will be evaluated at the time of execution. If the job is set to be run in the future, the list of hosts may change.

  • The Schedule checkboxes (9) allows you to execute the command now, in the future, or have it run recurringly.

  • Remember to click Submit (10) to run the command.

Submitting the task takes you to the task overview page:

Task overview page
  • Clicking the Rerun button (1) presents you the same page as detailed above with prefilled values to quickly rerun the task.

  • Pressing the Job Task button (2) takes you to the following page as shown directly beneath.

  • The pie chart (3) visualizes the result of the run task. It displays the overall status (e.g. 100% success in the example shown) as well as the number of successful, failed, still running and aborted tasks indicated by the icons below the chart.

  • The bottom table (4) displays all hosts the task was run on. Clicking on the name of a host takes you to its result page.

  • The Actions drop down menu (5) allows you to rerun a task on an individual host.

The following page can be accessed by clicking the Job Task button as detailed above:

Job task
  • Clicking the Sub tasks button (1) takes you to the list of sub tasks for the task being viewed as detailed below.

  • The table (2) displays various information about the task in question, such as the user who ran it or the state it is in.

The sub tasks page gives insights to the result of the run task.

Sub task
  • The table (1) displays all stopped tasks separated into three categories: Error, Warning, and Success.

  • Clicking the Export button (2) allows you to export the presented information as a .csv file to your local machine.

  • The bottom table (3) lists all sub tasks, i.e. one sub task per host the task was run on.

Troubleshooting a Task

Tasks are of particular importance for troubleshooting purposes since they are used for the interaction between different system components. Any number of things can go wrong with such interactions and the foreman-tasks plugin provides inbuilt functionality for troubleshooting and recovery.

Refer to the troubleshooting tasks page for more information.