-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Add -a option to service/node ps #25983
Conversation
cc @thaJeztah @stevvooe @aluzzardi Also, I'll try to remove the |
Whoops, I guess Gordon + Update Branch button = not friends. |
1830083
to
53fd929
Compare
Args: cli.RequiresMinArgs(1), | ||
Use: "inspect [OPTIONS] [NODE...]", | ||
Short: "Display detailed information on one or more nodes (default to current node)", | ||
Args: 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.
Instead of nil
could you use cobra.ArbitraryArgs
so it's more explicit about what args are accepted?
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'm gonna be removing this shortly as it's covered in another PR by someone else. The only logic that will be in this one is the -a
flag stuff.
2abf69b
to
25c368b
Compare
25c368b
to
0f1cc69
Compare
design LGTM. Moving to code review |
for the API - should this change be versioned? (i.e., for API 1.24 ignore the "all" option, and default to "all", for API 1.25 the opposite?) |
@@ -292,6 +292,7 @@ type ServiceListOptions struct { | |||
// TaskListOptions holds parameters to list tasks with. | |||
type TaskListOptions struct { | |||
Filter filters.Args | |||
All bool |
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.
This shouldn't require such a literal API change. Shouldn't an empty filter send all?
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 was following the same pattern in docker ps
to keep it consistent. I agree though 👍
We need to be careful about the meaning of "all" here. In a cluster, this is very tricky. Most of the filtering here should be done on the client-side. Also, right now, we mostly already show everything, so this PR would restrict to only running tasks (or preparing/starting, as well). Let's make sure that change is what we want. cc @aluzzardi |
@stevvooe Why do you think filtering should be done client-side? The logic is already in swarm to filter tasks, which reduces bytes over the wire. The result could be pretty large in a bigger cluster. Also, costly if you require quorum on each task returned. What exactly are you worried about with "all" here? In this case, it really is all because the daemon is requesting a list from a manager. The UX here seems very similar to that of |
@@ -5088,6 +5088,9 @@ List tasks | |||
|
|||
**Query parameters**: | |||
|
|||
- **all** – 1/True/true or 0/False/false, Show all containers. | |||
Only tasks that will be running or are currently running are shown by default(i.e., this defaults to false) | |||
|
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 think v1.24 is already released, so it shouldn't be added here.
c.Assert(out, checker.Count, name, 2) | ||
c.Assert(out, checker.Contains, "Running") | ||
c.Assert(out, checker.Contains, "Shutdown") | ||
} |
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.
This looks like it's at least a couple different cases. I think this should be split up into different tests with a descriptive name of each case.
Does "all" really mean all or will it come to mean the output that is shown with Don't bind UX to API. We keep making this mistake and it makes this project impossible to work on because I keep finding UX buried deep in the backend. |
ping @stevvooe what do you suggest for changes? Is there some way to unblock this PR? |
@thaJeztah By default, without a filter, the tasks endpoint should already return all. The standard mode in CLI should filter by state (all tasks |
Sounds good to me. |
0f1cc69
to
d88cee5
Compare
@stevvooe PTAL. |
d88cee5
to
33e4f5e
Compare
One nit in docs, but LGTM otherwise
Yeah, this needs changes to those https://github.com/docker/docker/tree/master/contrib/completion, but we can also do those in a follow up if you prefer |
Signed-off-by: Josh Horwitz <horwitzja@gmail.com>
33e4f5e
to
139fff2
Compare
@thaJeztah follow up PR sounds good to me. I made a ticket #28108 |
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.
LGTM
/cc @vdemeester
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.
LGTM 🐸
TBH I'm not a fan of this change. It's a big UI change from 1.12.x and I think it will be confusing to users. I just encountered it while using 1.13.0-rc1. I was trying to understand why a service wasn't starting, and
I eventually discovered |
I would suggest changing this so that we do show failed tasks by default, if there's no currently running tasks. |
@aaronlehmann this is no different from how you would look into a container in |
…ps -a` In moby#28507 and moby#28885, `docker service/node ps -a` has been removed so that information about slots are show up even without `-a` flag. The output of `docker stack ps` reused the same output as `docker service/node ps`. However, the `-a` was still there. It might make sense to remove `docker stack ps -a` as well to bring consistency with `docker service/node ps`. This fix is related to moby#28507, moby#28885, and moby#25983. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
…ps -a` In moby#28507 and moby#28885, `docker service/node ps -a` has been removed so that information about slots are show up even without `-a` flag. The output of `docker stack ps` reused the same output as `docker service/node ps`. However, the `-a` was still there. It might make sense to remove `docker stack ps -a` as well to bring consistency with `docker service/node ps`. This fix is related to moby#28507, moby#28885, and moby#25983. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> (cherry picked from commit 9155e14) Signed-off-by: Victor Vieux <vieux@docker.com> Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Add -a option to service/node ps
…ps -a` In moby#28507 and moby#28885, `docker service/node ps -a` has been removed so that information about slots are show up even without `-a` flag. The output of `docker stack ps` reused the same output as `docker service/node ps`. However, the `-a` was still there. It might make sense to remove `docker stack ps -a` as well to bring consistency with `docker service/node ps`. This fix is related to moby#28507, moby#28885, and moby#25983. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Reopened #25251 because of weird github issue.
closes #25180
closes #25196
- What I did
I added an
-a
and--all
flag to both commands to show all tasks.- How I did it
Added a default filter to the CLI command when -a is false.
- How to verify it
Look at tests.
Run
docker service ps
&docker node ps
on various nodes to ensure that only tasks are shown that are running or will be running w/o the-a
flag. Also, make sure that--filter desired-state=<state>
works with-a
true/false.- Description for the changelog
Add -a option to service/node ps
Signed-off-by: Josh Horwitz horwitzja@gmail.com