Create tasks for automated and scheduled execution

WEM-Native Automated/Scheduled Tasks using this Task feature is available only on full-Kubernetes Private Clouds.

Define Tasks

Use Action Flowchart

(Automated) Tasks can only perform Action Flowcharts, they can not have any User Interaction Nodes. These Task Action Flowcharts must have a Start Node and one End Node. In between they can contain other Action Flowcharts and any node that does not require user interaction. See image below for an example of an Action Flowchart that will be used as a Task and see that nodes with User Interactions are unavailable because the type of flowchart is Action Flow - which you can indicate when you create a new flowchart.

Task definition

When you have created your Action Flowchart(s) that you want to use as Tasks, next step is to define your Task so it can be used for scheduling. In the Navigation Pane you can find the Tasks folder. This is where you define Tasks in your project with a Name, a Description and most importantly the Action Flowchart that should be executed when the Task is run.

This now needs to be published to the WEM Runtime (running on a WEM Kubernetes Cloud) to make it available for tools that can schedule these tasks on that WEM Runtime Environment.

Scheduling Tasks in WEM DevOps Portal

The Task Scheduler is a specific micro-service as part of the WEM Kubernetes Runtime Environment and is responsible for storing and managing the Schedules, as well as executing the Tasks according to those Schedules. Executing Tasks is done on specific threads within the Kubernetes Runtime and mostly separated from the normal Portal usage (like users accessing the portal in their browser). This way, Tasks may run quite long, as long as they need and the Task Scheduler Service will keep it running as needed. So it is very important to make sure that the Task to be performed, is properly tested. Any issues with Task executions may be found in the logs (also available in the DevOps portal).

A WEM Kubernetes Runtime Environment provides several secured API endpoints to support certain DevOps-related features. Scheduling Tasks is one of those API endpoints with which the Task Scheduler micro-service can be accessed to manage Schedules.

The WEM Platform provides the WEM DevOps Portal, a portal created using WEM Modeler that can access the Kubernetes Runtime API Endpoints and make it easy to use. This DevOps Portal is only available to people who require access to their WEM Kubernetes Runtime Environment to use certain WEM-Related DevOps features. Scheduling Tasks in portals running on that environment is one of those features.

If you have access and permissions to schedule tasks, you can to go to the Portals Section in the DevOps portal, find the portal in the list and click the Action button to access the portal-specific features - where Scheduled Tasks is what we're looking for now.

The DevOps portal will access the Portal Definition on the runtime to retrieve the available Tasks as defined and published earlier.

Every task can get multiple schedules, as you can see in the image. The selected task has 6 defined schedules, which are examples of the various schedule types. You can also see if a schedule is enabled, when it was last executed and when the next execution is planned.

Available Schedule Types are:

  • One Time

  • Daily Recurring (time of day or recurring)

  • Weekly Recurring (with daily options)

  • Monthly Recurring (with daily options)

Each Schedule Type provides specific fields to define the schedule. See some examples:

At the creation of Schedules for a Task, the schedule will be Disabled by default unless you switch the Enabled option. A disabled schedule will not be executed, but the definition will be available. You can always Enable and Disable a schedule later via the specific Schedules Details page.

Schedule Details

On the Schedule Details page, you can see the information about the schedule as well as perform following actions:

  • Switch between Enabled and Disabled using the Play/Pause button.

  • Get Current State: this action will ask the Task Scheduling Service for the current state of the specific task. If it is currently running, it will show.

  • Run Task Now: this action will execute the task immediately regardless of the schedule definition - useful for testing.

  • Delete Schedule: will completely remove the schedule definition and the task will no longer be executed. A warning will be displayed to ask if you really want to delete the schedule definition.

  • Edit Schedule: to change the schedule definition, including type and all other type-specific settings.

  • Rename Schedule: the Name of the Schedule is part of the Task Scheduler Endpoint - renaming it is therefore a specific action that also needs to be sent to the Task Scheduler service.

If you are looking for ways to automate and schedule tasks in projects that do not run on a Kubernetes Runtime (like the current Public Clouds in Europe and APAC), read this post on our WEM Forum about using EasyCron

Last updated