跳到主要内容

Task

1. Overview

A Task can execute one or more Actions at a given time. All Actions of a Task can also be executed manually on the Web Portal, to execute immediately.

2. Configure Tasks

You can configure a Task via the Web Portal as shown below.

Modify the configuration of a Task by clicking on the Task Name in the Task list. Add a new Task by clicking on the + Add Task button. When you add or modify a Task, you will see the Task configuration interface, as shown below.

image-20230629142756360

To manually execute all the Actions of a Task immediately, click the Run button.

Configure or modify a Task:

  • First, enter the name of the Task. The Task name must be unique within the game region.
  • Next, enter a description of the Task (optional).
  • Schedule the Task with a cron expression. For example, "0 0 20 ? * *" will schedule the Task for 20:00 every day. You can click Cron Tool Page to access a "Cron Expression Generator" page and generate the cron expression.
  • Last, configure the Actions:
    • Click + Add Action to add more Actions.
    • If you click the input box for Json Args, an input dialog box will pop up to allow you to enter a JSON-formatted argument for the Action.

image-20210309175848923

  • When you have completed all configuration items, click Submit to save the current configuration.

Cron Expression

A cron expression is a string comprised of 6 different fields separated by white space. Each field can comprise any of the allowed values, along with different variations of the allowed special characters for that field. The fields are as follows:

Field NameMandatoryAllowed ValuesAllowed Special Chars
SecondsYes0-59, - * /
MinutesYes0-59, - * /
HoursYes0-23, - * /
Day of monthYes1-31, - * ? /
Month(s)Yes1-12 or JAN-DEC, - * /
Day of weekYes1-7 or SUN-SAT, - * ? /

Cron Special Characters

Special characterDescription
* ("all values")Used for selecting all values within a field. E.g.: "*" in the hour field indicates "every hour"
? ("no specific value")Used to select something specific in one field while generating something random in the second field.E.g.: If you want the trigger to fire on one day of a month but don't care about what day it is, then you can specify the field as "?" in the day field.
-Specifies ranges. E.g.: "15-17" in the day field indicates the days 15, 16, and 17.
,Used for indicating additional values. E.g.: "9,10,11" in the hour field indicates the 9th, 10th and 11th hours in a day.
/Indicates increments. E.g.: If "0/30" is given in the minutes field, it indicates you selected the minutes 0, 30, 60, and 90. Similarly if you gave "15/30" then the selection are the minutes 15, 45, 75, and 105. You can also include '/' after the '' character - in this case '' which is equivalent to having '0' before the '/'. '2/5' in the day-of-month field means "fire every 5 days starting on the second day of the month".

3. Data Schema

When task action is triggered, the bound Virtual Server or Webhook will receive the POST request with the sepecific data. All the data schema is defined in the doc Extension Data Schema. Here is a sample for HTTP request body:

{
"trigger_id": "26876866-f022-4afb-85ec-d4baf1968828",
"execution_id": "e3e7668110c34ba19ac25bfd3aba5956",
"task_name": "test",
"task_time": "17098563452",
"args": {"arg1": "test"}
}

4. Log Query

You can read and query the trigger logs of a Task, as shown below.

image-20240304193901329

The gray banner on the right shows the following information:

  • Task Name: The Task of this log.
  • Server Name: The Virtual Server name of this log.
  • Trigger Type: The task trigger type. auto means the task was triggered by the server, manual means the task was triggered by a developer in debugging mode.

When you click on the condition input box, a time selector will pop up for you to select the time period of the log, as shown below.

image-20210311192653418