From 68490db7c02fa2edd6eef880a2b58295f53b1570 Mon Sep 17 00:00:00 2001
From: Marcel Loose <loose@astron.nl>
Date: Sun, 25 Nov 2012 13:43:10 +0000
Subject: [PATCH] Task #2699: Fixed a recently introduced bug in vdsmaker. You
 cannot delete items from the vdsnames list by job index, because deleting
 items changes the posiition of the remaining items and the length of the list
 (causing a IndexError).

---
 CEP/Pipeline/recipes/sip/master/vdsmaker.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/CEP/Pipeline/recipes/sip/master/vdsmaker.py b/CEP/Pipeline/recipes/sip/master/vdsmaker.py
index 6d000ba0f91..077cd0d1436 100644
--- a/CEP/Pipeline/recipes/sip/master/vdsmaker.py
+++ b/CEP/Pipeline/recipes/sip/master/vdsmaker.py
@@ -103,9 +103,10 @@ class vdsmaker(BaseRecipe, RemoteCommandRecipeMixIn):
                 )
             )
         self._schedule_jobs(jobs, max_per_node=self.inputs['nproc'])
-        for idx, job in enumerate(jobs):
-            if job.results['returncode'] != 0:
-                del vdsnames[idx]
+        vdsnames = [
+            vds for vds, job in zip(vdsnames, jobs) 
+            if job.results['returncode'] == 0
+        ]
 
         # *********************************************************************
         # 3. Combine VDS files to produce GDS
-- 
GitLab