WIP task docs

pull/20/head
Scott Anderson 2019-01-17 15:39:35 -07:00
parent 61851dfad3
commit ac4b488fa4
4 changed files with 32 additions and 6 deletions

View File

@ -15,6 +15,10 @@ menu:
- Some type of aggregation
- 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
option task = {
@ -30,8 +34,7 @@ downsampleHourly = (table=<-) =>
table
|> aggregateWindow(fn: mean, every: 1h)
|> set(key: "_measurement", value: "cpu_1h" )
|> to(bucket: "telegraf_downsampled")
|> to(bucket: "telegraf_downsampled", org: "my-org")
downsampleHourly(data)
```

View File

@ -11,12 +11,32 @@ menu:
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
- From the data Explorer
- From the task UI
## 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
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
```

View File

@ -25,8 +25,7 @@ The following task options are available:
{{% /note %}}
## name
The name of the task.
If no name is specified, the generated task ID is used.
The name of the task. _**Required**_.
_**Data type:** String_

View File

@ -104,9 +104,13 @@ The example below uses Flux's [`to()` function](#) to send the transformed data
```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
Below is the full example task script that combines all of the components described above: