diff options
author | Valery Piashchynski <[email protected]> | 2020-12-25 00:55:15 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-12-25 00:55:15 +0300 |
commit | f52156e76cf02e0b3de993fa6d9ba0d2f4e52001 (patch) | |
tree | 025c6c60930844bd10ac776e90266d679e3c1606 /cmd | |
parent | 1bc3db2ea9b95edd0101676d7bfd75df3782c3bd (diff) |
Initial commit of experiment
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/cli/workers.go | 22 | ||||
-rw-r--r-- | cmd/main.go | 7 |
2 files changed, 11 insertions, 18 deletions
diff --git a/cmd/cli/workers.go b/cmd/cli/workers.go index d34de40a..03639aa4 100644 --- a/cmd/cli/workers.go +++ b/cmd/cli/workers.go @@ -13,7 +13,7 @@ import ( "github.com/fatih/color" "github.com/spf13/cobra" "github.com/spiral/errors" - "github.com/spiral/roadrunner-plugins/informer" + "github.com/spiral/roadrunner/v2/plugins/informer" "github.com/spiral/roadrunner/v2/tools" ) @@ -22,6 +22,7 @@ var ( ) const InformerList string = "informer.List" +const InformerWorkers string = "informer.Workers" func init() { workersCommand := &cobra.Command{ @@ -42,7 +43,7 @@ func init() { } func workersHandler(cmd *cobra.Command, args []string) error { - const op = errors.Op("workers handler") + const op = errors.Op("workers cobra handler") // get RPC client client, err := RPCClient() if err != nil { @@ -94,25 +95,16 @@ func workersHandler(cmd *cobra.Command, args []string) error { } func showWorkers(plugins []string, client *rpc.Client) error { + const op = errors.Op("show workers") for _, plugin := range plugins { list := &informer.WorkerList{} - err := client.Call("informer.Workers", plugin, &list) + err := client.Call(InformerWorkers, plugin, &list) if err != nil { - return err - } - - // it's a golang :) - ps := make([]tools.ProcessState, len(list.Workers)) - for i := 0; i < len(list.Workers); i++ { - ps[i].Created = list.Workers[i].Created - ps[i].NumJobs = list.Workers[i].NumJobs - ps[i].MemoryUsage = list.Workers[i].MemoryUsage - ps[i].Pid = list.Workers[i].Pid - ps[i].Status = list.Workers[i].Status + return errors.E(op, err) } fmt.Printf("Workers of [%s]:\n", color.HiYellowString(plugin)) - tools.WorkerTable(os.Stdout, ps).Render() + tools.WorkerTable(os.Stdout, list.Workers).Render() } return nil } diff --git a/cmd/main.go b/cmd/main.go index 8151d4fe..5893fbcb 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -4,15 +4,16 @@ import ( "log" "github.com/spiral/endure" - "github.com/spiral/roadrunner-plugins/http" - "github.com/spiral/roadrunner-plugins/informer" + "github.com/spiral/roadrunner/v2/plugins/http" + "github.com/spiral/roadrunner/v2/plugins/informer" + "github.com/spiral/roadrunner/v2/plugins/server" + "github.com/spiral/roadrunner-plugins/logger" "github.com/spiral/roadrunner-plugins/metrics" "github.com/spiral/roadrunner-plugins/redis" "github.com/spiral/roadrunner-plugins/reload" "github.com/spiral/roadrunner-plugins/resetter" "github.com/spiral/roadrunner-plugins/rpc" - "github.com/spiral/roadrunner-plugins/server" "github.com/spiral/roadrunner/v2/cmd/cli" ) |