Skip to content

Commit

Permalink
Add JobType in cli command
Browse files Browse the repository at this point in the history
  • Loading branch information
thandayuthapani committed May 13, 2019
1 parent feabf5a commit 65084fb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/cli/job/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ const (
Succeeded string = "Succeeded"
Failed string = "Failed"
RetryCount string = "RetryCount"
JobType string = "JobType"
JobTypeKey string = "volcano.sh/job-type"
)

var listJobFlags = &listFlags{}
Expand Down Expand Up @@ -78,8 +80,8 @@ func ListJobs() error {

func PrintJobs(jobs *v1alpha1.JobList, writer io.Writer) {
maxNameLen := getMaxNameLen(jobs)
_, err := fmt.Fprintf(writer, fmt.Sprintf("%%-%ds%%-25s%%-12s%%-12s%%-6s%%-10s%%-10s%%-12s%%-10s%%-12s\n", maxNameLen),
Name, Creation, Phase, Replicas, Min, Pending, Running, Succeeded, Failed, RetryCount)
_, err := fmt.Fprintf(writer, fmt.Sprintf("%%-%ds%%-25s%%-12s%%-12s%%-12s%%-6s%%-10s%%-10s%%-12s%%-10s%%-12s\n", maxNameLen),
Name, Creation, Phase, JobType, Replicas, Min, Pending, Running, Succeeded, Failed, RetryCount)
if err != nil {
fmt.Printf("Failed to print list command result: %s.\n", err)
}
Expand All @@ -89,8 +91,8 @@ func PrintJobs(jobs *v1alpha1.JobList, writer io.Writer) {
for _, ts := range job.Spec.Tasks {
replicas += ts.Replicas
}
_, err = fmt.Fprintf(writer, fmt.Sprintf("%%-%ds%%-25s%%-12s%%-12d%%-6d%%-10d%%-10d%%-12d%%-10d%%-12d\n", maxNameLen),
job.Name, job.CreationTimestamp.Format("2006-01-02 15:04:05"), job.Status.State.Phase, replicas,
_, err = fmt.Fprintf(writer, fmt.Sprintf("%%-%ds%%-25s%%-12s%%-12s%%-12d%%-6d%%-10d%%-10d%%-12d%%-10d%%-12d\n", maxNameLen),
job.Name, job.CreationTimestamp.Format("2006-01-02 15:04:05"), job.Status.State.Phase, job.ObjectMeta.Labels[JobTypeKey], replicas,
job.Status.MinAvailable, job.Status.Pending, job.Status.Running, job.Status.Succeeded, job.Status.Failed, job.Status.RetryCount)
if err != nil {
fmt.Printf("Failed to print list command result: %s.\n", err)
Expand Down

0 comments on commit 65084fb

Please sign in to comment.