Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

Commit

Permalink
Replace state of env by description
Browse files Browse the repository at this point in the history
Signed-off-by: Valentin Pichard <[email protected]>
  • Loading branch information
Valentin Pichard committed Jan 4, 2019
1 parent 3d2b1b5 commit e616896
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion helper/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package helper

type Application struct {
Path string `mapstructure:"path"`
State string `mapstructure:"state"`
Description string `mapstructure:"description"`
PumactlPath string `mapstructure:"pumactlpath"`
PumastatePath string `mapstructure:"pumastatepath"`
}
Expand Down
10 changes: 6 additions & 4 deletions helper/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func printApplicationsContext(pst pumaStatus) error {
fmt.Printf("* PID: %d\tBooted: %t\t\tRunner index: %d\n", key.Pid, key.Booted, key.Index)
fmt.Printf("\t- Last status %s -\n", timeElapsed(key.LastCheckin))
fmt.Printf(" Running: %d\tPool capacity: %d\tMax threads: %d\n", key.LastStatus.Running, key.LastStatus.PoolCapacity, key.LastStatus.MaxThreads)
fmt.Printf(" CPU: %s%%\tMemory: %s MiB\tTotal time exec: %s\n", cpu, mem, timeElapsed(time.Now().Add(time.Duration(-int64(ttime))*time.Second).Format(time.RFC3339)))
fmt.Printf(" CPU: %s%%\tMemory: %s MiB\tTotal exec time: %s\n", cpu, mem, timeElapsed(time.Now().Add(time.Duration(-int64(ttime))*time.Second).Format(time.RFC3339)))
}

return nil
Expand Down Expand Up @@ -106,7 +106,6 @@ func readPumaStats(key Application) (pumaStatus, error) {

func printApplicationGroups() error {
fmt.Println("----------- Application groups -----------")
fmt.Println()

line := 0
for appname, key := range CfgFile.Applications {
Expand All @@ -115,15 +114,18 @@ func printApplicationGroups() error {
return err
}

fmt.Printf("-> %s application (%s)\n", appname, key.State)
fmt.Printf("-> %s application\n", appname)
if key.Description != "" {
fmt.Printf(" About: %s\n", key.Description)
}
fmt.Printf(" App root: %s\n", key.Path)
fmt.Printf(" Booted workers: %d\n\n", ps.BootedWorkers)

if err := printApplicationsContext(ps); err != nil {
return err
}

for line < len(CfgFile.Applications) {
if line < len(CfgFile.Applications)-1 {
fmt.Println()
line++
}
Expand Down
4 changes: 2 additions & 2 deletions puma-helper.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
applications:
"mobile-chat":
path : "/home/mobile-chat"
state : "production"
description : "Related to mobile-chat production system"
#pumactlpath : "/home/mobile-chat/current/bin/pumactl"
#pumastatepath : "/home/mobile-chat/current/tmp/pids/puma_state"
"ideas":
path : "/home/ideas"
state : "production"
description : "Related to ideas staging env"
#pumactlpath : "/home/ideas/current/bin/pumactl"
#pumastatepath : "/home/ideas/current/tmp/pids/puma_state"

0 comments on commit e616896

Please sign in to comment.