[ARVADOS] created: 5931243d745188851c8240e3e766d97aafdf935c
Git user
git at public.curoverse.com
Tue May 30 14:34:46 EDT 2017
at 5931243d745188851c8240e3e766d97aafdf935c (commit)
commit 5931243d745188851c8240e3e766d97aafdf935c
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Tue May 30 14:34:39 2017 -0400
11767: Make squeue format output pipe (|) delimited so that it doesn't get
confused by spaces in the "Reasons" column
diff --git a/services/nodemanager/arvnodeman/jobqueue.py b/services/nodemanager/arvnodeman/jobqueue.py
index a35bd92..0340918 100644
--- a/services/nodemanager/arvnodeman/jobqueue.py
+++ b/services/nodemanager/arvnodeman/jobqueue.py
@@ -133,11 +133,11 @@ class JobQueueMonitorActor(clientactor.RemotePollLoopActor):
def _send_request(self):
# cpus, memory, tempory disk space, reason, job name
- squeue_out = subprocess.check_output(["squeue", "--state=PENDING", "--noheader", "--format=%c %m %d %r %j"])
+ squeue_out = subprocess.check_output(["squeue", "--state=PENDING", "--noheader", "--format=%c|%m|%d|%r|%j"])
queuelist = []
for out in squeue_out.splitlines():
- cpu, ram, disk, reason, jobname = out.split(" ", 4)
- if reason in ("Resources", "ReqNodeNotAvail"):
+ cpu, ram, disk, reason, jobname = out.split("|", 4)
+ if ("ReqNodeNotAvail" in reason) or ("Resources" in reason):
queuelist.append({
"uuid": jobname,
"runtime_constraints": {
diff --git a/services/nodemanager/tests/test_jobqueue.py b/services/nodemanager/tests/test_jobqueue.py
index fced67c..554ff1e 100644
--- a/services/nodemanager/tests/test_jobqueue.py
+++ b/services/nodemanager/tests/test_jobqueue.py
@@ -150,8 +150,8 @@ class JobQueueMonitorActorTestCase(testutil.RemotePollLoopActorTestMixin,
@mock.patch("subprocess.check_output")
def test_squeue_server_list(self, mock_squeue):
- mock_squeue.return_value = """1 1024 0 Resources zzzzz-zzzzz-zzzzzzzzzzzzzzy
-2 1024 0 Resources zzzzz-zzzzz-zzzzzzzzzzzzzzz
+ mock_squeue.return_value = """1|1024|0|Resources|zzzzz-zzzzz-zzzzzzzzzzzzzzy
+2|1024|0|Resources|zzzzz-zzzzz-zzzzzzzzzzzzzzz
"""
super(JobQueueMonitorActorTestCase, self).build_monitor(jobqueue.ServerCalculator(
@@ -163,8 +163,8 @@ class JobQueueMonitorActorTestCase(testutil.RemotePollLoopActorTestMixin,
@mock.patch("subprocess.check_output")
def test_squeue_server_list_suffix(self, mock_squeue):
- mock_squeue.return_value = """1 1024M 0 Resources zzzzz-zzzzz-zzzzzzzzzzzzzzy
-1 2G 0 Resources zzzzz-zzzzz-zzzzzzzzzzzzzzz
+ mock_squeue.return_value = """1|1024M|0|ReqNodeNotAvail, UnavailableNod|zzzzz-zzzzz-zzzzzzzzzzzzzzy
+1|2G|0|ReqNodeNotAvail, UnavailableNod|zzzzz-zzzzz-zzzzzzzzzzzzzzz
"""
super(JobQueueMonitorActorTestCase, self).build_monitor(jobqueue.ServerCalculator(
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list