From 4866ec808633cc94c35c958c9cb96ef8f3bfaa6f Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Fri, 20 Mar 2020 17:18:00 +0000
Subject: [PATCH] BF: fix wait for single jobid string, make info ignore
 non-conformant lines

---
 fsl/utils/fslsub.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fsl/utils/fslsub.py b/fsl/utils/fslsub.py
index 9e7eb039d..4f8479c71 100644
--- a/fsl/utils/fslsub.py
+++ b/fsl/utils/fslsub.py
@@ -160,8 +160,9 @@ def info(job_id):
         return {}
     res = {}
     for line in result.splitlines()[1:]:
-        key, value = line.split(':', 1)
-        res[key.strip()] = value.strip()
+        kv = line.split(':', 1)
+        if len(kv) == 2:
+            res[kv[0].strip()] = kv[1].strip()
     return res
 
 
@@ -208,7 +209,7 @@ def wait(job_ids):
                   before continuing
     """
     start_time = time.time()
-    for job_id in _flatten_job_ids(job_ids):
+    for job_id in _flatten_job_ids(job_ids).split(','):
         log.debug('Waiting for job {}'.format(job_id))
         while len(info(job_id)) > 0:
             wait_time = min(max(1, (time.time() - start_time) / 3.), 20)
-- 
GitLab