Ejemplo n.º 1
0
func (cmd *Activity) show(activityId string) {
	activity, err := activities.Activity(cmd.network, activityId)
	if nil != err {
		error_handler.ErrorExit(err)
	}

	table := terminal.NewTable([]string{"Id:", activity.Id})
	table.Add("DisplayName:", activity.DisplayName)
	table.Add("Description:", activity.Description)
	table.Add("EntityId:", activity.EntityId)
	table.Add("EntityDisplayName:", activity.EntityDisplayName)
	table.Add("Submitted:", time.Unix(activity.SubmitTimeUtc/1000, 0).Format(time.UnixDate))
	table.Add("Started:", time.Unix(activity.StartTimeUtc/1000, 0).Format(time.UnixDate))
	table.Add("Ended:", time.Unix(activity.EndTimeUtc/1000, 0).Format(time.UnixDate))
	table.Add("CurrentStatus:", activity.CurrentStatus)
	table.Add("IsError:", strconv.FormatBool(activity.IsError))
	table.Add("IsCancelled:", strconv.FormatBool(activity.IsCancelled))
	table.Add("SubmittedByTask:", activity.SubmittedByTask.Metadata.Id)
	if activity.Streams["stdin"].Metadata.Size > 0 ||
		activity.Streams["stdout"].Metadata.Size > 0 ||
		activity.Streams["stderr"].Metadata.Size > 0 ||
		activity.Streams["env"].Metadata.Size > 0 {
		table.Add("Streams:", fmt.Sprintf("stdin: %d, stdout: %d, stderr: %d, env %d",
			activity.Streams["stdin"].Metadata.Size,
			activity.Streams["stdout"].Metadata.Size,
			activity.Streams["stderr"].Metadata.Size,
			activity.Streams["env"].Metadata.Size))
	} else {
		table.Add("Streams:", "")
	}
	table.Add("DetailedStatus:", fmt.Sprintf("\"%s\"", activity.DetailedStatus))
	table.Print()
}
Ejemplo n.º 2
0
func (cmd *Activity) Run(c *cli.Context) {
	activity := activities.Activity(cmd.network, c.Args()[0])
	table := terminal.NewTable([]string{"Id", "Task", "Submitted", "Status"})
	table.Add(activity.Id, activity.DisplayName, time.Unix(activity.SubmitTimeUtc/1000, 0).Format(time.UnixDate), activity.CurrentStatus)

	table.Print()
}