Monthly task - cron not working

[quote]
View in #influxdb-v2 on Slack

![Victor_Santos] @Victor_Santos: Hi there,

I’m having an issue with how InfluxDB 2.x schedules monthly flux tasks - they are not getting scheduled as expected. This issue is present in InfluxDB 2.3 (Docker) and InfluxDB 2.0 (Ubuntu running as a service).

I have four task examples:
• Two of them are using cron, with and without delay
option task = {name: "task.monthly.cron.test1-no-delay", cron: "0 0 1 ** **", concurrency: 1}
option task = {name: "task.monthly.cron.test2-delay", cron: "0 0 1 ** **", offset: 2h43m, concurrency: 1}

• The other two are using “every”, with and without delay
option task = {\n name: "task.monthly.every.test1-no-delay",\n every: 1mo,\n concurrency: 1\n}
option task = {\n name: "task.monthly.every.test2-delay",\n every: 1mo,\n offset: 163m,\n concurrency: 1\n}

# influx task list | grep test
09c00fd376ea1000 task.monthly.cron.test1-no-delay        bf58d7a988eadd0e   OrgA        active             0 0 1 * *
09c00fd3806a1000 task.monthly.every.test1-no-delay              bf58d7a988eadd0e   OrgA        active      1mo   
09c00fd387aa1000 task.monthly.every.test2-delay                 bf58d7a988eadd0e   OrgA        active      1mo   
09c00fd3926a1000 task.monthly.cron.test2-delay                  bf58d7a988eadd0e   OrgA        active             0 0 1 * *

The “every” tasks do not even get scheduled:

# influx task run list --task-id 09c00fd3806a1000
ID    TaskID Status ScheduledFor StartedAt   FinishedAt      RequestedAt
# influx task run list --task-id 09c00fd387aa1000
ID    TaskID Status ScheduledFor StartedAt   FinishedAt      RequestedAt
#

The ones with “cron” did get scheduled, but not at the expected times and note the re-occurrence:

# influx task run list --task-id 09c00fd376ea1000    // cron.test1-no-delay
ID                 TaskID             Status ScheduledFor       StartedAt                FinishedAt               RequestedAt
09c42634f4aa1000   09c00fd376ea1000   success     2022-08-02T22:09:35Z 2022-08-02T22:09:35.732521224Z  2022-08-02T22:09:36.613404555Z   2022-08-02T22:09:35Z
09c1ac4c02aa1000   09c00fd376ea1000   success     2022-08-01T00:00:00Z 2022-08-01T00:00:00.021020327Z  2022-08-01T00:00:00.773905686Z    
 
# influx task run list --task-id 09c00fd3926a1000   // cron.test2-delay
ID                 TaskID             Status ScheduledFor       StartedAt                FinishedAt               RequestedAt
09c1d19ac96a1000   09c00fd3926a1000   success     2022-08-01T00:00:00Z 2022-08-01T02:43:00.017530953Z  2022-08-01T02:43:00.613371172Z    

I have the flux tasks writing out the start/stop and the system times as a diagnostic, and here are the results for cron.test1-no-delay:

start: 2022-07-01T13:30:00.000000000Z: stop: 2022-08-01T00:00:00.000000000Z: time: 2022-07-19T00:00:00.000000000Z: system: 2022-08-01T00:00:00.032199180Z
start: 2022-07-03T11:39:35.000000000Z: stop: 2022-08-02T22:09:35.000000000Z: time: 2022-07-19T00:00:00.000000000Z: system: 2022-08-02T22:09:35.746783445Z

Two observations:

  1. start/stop is meant to represent the report range, but note the start time – it’s not even set to the beginning of the day as expected from the flux command: range(start: -1mo)
  2. The unexpected second run – note the system time
    I tried looking at the Influx logs, but I don’t see any messages related to these flux tasks.

Is there something wrong with monthly flux tasks? I have no issues with hourly and daily flux tasks.

Cheers,
Victor.

Hello @Vic,
Welcome!
I responded in slack. I’m not sure what’s going on so I’ve tried to loop some other people in.
Thank you for your patience.