diff options
author | Valery Piashchynski <[email protected]> | 2020-12-26 00:47:21 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-26 00:47:21 +0300 |
commit | 566d7f4c95eb5dedcb2da5afcda4bbea8eba077f (patch) | |
tree | 0007a6b8c8ac9e7d31b8a5f3f7f27669c860d261 /cmd | |
parent | 1bc3db2ea9b95edd0101676d7bfd75df3782c3bd (diff) | |
parent | 7a0dee1a416705c621edbf50e1f43fb39845348f (diff) |
Merge pull request #463 from spiral/experiment/core_pluginsv2.0.0-beta1
[RR2] Plugins
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/cli/root.go | 4 | ||||
-rw-r--r-- | cmd/cli/workers.go | 22 | ||||
-rw-r--r-- | cmd/main.go | 19 |
3 files changed, 19 insertions, 26 deletions
diff --git a/cmd/cli/root.go b/cmd/cli/root.go index febe410b..eb15f565 100644 --- a/cmd/cli/root.go +++ b/cmd/cli/root.go @@ -8,9 +8,9 @@ import ( "github.com/spiral/errors" goridgeRpc "github.com/spiral/goridge/v3/pkg/rpc" - rpcPlugin "github.com/spiral/roadrunner-plugins/rpc" + rpcPlugin "github.com/spiral/roadrunner/v2/plugins/rpc" - "github.com/spiral/roadrunner-plugins/config" + "github.com/spiral/roadrunner/v2/plugins/config" "github.com/spf13/cobra" "github.com/spiral/endure" 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..4e7fc099 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -4,16 +4,17 @@ import ( "log" "github.com/spiral/endure" - "github.com/spiral/roadrunner-plugins/http" - "github.com/spiral/roadrunner-plugins/informer" - "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/plugins/http" + "github.com/spiral/roadrunner/v2/plugins/informer" + "github.com/spiral/roadrunner/v2/plugins/server" + "github.com/spiral/roadrunner/v2/cmd/cli" + "github.com/spiral/roadrunner/v2/plugins/logger" + "github.com/spiral/roadrunner/v2/plugins/metrics" + "github.com/spiral/roadrunner/v2/plugins/redis" + "github.com/spiral/roadrunner/v2/plugins/reload" + "github.com/spiral/roadrunner/v2/plugins/resetter" + "github.com/spiral/roadrunner/v2/plugins/rpc" ) func main() { |