Skip to content

Commit 78e1021

Browse files
authored
Merge pull request #31 from NCAR/hua-work-common
handle mutilple lines of qstat -n
2 parents 3125867 + 63e16f7 commit 78e1021

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "rda_python_common"
7-
version = "1.0.25"
7+
version = "1.0.26"
88
authors = [
99
{ name="Zaihua Ji", email="zji@ucar.edu" },
1010
]

src/rda_python_common/PgSIG.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -816,16 +816,22 @@ def get_pbs_info(qopts, multiple = 0, logact = 0, chkcnt = 1):
816816
if re.match(r'^-----', line): chkd = 0
817817
else:
818818
vals = re.split(r'\s+', PgLOG.pgtrim(line))
819-
if len(vals) == kcnt:
819+
vcnt = len(vals)
820+
if vcnt == 1:
821+
if multiple:
822+
stat[ckeys[kcnt-1]].append(vals[0])
823+
else:
824+
stat[ckeys[kcnt-1]] = vals[0]
825+
break
826+
elif vcnt > 1:
820827
ms = re.match(r'^(\d+)', vals[0])
821828
if ms: vals[0] = ms.group(1)
822-
if multiple:
823-
for i in range(kcnt):
829+
for i in range(vcnt):
830+
if multiple:
824831
stat[ckeys[i]].append(vals[i])
825-
else:
826-
for i in range(kcnt):
832+
else:
827833
stat[ckeys[i]] = vals[i]
828-
break
834+
if vcnt == kcnt: break
829835

830836
return stat
831837

0 commit comments

Comments
 (0)