Repository: dmwm/wmcore
Issue: Upload of MC ACDC docs broken

I've just found a MC workflow with 1 out of 20 jobs failed. The ACDC workflow produced exactly the same lumi + number of events. The problem lies on the jobfailed information uploaded to couchdb acdcserver:
https://cmsweb-testbed.cern.ch/couchdb/acdcserver/_design/ACDC/_view/byCollectionName?key=%22amaltaro_MonteCarlo_PhEDEx_HG1611_Validation_pre6_161105_103000_3637%22&include_docs=true&reduce=false

where one can see the list of lumis correspond to ALL the lumis this workflow is supposed to create.
The same applies to the file nunmber of events (10k, so total number of events), though it's known and expected already..

Needs to be investigated further, on the agent side.

Changed files:
src/python/WMCore/WMBS/Oracle/Masks/Save.py

diff --git a/src/python/WMCore/WMBS/Oracle/Masks/Save.py b/src/python/WMCore/WMBS/Oracle/Masks/Save.py
index e2f64f66d..7792081a8 100644
--- a/src/python/WMCore/WMBS/Oracle/Masks/Save.py
+++ b/src/python/WMCore/WMBS/Oracle/Masks/Save.py
@@ -7,33 +7,30 @@ Oracle implementation of Masks.Save
 
 __all__ = []
 
-
-
 from WMCore.WMBS.MySQL.Masks.Save import Save as SaveMasksMySQL
 
+
 class Save(SaveMasksMySQL):
-    sql = """INSERT INTO wmbs_job_mask (job, firstevent, lastevent, firstrun,
-               lastrun, firstlumi, lastlumi, inclusivemask)
-             SELECT :jobid, :firstevent, :lastevent, :firstrun, :lastrun, :firstlumi,
-               :lastlumi, :inclusivemask FROM dual
-             WHERE NOT EXISTS (SELECT job FROM wmbs_job_mask wjm2 WHERE wjm2.firstevent = :firstevent
-                                AND wjm2.lastevent = :lastevent
-                                AND wjm2.firstlumi = :firstlumi
-                                AND wjm2.lastlumi = :lastlumi
-                                AND wjm2.firstrun = :firstrun
-                                AND wjm2.lastrun = :lastrun
-                                AND wjm2.inclusivemask = :inclusivemask)    """
-
-
-
-    def execute(self, jobid, mask, conn = None, transaction = False):
-        if type(mask) == list:
+    sql = """INSERT INTO wmbs_job_mask (job, firstevent, lastevent, firstrun, lastrun, firstlumi, lastlumi, inclusivemask)
+             SELECT :jobid, :firstevent, :lastevent, :firstrun, :lastrun, :firstlumi, :lastlumi, :inclusivemask FROM dual
+             WHERE NOT EXISTS (SELECT * FROM wmbs_job_mask wjm2 WHERE
+                               job = :jobid
+                               AND wjm2.firstevent = :firstevent
+                               AND wjm2.lastevent = :lastevent
+                               AND wjm2.firstlumi = :firstlumi
+                               AND wjm2.lastlumi = :lastlumi
+                               AND wjm2.firstrun = :firstrun
+                               AND wjm2.lastrun = :lastrun
+                               AND wjm2.inclusivemask = :inclusivemask)"""
+
+    def execute(self, jobid, mask, conn=None, transaction=False):
+        if isinstance(mask, list):
             # Bulk commit
             # Hope you didn't send us a list of empty masks
             binds = []
             for m in mask:
                 inclusiveMask = 'T'
-                if m['inclusivemask'] == False:
+                if m['inclusivemask'] is False:
                     inclusiveMask = 'F'
                 binds.append({"jobid": m['jobID'], 'firstevent': m['FirstEvent'], 'lastevent': m['LastEvent'],
                               'firstrun': m['FirstRun'], 'lastrun': m['LastRun'], 'firstlumi': m['FirstLumi'],
@@ -41,7 +38,7 @@ class Save(SaveMasksMySQL):
         else:
             # Simple one-part mask
             inclusiveMask = 'T'
-            if mask['inclusivemask'] == False:
+            if mask['inclusivemask'] is False:
                 inclusiveMask = 'F'
             binds = {"jobid": jobid, 'firstevent': mask['FirstEvent'], 'lastevent': mask['LastEvent'],
                      'firstrun': mask['FirstRun'], 'lastrun': mask['LastRun'], 'firstlumi': mask['FirstLumi'],
@@ -56,7 +53,6 @@ class Save(SaveMasksMySQL):
                 return
 
         # Actually run the code
-        self.dbi.processData(self.sql, binds, conn = conn,
-                             transaction = transaction)
+        self.dbi.processData(self.sql, binds, conn=conn, transaction=transaction)
 
         return