fix job array display issue
This commit is contained in:
parent
d9b5c361c2
commit
960ef62342
5 changed files with 290 additions and 15 deletions
|
|
@ -83,7 +83,11 @@ func (p *JobsPagePrinter) initColumnWidths(jobs *models.JobsResponse) {
|
|||
width := 0
|
||||
switch format.name {
|
||||
case models.HEADER_JOB_JOBID:
|
||||
width = len(fmt.Sprintf("%d", job.JobID))
|
||||
if job.UniqueJobID != job.JobID {
|
||||
width = len(fmt.Sprintf("%d[%d]", job.JobID, job.ArrayIdx))
|
||||
} else {
|
||||
width = len(fmt.Sprintf("%d", job.JobID))
|
||||
}
|
||||
case models.HEADER_JOB_USER:
|
||||
width = len(job.SubmitUser)
|
||||
case models.HEADER_JOB_STATUS:
|
||||
|
|
@ -174,7 +178,7 @@ func (p *JobsPagePrinter) formatRows(jobs *models.JobsResponse, truncatFlag bool
|
|||
switch format.name {
|
||||
case models.HEADER_JOB_JOBID:
|
||||
var arrayJobIDStr string
|
||||
if job.ArrayIdx != 0 {
|
||||
if job.UniqueJobID != job.JobID {
|
||||
arrayJobIDStr = fmt.Sprintf("%d[%d]", job.JobID, job.ArrayIdx)
|
||||
} else {
|
||||
arrayJobIDStr = fmt.Sprintf("%d", job.JobID)
|
||||
|
|
@ -274,9 +278,8 @@ func printJobsVerboseOutput(jobs *models.JobsResponse, filter []string) {
|
|||
}
|
||||
// generate jobId for two format: 111 or 111[10]
|
||||
jobId := fmt.Sprintf("%d", job.JobID)
|
||||
index := strings.Index(job.JobName, "[")
|
||||
if index != -1 {
|
||||
jobId = fmt.Sprintf("%s%s", jobId, job.JobName[index:])
|
||||
if job.UniqueJobID != job.JobID {
|
||||
jobId = fmt.Sprintf("%d[%d]", job.JobID, job.ArrayIdx)
|
||||
}
|
||||
|
||||
// (1) print the job baisc info when sending "jobs list -l" command
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue