# InfluxDB v2.2.0: Task can't run automatically

**URL:** <https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686>\
**Category:** Tasks\
**Tags:** influxdb, tasks\
**Created:** [October 2, 2023, 7:33am UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686 "2023-10-02T07:33:53Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![BIN25](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/bin25/32/14371_2.png) [@BIN25](https://community.influxdata.com/u/BIN25)\
**Post date:** [October 2, 2023, 7:33am UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686/1 "2023-10-02T07:33:53Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)\
**Post date:** [October 3, 2023, 5:06pm UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686/2 "2023-10-03T17:06:27Z")

</div>

@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.)?

---

<div class="post-metadata">

**Author:** ![BIN25](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/bin25/32/14371_2.png) [@BIN25](https://community.influxdata.com/u/BIN25)\
**Post date:** [October 4, 2023, 2:54am UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686/3 "2023-10-04T02:54:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)\
**Post date:** [October 4, 2023, 4:06pm UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686/4 "2023-10-04T16:06:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![BIN25](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/bin25/32/14371_2.png) [@BIN25](https://community.influxdata.com/u/BIN25)\
**Post date:** [October 5, 2023, 12:32am UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686/5 "2023-10-05T00:32:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![BIN25](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/bin25/32/14371_2.png) [@BIN25](https://community.influxdata.com/u/BIN25)\
**Post date:** [January 29, 2024, 1:56am UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686/6 "2024-01-29T01:56:31Z")

</div>

@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!

---

<div class="post-metadata">

**Author:** ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)\
**Post date:** [January 29, 2024, 3:26pm UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686/7 "2024-01-29T15:26:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![BIN25](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/bin25/32/14371_2.png) [@BIN25](https://community.influxdata.com/u/BIN25)\
**Post date:** [January 30, 2024, 12:01am UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686/8 "2024-01-30T00:01:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)\
**Post date:** [January 30, 2024, 12:28am UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686/9 "2024-01-30T00:28:55Z")

</div>

And the task is for sure active?

 ![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/e/ea8cff9400d1a1740390a1a72d2bc6538abb2239.png)

---

<div class="post-metadata">

**Author:** ![BIN25](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/bin25/32/14371_2.png) [@BIN25](https://community.influxdata.com/u/BIN25)\
**Post date:** [January 30, 2024, 12:43am UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686/10 "2024-01-30T00:43:10Z")

</div>

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

 ![Screenshot 2024-01-30 at 9.43.29](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/f/fdb48c9ba6c8e9e1fe83355f5ca8037141a87c10.png)

---

<div class="post-metadata">

**Author:** ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)\
**Post date:** [January 30, 2024, 3:31pm UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686/11 "2024-01-30T15:31:37Z")

</div>

And the two runs that exist were manually triggered?

---

<div class="post-metadata">

**Author:** ![BIN25](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/bin25/32/14371_2.png) [@BIN25](https://community.influxdata.com/u/BIN25)\
**Post date:** [January 30, 2024, 11:36pm UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686/12 "2024-01-30T23:36:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)\
**Post date:** [January 30, 2024, 11:47pm UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686/13 "2024-01-30T23:47:50Z")

</div>

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`).

---

<div class="post-metadata">

**Author:** ![BIN25](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/bin25/32/14371_2.png) [@BIN25](https://community.influxdata.com/u/BIN25)\
**Post date:** [January 31, 2024, 1:51am UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686/14 "2024-01-31T01:51:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)\
**Post date:** [January 31, 2024, 4:34pm UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686/15 "2024-01-31T16:34:32Z")

</div>

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](https://github.com/influxdata/influxdb/issues/new/choose).

---

<div class="post-metadata">

**Author:** ![David\_Lekve](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/david_lekve/32/17722_2.png) [@David\_Lekve](https://community.influxdata.com/u/David_Lekve)\
**Post date:** [February 20, 2025, 12:51pm UTC](https://community.influxdata.com/t/influxdb-v2-2-0-task-cant-run-automatically/31686/16 "2025-02-20T12:51:33Z")

</div>

Having the same problem with this task:

option task = {name: “aggregate\_high\_frequency”, every: 10s}

from(bucket: “high\_frequency\_logs”)  
|\> range(start: -10s, stop: now())  
|\> filter(  
fn: (r) =\>  
r.\_measurement == “Battery” or r.\_measurement == “Grid” or r.\_measurement == “Inverter”  
or  
r.\_measurement == “Load” or r.\_measurement == “PV”,  
)  
|\> aggregateWindow(every: 10s, fn: mean, createEmpty: false)  
|\> to(bucket: “logs”)

Was an issue created?

The only thing I have found to help is to run systemctl resart influxdb. Turning the task off and on doesnt work.
