DockerCLI/cli/command
Andrii Berehuliak 80b22064d1
Improve service tasks grouping on printing
When printing services' tasks with `docker service ps` command, tasks are grouped only by task slot.
This leads to interleaving tasks from different services when `docker service ps` is called with multiple services.

Besides this, global services do not have slots at all and printing tasks for them doesn't group and
doesn't properly indent tasks with \_.

With this patch all tasks are grouped by service ID, slot and node ID (relevant only for global services) and it fixes issue 533.

Before this patch:

```console
docker service ps a b c

ID                  NAME                              IMAGE               NODE                DESIRED STATE       CURRENT STATE                     ERROR               PORTS
xbzm6ed776yw        c.j1afavbqqhr21jvnid3nnfoyt       nginx:alpine        docker-desktop      Running             Running 5 seconds ago
4mcsovp8ckwn         \_ c.j1afavbqqhr21jvnid3nnfoyt   nginx:alpine        docker-desktop      Shutdown            Shutdown 6 seconds ago
qpcgdsx1r21a        b.1                               nginx:alpine        docker-desktop      Running             Running 2 seconds ago
kfjo1hly92l4        a.1                               nginx:alpine        docker-desktop      Running             Running 5 seconds ago
pubrerosvsw5        b.1                               nginx:alpine        docker-desktop      Shutdown            Shutdown 3 seconds ago
fu08gfi8tfyv        a.1                               nginx:alpine        docker-desktop      Shutdown            Shutdown 7 seconds ago
pu6qmgyoibq4        b.2                               nginx:alpine        docker-desktop      Running             Ready 1 second ago
tz1n4hjne6pk         \_ b.2                           nginx:alpine        docker-desktop      Shutdown            Shutdown less than a second ago
xq8dogqcbxd2        a.2                               nginx:alpine        docker-desktop      Running             Running 44 seconds ago
rm40lofzed0h        a.3                               nginx:alpine        docker-desktop      Running             Starting less than a second ago
sqqj2n9fpi82        b.3                               nginx:alpine        docker-desktop      Running             Running 5 seconds ago
prv3gymkvqk6         \_ b.3                           nginx:alpine        docker-desktop      Shutdown            Shutdown 6 seconds ago
qn7c7jmjuo76        a.3                               nginx:alpine        docker-desktop      Shutdown            Shutdown less than a second ago
wi9330mbabpg        a.4                               nginx:alpine        docker-desktop      Running             Running 2 seconds ago
p5oy6h7nkvc3         \_ a.4                           nginx:alpine        docker-desktop      Shutdown            Shutdown 3 seconds ago
```

After this patch:

```console
docker service ps a b c

ID                  NAME                              IMAGE               NODE                DESIRED STATE       CURRENT STATE             ERROR               PORTS
kfjo1hly92l4        a.1                               nginx:alpine        docker-desktop      Running             Running 32 seconds ago
fu08gfi8tfyv         \_ a.1                           nginx:alpine        docker-desktop      Shutdown            Shutdown 34 seconds ago
3pam0limnn24        a.2                               nginx:alpine        docker-desktop      Running             Running 23 seconds ago
xq8dogqcbxd2         \_ a.2                           nginx:alpine        docker-desktop      Shutdown            Shutdown 24 seconds ago
rm40lofzed0h        a.3                               nginx:alpine        docker-desktop      Running             Running 26 seconds ago
qn7c7jmjuo76         \_ a.3                           nginx:alpine        docker-desktop      Shutdown            Shutdown 27 seconds ago
wi9330mbabpg        a.4                               nginx:alpine        docker-desktop      Running             Running 29 seconds ago
p5oy6h7nkvc3         \_ a.4                           nginx:alpine        docker-desktop      Shutdown            Shutdown 30 seconds ago
qpcgdsx1r21a        b.1                               nginx:alpine        docker-desktop      Running             Running 29 seconds ago
pubrerosvsw5         \_ b.1                           nginx:alpine        docker-desktop      Shutdown            Shutdown 30 seconds ago
pu6qmgyoibq4        b.2                               nginx:alpine        docker-desktop      Running             Running 26 seconds ago
tz1n4hjne6pk         \_ b.2                           nginx:alpine        docker-desktop      Shutdown            Shutdown 27 seconds ago
sqqj2n9fpi82        b.3                               nginx:alpine        docker-desktop      Running             Running 32 seconds ago
prv3gymkvqk6         \_ b.3                           nginx:alpine        docker-desktop      Shutdown            Shutdown 33 seconds ago
xbzm6ed776yw        c.j1afavbqqhr21jvnid3nnfoyt       nginx:alpine        docker-desktop      Running             Running 32 seconds ago
4mcsovp8ckwn         \_ c.j1afavbqqhr21jvnid3nnfoyt   nginx:alpine        docker-desktop      Shutdown            Shutdown 33 seconds ago
```

