-
Notifications
You must be signed in to change notification settings - Fork 490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable/Disable by glob #381
Conversation
+1
Simple is better
Yes |
if askedTaskName == taskName { | ||
return true, nil | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are not doing any matching here why are we not looping over LoadRaw
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Umm.. I agree, but the reason we need to handle the case where tasks is empty, and we want to fetch all tasks.
The looping LoadRaw is more simple & elegant.. do you have any way can do this and still support the empty tasks array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be missing it but I do not see the change in behavior from the previous implementation to this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make sure we are on the same idea, you are suggesting that instead of using FindTasks and looking at the bucket we will do something like this:
for taskName := range tasks {
raw:=ts.LoadRaw(taskName)
// convert to TaskSummaryInfo, and IsEnabled, and ExecutionStatus
}
If you are suggesting doing this approach, we have the case where the tasks are empty and we want to fetch all tasks - "/tasks", so we are using FindTasks to find the matching tasks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not suggesting that, but rather looking at the original implementation it handled the case where tasks was empty via the ForEach
boltdb bucket call. I see that method has changed but I do not see how its behavior has changed so I am confused as to why it was modified. I am probably just missing something....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, you are suggesting to undo the change in this function? I changed this function to use the FindTasks, but after a little bit of thinking it makes things harder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there is no need to use the FindTasks if it is not necessary.
b1d68f6
to
9c9dcbd
Compare
@nathanielc are we ok on this PR or do you want me to implement delete by glob as well before we merge? |
cacea41
to
083bccf
Compare
@yosiat This looks good to go. Do you want to add a CHANGELOG entry real quick? |
I will do in one hour, I forgot to update the usage for the relevant
|
083bccf
to
d14eeeb
Compare
@nathanielc Updated and added help usage.. |
|
||
Or, you can enable by glob: | ||
|
||
$ kapacitor enable *_alert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines look like there are extras?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops.. I did copy/paste, Will fix this.
3bd1236
to
e893c52
Compare
@yosiat Looks good, I'll merge when its squashed |
* Enabling and disabling tasks by glob, for example: `kapacitor enable window_*` * Deleting tasks by glob * Adding FindTasks method for finding tasks by predicate
e893c52
to
b9d188d
Compare
@nathanielc squashed |
@yosiat : does it mean |
@fatihcode yes |
Issue - #337
For example:
> kapacitor enable "window_*"
Will enable all tasks that starts with "window_"
The same for disable
Notes: