summaryrefslogtreecommitdiff
path: root/cmd/podman/shared/parallel.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-10-29 12:06:48 -0500
committerbaude <bbaude@redhat.com>2018-11-01 13:14:12 -0500
commit2011782d9d52958546e481f84892d00a548b9e12 (patch)
tree208158661ad4089007f9124d0eeecefcba1b7d42 /cmd/podman/shared/parallel.go
parent9c1985fc4ee0a30a5a852dfbeae742e64978ed25 (diff)
downloadpodman-2011782d9d52958546e481f84892d00a548b9e12.tar.gz
podman-2011782d9d52958546e481f84892d00a548b9e12.tar.bz2
podman-2011782d9d52958546e481f84892d00a548b9e12.zip
Make restart parallel and add --all
When attempting to restart many containers, we can benefit from making the restarts parallel. For convenience, two new options are added: --all attempts to restart all containers --run-only when used with --all will attempt to restart only running containers Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/shared/parallel.go')
-rw-r--r--cmd/podman/shared/parallel.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/cmd/podman/shared/parallel.go b/cmd/podman/shared/parallel.go
index 03eba2f0b..dbf43a982 100644
--- a/cmd/podman/shared/parallel.go
+++ b/cmd/podman/shared/parallel.go
@@ -72,20 +72,22 @@ func ParallelExecuteWorkerPool(workers int, functions []ParallelWorkerInput) map
func Parallelize(job string) int {
numCpus := runtime.NumCPU()
switch job {
- case "stop":
- if numCpus <= 2 {
- return 4
- } else {
- return numCpus * 3
- }
+ case "ps":
+ return 8
+ case "restart":
+ return numCpus * 2
case "rm":
if numCpus <= 3 {
return numCpus * 3
} else {
return numCpus * 4
}
- case "ps":
- return 8
+ case "stop":
+ if numCpus <= 2 {
+ return 4
+ } else {
+ return numCpus * 3
+ }
}
return 3
}