tasks.lastSuccess() function

The tasks.lastSuccess() function returns the time of last successful run of the InfluxDB task or the value of the orTime parameter if the task has never successfully run.

  1. import "influxdata/influxdb/tasks"
  2. tasks.lastSuccess(orTime: 2020-01-01T00:00:00Z)

Parameters

orTime

The default time value returned if the task has never successfully run.

*Data type: Time | Duration*

Examples

Query data since the last successful task run
  1. import "influxdata/influxdb/tasks"
  2. options task = {
  3. name: "Example task",
  4. every: 30m
  5. }
  6. from(bucket: "example-bucket")
  7. |> range(start: tasks.lastSuccess(orTime: -task.every))
  8. // ...