WIP task docs
parent
61851dfad3
commit
ac4b488fa4
|
@ -15,6 +15,10 @@ menu:
|
||||||
- Some type of aggregation
|
- Some type of aggregation
|
||||||
- and a `to` statement
|
- and a `to` statement
|
||||||
|
|
||||||
|
- You can't write data into the same bucket you're reading from
|
||||||
|
- A two buckets
|
||||||
|
- `to()` requires a bucket AND org
|
||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
option task = {
|
option task = {
|
||||||
|
@ -30,8 +34,7 @@ downsampleHourly = (table=<-) =>
|
||||||
table
|
table
|
||||||
|> aggregateWindow(fn: mean, every: 1h)
|
|> aggregateWindow(fn: mean, every: 1h)
|
||||||
|> set(key: "_measurement", value: "cpu_1h" )
|
|> set(key: "_measurement", value: "cpu_1h" )
|
||||||
|> to(bucket: "telegraf_downsampled")
|
|> to(bucket: "telegraf_downsampled", org: "my-org")
|
||||||
|
|
||||||
downsampleHourly(data)
|
downsampleHourly(data)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -11,12 +11,32 @@ menu:
|
||||||
weight: 1
|
weight: 1
|
||||||
---
|
---
|
||||||
|
|
||||||
|
_This article assumes you have already [written a task](/v2.0/process-data/write-a-task)._
|
||||||
|
|
||||||
## Create a task in the InfluxDB UI
|
## Create a task in the InfluxDB UI
|
||||||
|
|
||||||
|
- From the data Explorer
|
||||||
|
- From the task UI
|
||||||
|
|
||||||
## Create a task with the `influx` CLI
|
## Create a task with the `influx` CLI
|
||||||
|
Use `influx task create` command to create a new task.
|
||||||
|
It accepts either a file path or raw Flux.
|
||||||
|
|
||||||
|
###### Create a task using a file
|
||||||
```sh
|
```sh
|
||||||
influx task create /path/to/task-script.flux
|
influx task create --org=org-name @/path/to/task-script.flux
|
||||||
|
```
|
||||||
|
|
||||||
|
###### Create a task using raw Flux
|
||||||
|
```sh
|
||||||
|
influx task create --org=org-name - # <return> to open stdin pipe
|
||||||
|
|
||||||
|
options task = {
|
||||||
|
name: "task-name",
|
||||||
|
every: 6h
|
||||||
|
}
|
||||||
|
|
||||||
|
# ... Task script ...
|
||||||
|
|
||||||
|
# <ctrl-d> to close the pipe and submit the command
|
||||||
```
|
```
|
||||||
|
|
|
@ -25,8 +25,7 @@ The following task options are available:
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
## name
|
## name
|
||||||
The name of the task.
|
The name of the task. _**Required**_.
|
||||||
If no name is specified, the generated task ID is used.
|
|
||||||
|
|
||||||
_**Data type:** String_
|
_**Data type:** String_
|
||||||
|
|
||||||
|
|
|
@ -104,9 +104,13 @@ The example below uses Flux's [`to()` function](#) to send the transformed data
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// ...
|
// ...
|
||||||
|> to(bucket: "telegraf_downsampled")
|
|> to(bucket: "telegraf_downsampled", org: "my-org")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
{{% note %}}
|
||||||
|
You cannot write to the same bucket you are reading from.
|
||||||
|
{{% /note %}}
|
||||||
|
|
||||||
## Full example task script
|
## Full example task script
|
||||||
Below is the full example task script that combines all of the components described above:
|
Below is the full example task script that combines all of the components described above:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue