InfluxDB v2.2.0: Task can't run automatically

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!

@BIN25 Are you getting any error messages in your task logs about the task? Is the task itself failing? Do the environments have the same underlying OS and system resources (RAM, CPU, etc.)?

No, there is no any error messages, and manual run can be completed successfully, just not able to run automatically.
The environments are the same, with same OS and resources in two nodes, but the version of influxDB are different, the one normal is 2.1.1, the one not working is 2.2.0.

Interesting. Any reason not to update them to the most recent OSS build (2.7)?

We are going to do the upgrade if no more other solutions, but there is 129G data in our current environment, and it takes very long time to backup the data before upgrading.
Is it a proper way to upgrade without losing the data?

@scott Hi, we did the update to 2.7, but still the task is not running automatically, but manually run works perfectly, I think it’s not the issues of the version.

Is there any other possibilities you would suggest to have a check?

Thanks!

@BIN25 When you run the task manually, how long does it take to complete?

Hello @scott, thanks for your reply.
It took around 0.2 seconds to complete.

And the task is for sure active?

Yes, it is active.
I tried to turn off and turn on again, but still not working. Let me share:

And the two runs that exist were manually triggered?

Yes, they were triggered manually, and put the data into the bucket successfully, so I think the script itself should be fine.

This is a tough one. I don’t know why this task wouldn’t run automatically. I wonder if there may be clues in your InfluxDB logs (output from influxd).

Thanks for your reply.
It seems like nothing useful from the logs, is there any dependencies task feature need?

Nothing that I’m aware of or that you should have to worry about. This is probably a bug that merits a new issue on Github.