-
Notifications
You must be signed in to change notification settings - Fork 137
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
Filtering pueue status
#213
Comments
This might be useful. It's also an client-only thing, so we don't have to touch any daemon/shared library logic in here as well. Anyhow, I'm a little hesitant to introduce filter logic.. Just in your few examples we had:
The next step would then probably be:
This stuff usually is a pain in the ass to maintain and really hard to get right. I really don't want to bloat the commandline parameters with 10 (exaggerated, but not unrealistic) different filter options, where many of those options might not be compatible with other ones. This leads to a lot of complexity and bug potential. On the other hand, I also don't want to add some kind of "query/filter language", as this is similarily hard to maintain/get right. To be honest, I just don't feel comfortable to implement and maintain a feature with this level of potential complexity right now. One thing we can be sure about is that more filter options will be added over time, once we started doing this. Anyhow, maybe I'm just overlooking some super elegant solution, so feel free to share your thoughts about this :) It would be very interesting to see other projects, that have done this in the past. |
For your information: If i think about filter logic, the first thing that pops into my mind is the taskwarrior filter language. |
Thank you for your response! Introducing flexible filtering logic would definitely be a lot more complicated than I had initially considered when I created the ticket. Doing it "right" would be hard. One thought to handle this is to offload the filtering capabilities to whatever the user chooses then display results using $ pueue status --json | jq 'some filtering logic of my choosing' | pueue status - Piping externally-filtered json back into Another (perhaps long-term) option might be to embed some scripting library like hlua or deno or whatever, and pass each task object through a user-defined filtering expression for that library. This would be a heavier option, but it seems like it would be easy enough to let users get as crafty as they want to without much more than |
Hm. I would definitely go for the long-term option. After letting it sink for a few weeks, I would be fine with a well-tested custom query language, as long as it's not too extensive or dynamic. I'm thinking of something like It would be cool to have somebody join the discussion, who has some experience on this topic. Maybe we could build something fancy with Pest. I was looking for an excuse to play around with this for quite some time. |
Using something like |
Supporting |
This is fine, but even without boutique tools like As for the long term solution, make it an actual filtering language (ie. only inclusion/exclusion) and have sorting be separate (ie. |
To be honest, I think I misunderstood the original proposal of @codekoala. I guess a Though, I would like to have some comment on that subcommand which notifies the user that this command might be removed in the future. |
This sounds like an excellent compromise to me! It seems like all of the interesting functionality is already built, and it would just need to be exposed as a new subcommand that reads from a file/stdin. |
#282 implements the temporary I tested it with a simple Could you verify whether this suits your needs? |
I can verify that the That said, I seem to have underestimated the complexity of a Would you consider having {"id": 0, "original_command": "cowsay", "command": "...." .....}
{"id": 1, "original_command": "cowsay", "command": "...." .....} and use that to reconstruct the form expected by |
For context, this is what I've come up with so far for basic task filtering using $ pueue status --json | jq -c '.tasks | to_entries | map(select(.value.command == "cowsay")) | from_entries'
{"441":{"id":441,"original_command":"cowsay","command":"cowsay","path":"/home/josh/dev/tinker/pueue","envs":{},"group":"default","dependencies":[],"label":null,"status":{"Done":{"Failed":127}},"prev_status":"Queued","start":"2022-01-14T13:22:08.300538697-05:00","end":"2022-01-14T13:22:08.511706488-05:00"}} This seems like it could just be parsed directly into the |
Working with tasks only would work, but we would lose (some) group headline info. Specifically the amount of parallel tasks per group and the current group status. Furthermore, if we want to display tasks sorted by groups, we need a little bit of additional logic, as the current display logic heavily relies on the |
The newest commit on the branch now accepts a map of tasks.
I also found a simple solution to bypass the problem of missing group info. |
@stranger-danger-zamu @codekoala |
@Nukesor this is awesome! Thank you! I can confirm that this is behaving more like what I had in mind when I initially proposed the feature. The only thing that isn't quite as I had expected is the fact that I, personally, consider this feature to be "implemented" with these changes. I don't know whether you would want to keep this ticket open to track eventual work on built-in filtering we discussed earlier in the thread. Perhaps that would merit its own ticket? Thank you again for building this out! |
Perfect, I'm going to merge this then! Anyhow, let's keep this issue open for a possible built-in filtering logic :) |
Don't know if anybody else would be interested in this. I use nushell frequently, and converting pueue to work with nushell isn't too much work. I have this alias for
Then I can do:
Only issue is nu's type constraints are a bit stiff so any |
Hey everyone :) I started working on this feature and already implemented the first steps. @codekoala @d33tah @kjhoerr @stranger-danger-zamu I'll close this issue and continue the discussion on a new ticket for better observability: |
The v3.0.0 release candidate is now published It would be awesome if you could give it a spin and check if there're any bugs or issues :) |
Describe the solution you'd like
It would be great to be able to filter tasks with
pueue status
(or some other command?), particularly when multiple groups are involved. For example, I have cronjobs that queue up multiple types of tasks. It can be rather chaotic to examine the status for all tasks across all groups.Some ideas:
--group
filtering):pueue status --last 10
--delay
option forpueue add
:pueue status --since 1d
pueue status --filter 2021-06-23
pueue status --filter 2021-06-01..2021-06-05
Describe alternatives you've considered
I could use
pueue status --json
andjq
or similar, but...The text was updated successfully, but these errors were encountered: