Hello, I ran into an issue that the task in influxDB can’t run automatically.
It can be run in manual but not able to run every 10s.
As a background, I have two influxDB as blue and green environment, the same task can run every 10s without any issue, but the green one can only run by manually.
Let me share the task configuration:
===================
import “experimental”
import “date”
import “system”
option task = {name: “Daily aggregation”, every: 10s}
option v = {bucket: “p-processed”}
customToday = () => {
hour = date.hour(t: system.time())
day_start = experimental.subDuration(d: 9h, from: today())
return if hour < 15 then day_start else experimental.addDuration(d: 1d, to: day_start)
}
base =
from(bucket: “p-raw”)
|> range(start: customToday())
|> filter(fn: (r) => r._measurement == “payment”)
|> filter(fn: (r) => r[“test”] == “0” and r[“deleted”] == “0”)
|> filter(fn: (r) => r.status == “30” or r.status == “90”)
|> filter(fn: (r) => r._field == “amount”)
base
|> aggregateWindow(every: 1h, fn: sum)
|> group(columns: [“status”, “payment_method”])
|> sum()
|> set(key: “_measurement”, value: “daily_aggregation”)
|> set(key: “_field”, value: “sum”)
|> map(fn: (r) => ({r with _time: now()}))
|> to(bucket: v.bucket)
base
|> aggregateWindow(every: 1h, fn: count)
|> group(columns: [“status”, “payment_method”])
|> sum()
|> set(key: “_measurement”, value: “daily_aggregation”)
|> set(key: “_field”, value: “count”)
|> map(fn: (r) => ({r with _time: now()}))
|> to(bucket: v.bucket)
===================
Is there anyone having the same issue? Could you give me some information about how to fix this?
I searched something online but all of them are talking about the query itself, but I have the same query running in blue env without any issue, so I don’t think it can be query’s problem.
Thank you very much!