From f138f76692bb4b971373b5816a2232ace955decc Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Thu, 1 Sep 2016 11:28:00 +0000
Subject: [PATCH] Task #9607: fix for MoM bug introduced before NV's holiday

---
 .../ResourceAssigner/lib/assignment.py               | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/SAS/ResourceAssignment/ResourceAssigner/lib/assignment.py b/SAS/ResourceAssignment/ResourceAssigner/lib/assignment.py
index d0c66a8ab86..206e98a41dc 100755
--- a/SAS/ResourceAssignment/ResourceAssigner/lib/assignment.py
+++ b/SAS/ResourceAssignment/ResourceAssigner/lib/assignment.py
@@ -155,6 +155,18 @@ class ResourceAssigner():
                 except Exception as e:
                     logger.error(e)
 
+            try:
+                # fix for MoM bug introduced before NV's holiday
+                # MoM sets ProcessingCluster.clusterName to CEP2 even when inputxml says CEP4
+                # so, override it here if needed, and update to otdb
+                processingClusterName = mainParset.getString('Observation.Cluster.ProcessingCluster.clusterName', '')
+                if processingClusterName != clusterName:
+                    logger.info('overwriting and uploading processingClusterName to otdb from %s to %s for otdb_id=%s',
+                                 processingClusterName, clusterName, otdb_id)
+                    self.otdbrpc.taskSetSpecification(otdb_id, { 'LOFAR.ObsSW.Observation.Cluster.ProcessingCluster.clusterName': clusterName })
+            except Exception as e:
+                logger.error(e)
+
         # insert new task and specification in the radb
         # any existing specification and task with same otdb_id will be deleted automatically
         logger.info('doAssignment: insertSpecification momId=%s, otdb_id=%s, status=%s, taskType=%s, startTime=%s, endTime=%s cluster=%s' %
-- 
GitLab