Ejemplo n.º 1
0
			node, err := getNode(common.Context(cmd), c, args[0])
			if err != nil {
				return err
			}

			r, err := c.ListTasks(common.Context(cmd),
				&api.ListTasksRequest{
					Filters: &api.ListTasksRequest_Filters{
						NodeIDs: []string{node.ID},
					},
				})
			if err != nil {
				return err
			}

			printNodeSummary(node)
			if len(r.Tasks) > 0 {
				fmt.Printf("\n")
				task.Print(r.Tasks, all, common.NewResolver(cmd, c))
			}

			return nil
		},
	}
)

func init() {
	inspectCmd.Flags().BoolP("all", "a", false, "Show all tasks (default shows just running)")
}
Ejemplo n.º 2
0
			r, err := c.ListTasks(common.Context(cmd),
				&api.ListTasksRequest{
					Filters: &api.ListTasksRequest_Filters{
						ServiceIDs: []string{service.ID},
					},
				})
			if err != nil {
				return err
			}
			var running int
			for _, t := range r.Tasks {
				if t.Status.State == api.TaskStateRunning {
					running++
				}
			}

			printServiceSummary(service, running)
			if len(r.Tasks) > 0 {
				fmt.Printf("\n")
				task.Print(r.Tasks, all, res)
			}

			return nil
		},
	}
)

func init() {
	inspectCmd.Flags().BoolP("all", "a", false, "Show all tasks (default shows just running)")
}