@@ -21,10 +21,12 @@ Options:
21
21
-f display full output for a job
22
22
-Fjson display full output in JSON format (use with -f)
23
23
-H job output regardless of state or all finished jobs
24
+ -J only show information for jobs (or subjobs with -t)
24
25
-l disable labels (no header)
25
26
-n display a list of nodes at the end of the line
26
27
-s display administrator comment on the next line
27
28
--status filter jobs by specific single-character status code
29
+ -t show information for both jobs and array subjobs
28
30
-u filter jobs by the submitting user
29
31
-w use wide format output (120 columns)
30
32
-x include recently finished jobs in output
@@ -241,6 +243,10 @@ while [[ $# -gt 0 ]]; do
241
243
HMODE=true
242
244
DATAFILE=${DATAFILE/ default/ info}
243
245
;;
246
+ J)
247
+ JMODE=true
248
+ JSOPTS=" -J $JSOPTS "
249
+ ;;
244
250
l)
245
251
NOLABELS=true
246
252
;;
@@ -253,6 +259,10 @@ while [[ $# -gt 0 ]]; do
253
259
DATAFILE=${DATAFILE/ job/ comm}
254
260
DATAFILE=${DATAFILE/ default/ info}
255
261
;;
262
+ t)
263
+ SUBJOBS=true
264
+ JSOPTS=" -t $JSOPTS "
265
+ ;;
256
266
u)
257
267
DATAFILE=${DATAFILE/ default/ info}
258
268
@@ -288,7 +298,11 @@ while [[ $# -gt 0 ]]; do
288
298
find_server
289
299
;;&
290
300
[0-9]* )
291
- JOBID=${1%%@* }
301
+ if [[ $1 == * \[ [0-9]* \] * ]]; then
302
+ JOBID=$( sed ' s/\[/\\\[/; s/\]/\\\]/' <<< ${1%%@* } )
303
+ else
304
+ JOBID=$( sed ' s/\[\]/\\[\[0-9\]\*\\]/' <<< ${1%%@* } )
305
+ fi
292
306
293
307
if [[ -z $CUSTOMSERVER ]] && [[ $JOBID == * .* ]]; then
294
308
CUSTOMSERVER=${JOBID#* .} find_server
@@ -358,7 +372,7 @@ if [[ $FULLMODE == true ]]; then
358
372
DATAFILE=joblist-fulljson.dat
359
373
360
374
if [[ -n $JOBLIST ]]; then
361
- JSOPTS=" -j $JOBLIST "
375
+ JSOPTS=" $JSOPTS -j $JOBLIST "
362
376
else
363
377
if [[ -n $DESTLIST ]]; then
364
378
JSOPTS=" $JSOPTS -q $DESTLIST "
@@ -397,7 +411,7 @@ if [[ $FULLMODE == true ]]; then
397
411
fi
398
412
399
413
if [[ -n $JOBLIST ]]; then
400
- CMD=" awk -vRS='' '/Job Id: ($JOBLIST )./{print \$ 0\" \n\" }' $DATAPATH /$DATAFILE "
414
+ CMD=" awk -vRS='' '/Job Id: ($JOBLIST )\ ./{print \$ 0\" \n\" }' $DATAPATH /$DATAFILE "
401
415
else
402
416
if [[ $SHOWALL == true ]]; then
403
417
CMD=" cat $DATAPATH /$DATAFILE "
@@ -414,6 +428,14 @@ if [[ $FULLMODE == true ]]; then
414
428
CMD=" $CMD | awk -vRS='' '/job_state = $STATCODE /{print \$ 0\" \n\" }'"
415
429
fi
416
430
431
+ if [[ $SUBJOBS == true ]]; then
432
+ if [[ $JMODE == true ]]; then
433
+ CMD=" $CMD | awk -vRS='' '/Job Id:.*\[[0-9]+\]/{print \$ 0\" \n\" }'"
434
+ fi
435
+ else
436
+ CMD=" $CMD | awk -vRS='' '!/Job Id:.*\[[0-9]+\]/{print \$ 0\" \n\" }'"
437
+ fi
438
+
417
439
# Get requested output
418
440
query_cache
419
441
@@ -453,19 +475,32 @@ else
453
475
# Attach various filters to output
454
476
if [[ ! -z " $STATCODE " ]]; then
455
477
CMD=" $CMD | awk '\$ $SCOL && \$ $SCOL $COPER \" $STATCODE \" && \$ 1 ~ /^[0-9]/ { $AWKOPT }'"
478
+ AWKOPT=print
456
479
fi
457
480
458
481
if [[ ! -z " $USERSTR " ]] && [[ ${USERSTR^^} != ALL ]]; then
459
482
CMD=" $CMD | awk '\$ $UCOL == \" $USERSTR \" { $AWKOPT }'"
483
+ AWKOPT=print
460
484
fi
461
485
462
486
if [[ ! -z " $JOBLIST " ]]; then
463
- JOBLIST=${JOBLIST/ \[\] / \\\[\\\] }
464
487
CMD=" $CMD | awk '\$ 1 ~ /^($JOBLIST )\./ { $AWKOPT }'"
488
+ AWKOPT=print
465
489
fi
466
490
467
491
if [[ ! -z " $DESTLIST " ]]; then
468
492
CMD=" $CMD | awk '\$ $DCOL ~ /^($DESTLIST )$/ { $AWKOPT }'"
493
+ AWKOPT=print
494
+ fi
495
+
496
+ if [[ $SUBJOBS == true ]]; then
497
+ if [[ $JMODE == true ]]; then
498
+ CMD=" $CMD | awk '\$ 1 ~ /\[[0-9]+\]/ { $AWKOPT }'"
499
+ AWKOPT=print
500
+ fi
501
+ else
502
+ CMD=" $CMD | awk '\$ 1 !~ /\[[0-9]+\]/ { $AWKOPT }'"
503
+ AWKOPT=print
469
504
fi
470
505
471
506
# Get requested output
0 commit comments