Trying to use lastSuccess() in a task. But a panic error is coming - “Failed to update task: a panic has occurred: /api/v2/tasks/072c656902f2d000: interface conversion: interface {} is nil, not execute.ExecutionDependencies”. Also tried with subsituting a variable : var = tasks.lastSuccess(orTime: -task.every) and then putting in range(start:var), still same error coming.
import “influxdata/influxdb/tasks”
option task = {
name: “abc”,
every: 1h,
offset:5m
}
//var = tasks.lastSuccess(orTime: -task.every)
f = (a, b) =>
(from(bucket: a)
|> range(start: tasks.lastSuccess(orTime: -task.every))
|> filter(fn: (r) =>
(r[“_measurement”] == “cu_om”))
|> filter(fn: (r) =>
(r[“_field”] == “abc”))
|> mean(column: “_value”)
|> duplicate(as: “_time”, column: “_stop”)
|> window(every: inf)
|> group(columns: [“node”])
|> map(fn: (r) =>
({
time: r._time,
_measurement: “cu_kpi”,
_field: “abc”,
node: r.node,
_value: float(v: r._value) / 100.0,
}))
|> to(bucket: b, org: “airvana”, timeColumn: “time”))
f(a: “atlas_om”, b: “KPI_values”)
f(a: “atlas_om_test”, b: “KPI_values_test”)