From ac4b488fa4c33c2a07a741bc10992f7a174db327 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Thu, 17 Jan 2019 15:39:35 -0700 Subject: [PATCH] WIP task docs --- .../common-tasks/downsample-data.md | 7 ++++-- .../process-data/manage-tasks/create-task.md | 22 ++++++++++++++++++- content/v2.0/process-data/task-options.md | 3 +-- content/v2.0/process-data/write-a-task.md | 6 ++++- 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/content/v2.0/process-data/common-tasks/downsample-data.md b/content/v2.0/process-data/common-tasks/downsample-data.md index 9a565fef4..0a5149684 100644 --- a/content/v2.0/process-data/common-tasks/downsample-data.md +++ b/content/v2.0/process-data/common-tasks/downsample-data.md @@ -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) - ``` diff --git a/content/v2.0/process-data/manage-tasks/create-task.md b/content/v2.0/process-data/manage-tasks/create-task.md index f578415e9..da9c08534 100644 --- a/content/v2.0/process-data/manage-tasks/create-task.md +++ b/content/v2.0/process-data/manage-tasks/create-task.md @@ -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 - # to open stdin pipe + +options task = { + name: "task-name", + every: 6h +} + +# ... Task script ... + +# to close the pipe and submit the command ``` diff --git a/content/v2.0/process-data/task-options.md b/content/v2.0/process-data/task-options.md index fc1ea7d5c..3c86f818a 100644 --- a/content/v2.0/process-data/task-options.md +++ b/content/v2.0/process-data/task-options.md @@ -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_ diff --git a/content/v2.0/process-data/write-a-task.md b/content/v2.0/process-data/write-a-task.md index 2f04f8e03..243a68ae1 100644 --- a/content/v2.0/process-data/write-a-task.md +++ b/content/v2.0/process-data/write-a-task.md @@ -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: