A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/github/vulcanizer/commit/2111da6a37b4df65bfdad84eb1e7cc1beeb1112c below:

Add recovery cmd to cli · github/vulcanizer@2111da6 · GitHub

1 +

package cli

2 + 3 +

import (

4 +

"fmt"

5 +

"os"

6 + 7 +

"github.com/spf13/cobra"

8 +

)

9 + 10 +

var nodesToCheckRecovery []string

11 + 12 +

func init() {

13 +

cmdShardRecovery.Flags().StringArrayVarP(&nodesToCheckRecovery, "nodes", "n", []string{}, "Elasticsearch nodes to view shard recovery progress (optional, omitted will include all nodes)")

14 +

rootCmd.AddCommand(cmdShardRecovery)

15 +

}

16 + 17 +

var cmdShardRecovery = &cobra.Command{

18 +

Use: "recovery",

19 +

Short: "Display the recovery progress of shards.",

20 +

Long: `Show the details regarding shard recovery operations across a set of cluster nodes.`,

21 +

Run: func(cmd *cobra.Command, args []string) {

22 +

v := getClient()

23 + 24 +

recovery, err := v.GetShardRecovery(nodesToCheckRecovery, true)

25 + 26 +

if err != nil {

27 +

fmt.Printf("Error getting shard recovery details: %s\n", err)

28 +

os.Exit(1)

29 +

}

30 +

header := []string{"Index", "Shard", "Time", "Source", "Target", "Bytes %", "Est Remaining"}

31 +

var rows [][]string

32 + 33 +

for _, shard := range recovery {

34 +

remaining, _ := shard.TimeRemaining()

35 +

row := []string{

36 +

shard.Index,

37 +

shard.Shard,

38 +

shard.Time,

39 +

shard.SourceNode,

40 +

shard.TargetNode,

41 +

shard.BytesPercent,

42 +

remaining.String(),

43 +

}

44 +

rows = append(rows, row)

45 +

}

46 + 47 +

table := renderTable(rows, header)

48 + 49 +

fmt.Println(table)

50 +

},

51 +

}


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4