Signed-off-by: Andrii Berehuliak <berkusandrew@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-17 14:47:12 +01:00
..
builder unused-for is a deprecated synonym 2019-10-30 14:52:14 +11:00
checkpoint formatter package heavy refactoring 2018-10-23 17:05:44 +02:00
commands Remove "docker engine" subcommands 2019-12-12 17:51:25 +01:00
config File is not `goimports`-ed (goimports) 2019-10-31 19:22:24 +01:00
container docker run: specify cgroup namespace mode with --cgroupns 2020-01-29 22:50:37 +00:00
context cli/command/context: Using the variable on range scope `c` in function literal (scopelint) 2019-10-31 19:22:35 +01:00
formatter Fix docker ps table headers with custom format and "split" or "join" 2019-12-27 12:36:02 +01:00
idresolver File is not `goimports`-ed (goimports) 2019-10-31 19:22:24 +01:00
image implement docker push -a/--all-tags 2020-01-28 16:21:06 +01:00
inspect Update tests to use gotest.tools 👼 2018-06-08 18:24:26 +02:00
manifest Add riscv64 to manifest annotation and bash completion 2019-09-10 13:00:23 -03:00
network Update flag doc 2019-10-29 12:01:30 +01:00
node File is not `goimports`-ed (goimports) 2019-10-31 19:22:24 +01:00
plugin cli/command/plugin/list_test.go:61:31: `TestList$1` - `filter` is unused (unparam) 2019-10-31 19:22:19 +01:00
registry Remove deprecated docker search --automated and --stars flags 2020-02-13 17:19:54 +01:00
secret cli/command/secret: G101: Potential hardcoded credentials (gosec) 2019-10-31 19:22:27 +01:00
service Add log-driver and options to service inspect "pretty" format 2020-01-17 15:10:36 +01:00
stack Remove experimental "deploy" from "dab" files 2019-12-09 10:34:14 +01:00
swarm File is not `goimports`-ed (goimports) 2019-10-31 19:22:24 +01:00
system vendor: update docker to 58c2615208962a458ed94f4b6262eb27e5e021cd 2020-02-12 18:45:12 +01:00
task Improve service tasks grouping on printing 2020-02-17 14:47:12 +01:00
testdata Dynamically register kubernetes context store endpoint type. 2019-05-20 13:28:11 +01:00
trust implement docker push -a/--all-tags 2020-01-28 16:21:06 +01:00
volume File is not `goimports`-ed (goimports) 2019-10-31 19:22:24 +01:00
cli.go Remove "docker engine" subcommands 2019-12-12 17:51:25 +01:00
cli_options.go Remove "docker engine" subcommands 2019-12-12 17:51:25 +01:00
cli_options_test.go Unit test for WithContentTrustFromEnv 2019-01-29 11:26:40 +00:00
cli_test.go Remove "docker engine" subcommands 2019-12-12 17:51:25 +01:00
context.go Cleanup context store interfaces 2019-04-18 15:49:36 +02:00
defaultcontextstore.go Push check for kubernetes requirement down into the endpoint 2019-05-20 13:28:11 +01:00
defaultcontextstore_test.go cli/command: fix formatting of comments, and minor linting issues 2020-01-16 12:47:12 +01:00
events_utils.go updated vendoring 2017-09-01 19:41:06 -04:00
orchestrator.go Fast Context Switch: commands 2019-01-10 22:25:43 +01:00
orchestrator_test.go Introduce docker context store 2019-01-04 17:06:51 +01:00
registry.go Simplify ElectAuthServer 2019-03-28 21:08:13 +00:00
registry_test.go Remove docker api dependency from cli/config 2019-01-31 21:25:43 +00:00
streams.go Extract streams helpers from command package to their own package to remove a cyclic dependency from command to internal/containerizedengine 2019-01-28 14:36:00 +01:00
trust.go Refactor content_trust cli/flags handling 2018-03-08 15:00:43 -05:00
utils.go docker cp: prevent NPE when failing to stat destination 2019-12-09 15:32:02 +01:00
utils_test.go cp: allow trailing slash in non-existant destination 2019-11-12 17:25:25 +00:00