kapacitor icon indicating copy to clipboard operation
kapacitor copied to clipboard

Enabled task is not reloaded after updating it with HTTP PATCH request

Open Tonius opened this issue 7 years ago • 2 comments

Description

When I update the TICKscript of an enabled task using a HTTP PATCH request, the task is not automatically reloaded by Kapacitor. Running kapacitor show does however show the updated script. To make Kapacitor use the updated script, I either have to use kapacitor reload, or disable and re-enable the task using two separate PATCH requests.

This behavior seems unintuitive to me, and I haven't read about it in the documentation. Is this the intended behavior of updating a task?

Environment

  • Xubuntu 16.04.2 LTS (64-bit)
  • Docker version 17.05-0-ce, build 89658be
  • Running Docker image kapacitor:1.2
  • Kapacitor version 1.2.1 (git: master 4628bda2e3fbcc43df694707ec3f640f213cb0dc)

Test case

  • Create a new task with the following script: stream|from().database('testdb').measurement('test')|log().prefix('prefix1')
  • Make sure the task is enabled.
  • Insert a value into the measurement test of the database testdb.
  • Kapacitor should log the measurement with prefix prefix1.
  • Perform a PATCH request to change the script of the task to the following: stream|from().database('testdb').measurement('test')|log().prefix('prefix2'). Only the logging prefix is changed here.
  • Run kapacitor show with the ID of the task. It should show the newly updated script.
  • Insert a value, just like before.
  • Kapacitor should still log the measuremen with prefix prefix1.
  • Reload the task, either by using kapacitor reload or by using two PATCH requests that disable and re-enable the task.
  • Now Kapacitor should log the measurement with the new prefix prefix2.

Tonius avatar Aug 04 '17 09:08 Tonius

I am running on the same issue here, with Kapacitor 1.3, my point is that if you're using the API, your only current option is to send a request to disable and another request to enable a task. It is unnecessary overhead.

My opinion is to either accept a reload_automatically parameter in the API or do it automatically, this algo goes for the command line.

digaoddc avatar Nov 08 '17 18:11 digaoddc

still had this problem. The only change is that the document note this obviously now, but i think provide a individual http parameter to reload task automatically is a better solution

UZPENG avatar Jul 01 '22 07:07 UZPENG