Skip to content

Commit

Permalink
add desired/actual, remove ports from convox scale
Browse files Browse the repository at this point in the history
  • Loading branch information
ddollar committed Oct 13, 2015
1 parent afc745e commit 297c049
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions cmd/convox/scale.go
Expand Up @@ -2,8 +2,6 @@ package main

import (
"fmt"
"strconv"
"strings"

"github.com/codegangsta/cli"
"github.com/convox/rack/cmd/convox/stdcli"
Expand Down Expand Up @@ -69,16 +67,23 @@ func displayFormation(c *cli.Context, app string) {
return
}

t := stdcli.NewTable("NAME", "COUNT", "MEMORY", "PORTS")
pss, err := rackClient(c).GetProcesses(app, false)

for _, f := range formation {
ports := []string{}
if err != nil {
stdcli.Error(err)
return
}

for _, p := range f.Ports {
ports = append(ports, strconv.Itoa(p))
}
running := map[string]int{}

t.AddRow(f.Name, fmt.Sprintf("%d", f.Count), fmt.Sprintf("%d", f.Memory), strings.Join(ports, " "))
for _, ps := range pss {
running[ps.Name] = running[ps.Name] + 1
}

t := stdcli.NewTable("NAME", "DESIRED", "RUNNING", "MEMORY")

for _, f := range formation {
t.AddRow(f.Name, fmt.Sprintf("%d", f.Count), fmt.Sprintf("%d", running[f.Name]), fmt.Sprintf("%d", f.Memory))
}

t.Print()
Expand Down

0 comments on commit 297c049

Please sign in to comment.