Task is running despite of stop

Task is running despite of stopped. Its in inactive state but still running.
I created this task from API call.

Task is -

import "influxdata/influxdb/monitor" import "slack" import "influxdata/influxdb/secrets" import "experimental" import "array" option task = {name: "Count Task -RPM 1", every: 1m, offset: 5s} slack_endpoint = slack["endpoint"](url: "https://hooks.slack.com/services/xxxxxxxxxxxxxxxxxxxx") from(bucket: "TEST_DB") |> range(start: -300d) |> filter(fn: (r) => r["_measurement"] == "sensor_data_04698") |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")|> filter(fn: (r) => r["rpm"] == 0 ) |> aggregateWindow(every: 1m, fn: count, createEmpty: false, column: "rpm") |> filter(fn: (r) => (r["rpm"] >0)) |> monitor["notify"](data: {}, endpoint: slack_endpoint(mapFn: (r) => ({channel: "", text: "Message To Slack From Custom Task", color: "danger"})))

Can anyone help please this is unexpected result logically. Please correct me if i wrong somewhere.

Thank you

Hello @debnath,
This looks like a bug.
What version are you running? Cloud or OSS?
Can you do me a huge favor and use the API to query/list all of your tasks?
You can find a postman project with that request here:

Or

curl --location --request GET 'http://us-west-2-1.aws.cloud2.influxdata.com/api/v2/tasks?org=myorg' \
--header 'Authorization: Token mytoken'

Make sure to change your base url

@Anaisdg thank you for reply.

I’m using Influxdb2.0 OSS(Docker instance), OS - Windows10, Language - Python3.6 . I’m using InfluxDB v2.0 API documentation as my postman api library. Is this the same api library that you are asking?

I’m using API only to insert/Update/Delete task from my platform.

My request from postman is like -

Base Url - http://127.0.0.1:8086/api/v2

My python request -

import requests
TASK_API = 'http://127.0.0.1:8086/api/v2/tasks'
INFLUX_HEADER = {'Content-Type': 'application/vnd.flux', 'authorization': ('Token {}').format(INFLUX_TOKEN)}
task_json = {
"description": "New task",
"flux": "import \"influxdata/influxdb/monitor\" import \"slack\" import \"influxdata/influxdb/secrets\" import \"experimental\" import \"array\" option task = {name: \"TEST TASK6\", every: 1m, offset: 5s} slack_endpoint = slack[\"endpoint\"](url: \"https://hooks.slack.com/services/xxxxxxxxxxxxxxxxxxx\") from(bucket: \"TEST_DB\") |> range(start: -5h) |> filter(fn: (r) => r[\"_measurement\"] == \"sensor_data_5e058f8890d\") |> filter(fn: (r) => r[\"Heart_Rate\"]==90 ) |> aggregateWindow(every: 1m, fn: count, createEmpty: false) |> filter(fn: (r) => (r[\"_value\"] >5)) |> monitor[\"notify\"](data: {}, endpoint: slack_endpoint(mapFn: (r) => ({channel: \"\", text: \"Message To Slack\", color: \"danger\"})))",
"org": "xyz",
"orgID": "95dc3721f6ba9293",
"status": "inactive"
}
resp_task = requests.post(TASK_API, headers=INFLUX_HEADER, json = task_json)
print(resp_task.text)

Please let me know if I’m doing wrong.

Can you please lists your tasks with the requests above? I want to verify that your task is being listed as inactive after you’ve created it.
Yes that’s what I’m using as well. I just included a postman project with created requests to make it easier on you.

@Anaisdg

Note - I created task as inactive intentionally. Problem is if the condition that implemented through flux query is satisfy then then its triggering even if its in inactive stage.

UI view that i can show you-

@debnath,
I was asking if you could please list your task to help me debug the situation.
Have you tried toggling it on and back off again?

@Anaisdg I did toggling on and off but it remain same.