2019-01-16 17:41:37 +00:00
|
|
|
---
|
|
|
|
title: Task configuration options
|
|
|
|
seotitle: InfluxDB task configuration options
|
2019-01-19 00:29:28 +00:00
|
|
|
description: >
|
|
|
|
Task options define specific information about a task such as its name,
|
|
|
|
the schedule on which it runs, execution delays, and others.
|
2019-01-16 17:41:37 +00:00
|
|
|
menu:
|
|
|
|
v2_0:
|
|
|
|
name: Task options
|
|
|
|
parent: Process data
|
2019-02-06 17:48:09 +00:00
|
|
|
weight: 105
|
2019-02-05 18:39:00 +00:00
|
|
|
v2.0/tags: [tasks, flux]
|
2019-01-16 17:41:37 +00:00
|
|
|
---
|
|
|
|
|
2019-10-30 18:53:06 +00:00
|
|
|
Task options define specific information about a task.
|
|
|
|
They are set in a Flux script or in the InfluxDB user interface (UI).
|
2019-01-16 22:26:44 +00:00
|
|
|
The following task options are available:
|
|
|
|
|
|
|
|
- [name](#name)
|
|
|
|
- [every](#every)
|
|
|
|
- [cron](#cron)
|
|
|
|
- [offset](#offset)
|
|
|
|
- [concurrency](#concurrency)
|
|
|
|
- [retry](#retry)
|
|
|
|
|
|
|
|
{{% note %}}
|
|
|
|
`every` and `cron` are mutually exclusive, but at least one is required.
|
|
|
|
{{% /note %}}
|
|
|
|
|
|
|
|
## name
|
2019-01-17 22:39:35 +00:00
|
|
|
The name of the task. _**Required**_.
|
2019-01-16 17:41:37 +00:00
|
|
|
|
|
|
|
_**Data type:** String_
|
|
|
|
|
2019-01-16 22:26:44 +00:00
|
|
|
```js
|
|
|
|
options task = {
|
|
|
|
name: "taskName",
|
2019-01-18 06:04:56 +00:00
|
|
|
// ...
|
2019-01-16 22:26:44 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## every
|
|
|
|
The interval at which the task runs.
|
2019-01-16 17:41:37 +00:00
|
|
|
|
|
|
|
_**Data type:** Duration_
|
|
|
|
|
2019-01-16 22:26:44 +00:00
|
|
|
```js
|
|
|
|
options task = {
|
2019-01-18 06:04:56 +00:00
|
|
|
// ...
|
2019-01-16 22:26:44 +00:00
|
|
|
every: 1h,
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-10-30 18:53:06 +00:00
|
|
|
{{% note %}}
|
|
|
|
In the InfluxDB UI, the **Interval** field sets this option.
|
|
|
|
{{% /note %}}
|
|
|
|
|
2019-01-16 22:26:44 +00:00
|
|
|
## cron
|
2019-01-18 06:04:56 +00:00
|
|
|
The [cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that
|
|
|
|
defines the schedule on which the task runs.
|
|
|
|
Cron scheduling is based on system time.
|
2019-01-16 17:41:37 +00:00
|
|
|
|
|
|
|
_**Data type:** String_
|
|
|
|
|
2019-01-16 22:26:44 +00:00
|
|
|
```js
|
|
|
|
options task = {
|
2019-01-18 06:04:56 +00:00
|
|
|
// ...
|
2019-01-16 22:26:44 +00:00
|
|
|
cron: "0 * * * *",
|
|
|
|
}
|
|
|
|
```
|
2019-01-16 17:41:37 +00:00
|
|
|
|
2019-01-16 22:26:44 +00:00
|
|
|
## offset
|
|
|
|
Delays the execution of the task but preserves the original time range.
|
|
|
|
For example, if a task is to run on the hour, a `10m` offset will delay it to 10
|
|
|
|
minutes after the hour, but all time ranges defined in the task are relative to
|
|
|
|
the specified execution time.
|
2019-01-18 06:04:56 +00:00
|
|
|
A common use case is offsetting execution to account for data that may arrive late.
|
2019-01-16 17:41:37 +00:00
|
|
|
|
|
|
|
_**Data type:** Duration_
|
|
|
|
|
2019-01-16 22:26:44 +00:00
|
|
|
```js
|
|
|
|
options task = {
|
|
|
|
// ...
|
|
|
|
offset: "0 * * * *",
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## concurrency
|
2019-01-18 06:04:56 +00:00
|
|
|
The number task of executions that can run concurrently.
|
|
|
|
If the concurrency limit is reached, all subsequent executions are queued until
|
|
|
|
other running task executions complete.
|
2019-01-16 17:41:37 +00:00
|
|
|
|
|
|
|
_**Data type:** Integer_
|
|
|
|
|
2019-01-16 22:26:44 +00:00
|
|
|
```js
|
|
|
|
options task = {
|
|
|
|
// ...
|
|
|
|
concurrency: 2,
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## retry
|
|
|
|
The number of times to retry the task before it is considered as having failed.
|
2019-01-16 17:41:37 +00:00
|
|
|
|
|
|
|
_**Data type:** Integer_
|
2019-01-16 22:26:44 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
options task = {
|
|
|
|
// ...
|
|
|
|
retry: 2,
|
|
|
|
}
|
|
|
|
```
|