Repository: dmwm/wmcore
Issue: make acquistion era, process string, processing version mandatory in reqmgr.

Currently this is not mandatory and created None string when it is not set. 
Disable default values and make this mandatory field for some one who assigned workflows


Changed files:
test/python/WMCore_t/WMSpec_t/StdSpecs_t/TaskChain_t.py, src/python/WMCore/Lexicon.py, src/python/WMCore/WMSpec/StdSpecs/TaskChain.py, src/python/WMCore/WMSpec/StdSpecs/PromptReco.py, test/python/WMCore_t/WMSpec_t/StdSpecs_t/MonteCarloFromGEN_t.py, src/python/WMCore/WMSpec/StdSpecs/StdBase.py

diff --git a/src/python/WMCore/Lexicon.py b/src/python/WMCore/Lexicon.py
index c213400a8..8e4f281ce 100644
--- a/src/python/WMCore/Lexicon.py
+++ b/src/python/WMCore/Lexicon.py
@@ -229,15 +229,28 @@ def procversion(candidate):
     """ Integers """
     if isinstance(candidate, dict):
         for candi in candidate.values():
-            check(r'^[0-9]+$', candi)
+            check(r'^[0-9]+$', str(candi))
         return True
     else:
-        return check(r'^[0-9]+$', candidate)
+        return check(r'^[0-9]+$', str(candidate))
 
 
 def procstring(candidate):
     """ Identifier """
-    # T0 uses empty string (or None?) for ProcessingString
+    if not candidate:
+        raise AssertionError("ProcStr cannot be empty or None.")
+    if isinstance(candidate, dict):
+        for candi in candidate.values():
+            check(r'[a-zA-Z0-9_]{1,100}$', candi)
+        return True
+    else:
+        return check(r'[a-zA-Z0-9_]{1,100}$', candidate)
+
+
+def procstringT0(candidate):
+    """
+    ProcessingString validation function for T0 specs
+    """
     if isinstance(candidate, dict):
         for candi in candidate.values():
             check(r'[a-zA-Z0-9_]{1,100}$', candi)
diff --git a/src/python/WMCore/WMSpec/StdSpecs/PromptReco.py b/src/python/WMCore/WMSpec/StdSpecs/PromptReco.py
index 694b0a1c0..c4f82bef3 100644
--- a/src/python/WMCore/WMSpec/StdSpecs/PromptReco.py
+++ b/src/python/WMCore/WMSpec/StdSpecs/PromptReco.py
@@ -5,7 +5,7 @@ _PromptReco_
 Standard PromptReco workflow.
 """
 
-from WMCore.Lexicon import dataset, couchurl, identifier, block
+from WMCore.Lexicon import dataset, couchurl, identifier, block, procstringT0
 from WMCore.WMSpec.StdSpecs.StdBase import StdBase
 from WMCore.WMSpec.WMWorkloadTools import makeList, strToBool
 
@@ -167,6 +167,7 @@ class PromptRecoWorkloadFactory(StdBase):
                     "GlobalTag" : {"default" : None, "type" : str,
                                    "optional" : False, "validate" : None,
                                    "attr" : "globalTag", "null" : False},
+                    "ProcessingString": {"default": "", "validate": procstringT0, "assign_optional": False},
                     "WriteTiers" : {"default" : ["RECO", "AOD", "DQM", "ALCARECO"],
                                     "type" : makeList, "optional" : False,
                                     "validate" : None,
diff --git a/src/python/WMCore/WMSpec/StdSpecs/StdBase.py b/src/python/WMCore/WMSpec/StdSpecs/StdBase.py
index 3d51585e4..d2e2ecd1f 100644
--- a/src/python/WMCore/WMSpec/StdSpecs/StdBase.py
+++ b/src/python/WMCore/WMSpec/StdSpecs/StdBase.py
@@ -8,8 +8,8 @@ import logging
 
 from WMCore.Cache.WMConfigCache import ConfigCache, ConfigCacheException
 from WMCore.Configuration import ConfigSection
-from WMCore.Lexicon import lfnBase, identifier, acqname, cmsswversion
-from WMCore.Lexicon import cmsname, couchurl, block, procstring, activity
+from WMCore.Lexicon import lfnBase, identifier, acqname, cmsswversion, cmsname
+from WMCore.Lexicon import couchurl, block, procstring, activity, procversion
 from WMCore.Services.Dashboard.DashboardReporter import DashboardReporter
 from WMCore.WMSpec.WMSpecErrors import WMSpecFactoryException
 from WMCore.WMSpec.WMWorkload import newWorkload
@@ -921,15 +921,15 @@ class StdBase(object):
                                          "attr": "priority"},
                      "VoGroup": {"default": "unknown", "attr": "owner_vogroup"},
                      "VoRole": {"default": "unknown", "attr": "owner_vorole"},
-                     "Campaign": {"default": ""},
-                     "AcquisitionEra": {"default": "FAKE", "validate": acqname, "assign_optional": False},
+                     "Campaign": {"optional": False},
+                     "AcquisitionEra": {"validate": acqname, "optional": False},
                      "CMSSWVersion": {"validate": cmsswversion,
                                       "optional": False, "attr": "frameworkVersion"},
                      "ScramArch": {"default": "slc5_amd64_gcc462", "optional": False},
-                     "GlobalTag": {"null": True},
+                     "GlobalTag": {"optional": False, "null": False},
                      "GlobalTagConnect": {"null": True},
-                     "ProcessingVersion": {"default": 1, "type": int, "assign_optional": False},
-                     "ProcessingString": {"default": "", "validate": procstring, "assign_optional": False},
+                     "ProcessingVersion": {"default": 1, "type": int, "validate": procversion},
+                     "ProcessingString": {"validate": procstring, "optional": False},
                      "LumiList": {"default": {}, "type": makeLumiList},
                      "SiteBlacklist": {"default": [], "type": makeList,
                                        "validate": lambda x: all([cmsname(y) for y in x])},
@@ -1091,7 +1091,7 @@ class StdBase(object):
                     elif arg == "ScramArch":
                         schema[arg] = "sl6_amd64_gcc491"
                     else:
-                        schema[arg] = "fake"
+                        schema[arg] = "FAKE"
                 elif workloadDefinition[arg]["type"] == int or workloadDefinition[arg]["type"] == float:
                     schema[arg] = 1
                 else:  # A non-optional list or similar. Just copy.
diff --git a/src/python/WMCore/WMSpec/StdSpecs/TaskChain.py b/src/python/WMCore/WMSpec/StdSpecs/TaskChain.py
index 71a092aa6..de2a0cb00 100644
--- a/src/python/WMCore/WMSpec/StdSpecs/TaskChain.py
+++ b/src/python/WMCore/WMSpec/StdSpecs/TaskChain.py
@@ -525,9 +525,6 @@ class TaskChainWorkloadFactory(StdBase):
         baseArgs.update(reqMgrArgs)
         specArgs = {"RequestType": {"default": "TaskChain", "optional": False,
                                     "attr": "requestType"},
-                    "GlobalTag": {"default": "GT_TC_V1", "type": str,
-                                  "optional": False, "validate": None,
-                                  "attr": "globalTag", "null": False},
                     # ConfigCacheID is not mandatory in the main dict for TaskChain
                     "ConfigCacheID": {"optional": True, "null": True},
                     "CouchURL": {"default": "http://localhost:5984", "type": str,
diff --git a/test/python/WMCore_t/WMSpec_t/StdSpecs_t/MonteCarloFromGEN_t.py b/test/python/WMCore_t/WMSpec_t/StdSpecs_t/MonteCarloFromGEN_t.py
index 330a575b5..4997b38b3 100644
--- a/test/python/WMCore_t/WMSpec_t/StdSpecs_t/MonteCarloFromGEN_t.py
+++ b/test/python/WMCore_t/WMSpec_t/StdSpecs_t/MonteCarloFromGEN_t.py
@@ -85,8 +85,8 @@ class MonteCarloFromGENTest(unittest.TestCase):
 
         outputDatasets = testWorkload.listOutputDatasets()
         self.assertEqual(len(outputDatasets), 2)
-        self.assertTrue("/WaitThisIsNotMinimumBias/FAKE-FilterRECO-v1/RECO" in outputDatasets)
-        self.assertTrue("/WaitThisIsNotMinimumBias/FAKE-FilterALCARECO-v1/ALCARECO" in outputDatasets)
+        self.assertTrue("/WaitThisIsNotMinimumBias/FAKE-FilterRECO-FAKE-v1/RECO" in outputDatasets)
+        self.assertTrue("/WaitThisIsNotMinimumBias/FAKE-FilterALCARECO-FAKE-v1/ALCARECO" in outputDatasets)
 
         productionTask = testWorkload.getTaskByPath('/TestWorkload/MonteCarloFromGEN')
         splitting = productionTask.jobSplittingParameters()
diff --git a/test/python/WMCore_t/WMSpec_t/StdSpecs_t/TaskChain_t.py b/test/python/WMCore_t/WMSpec_t/StdSpecs_t/TaskChain_t.py
index c6d3c47d3..29c1b0e63 100644
--- a/test/python/WMCore_t/WMSpec_t/StdSpecs_t/TaskChain_t.py
+++ b/test/python/WMCore_t/WMSpec_t/StdSpecs_t/TaskChain_t.py
@@ -12,7 +12,6 @@ import os
 import unittest
 
 from WMCore.WMSpec.StdSpecs.TaskChain import TaskChainWorkloadFactory
-from WMCore.DataStructs.LumiList import LumiList
 from WMQuality.TestInitCouchApp import TestInitCouchApp
 from WMCore.Database.CMSCouch import CouchServer, Document
 from WMCore.WorkQueue.WMBSHelper import WMBSHelper
@@ -300,22 +299,16 @@ class TaskChainTests(unittest.TestCase):
         # Verify the output datasets
         outputDatasets = self.workload.listOutputDatasets()
         self.assertEqual(len(outputDatasets), 11, "Number of output datasets doesn't match")
-        self.assertTrue("/RelValTTBar/ReleaseValidation-GenSimFilter-v1/GEN-SIM" in outputDatasets,
-                        "/RelValTTBar/ReleaseValidation-GenSimFilter-v1/GEN-SIM not in output datasets")
-        self.assertFalse("/RelValTTBar/ReleaseValidation-reco-v1/RECO" in outputDatasets,
-                        "/RelValTTBar/ReleaseValidation-reco-v1/RECO in output datasets")
-        self.assertTrue("/RelValTTBar/ReleaseValidation-AOD-v1/AOD" in outputDatasets,
-                        "/RelValTTBar/ReleaseValidation-AOD-v1/AOD not in output datasets")
-        self.assertTrue("/RelValTTBar/ReleaseValidation-alca-v1/ALCARECO" in outputDatasets,
-                        "/RelValTTBar/ReleaseValidation-alca-v1/ALCARECO not in output datasets")
+        self.assertTrue("/RelValTTBar/ReleaseValidation-GenSimFilter-FAKE-v1/GEN-SIM" in outputDatasets)
+        self.assertFalse("/RelValTTBar/ReleaseValidation-reco-FAKE-v1/RECO" in outputDatasets)
+        self.assertTrue("/RelValTTBar/ReleaseValidation-AOD-FAKE-v1/AOD" in outputDatasets)
+        self.assertTrue("/RelValTTBar/ReleaseValidation-alca-FAKE-v1/ALCARECO" in outputDatasets)
         for i in range(1, 5):
-            self.assertTrue("/RelValTTBar/ReleaseValidation-alca%d-v1/ALCARECO" % i in outputDatasets,
-                            "/RelValTTBar/ReleaseValidation-alca%d-v1/ALCARECO not in output datasets" % i)
+            self.assertTrue("/RelValTTBar/ReleaseValidation-alca%d-FAKE-v1/ALCARECO" % i in outputDatasets)
         for i in range(1, 6):
             if i == 2:
                 continue
-            self.assertTrue("/RelValTTBar/ReleaseValidation-skim%d-v1/RECO-AOD" % i in outputDatasets,
-                            "/RelValTTBar/ReleaseValidation-skim%d-v1/RECO-AOD not in output datasets" % i)
+            self.assertTrue("/RelValTTBar/ReleaseValidation-skim%d-FAKE-v1/RECO-AOD" % i in outputDatasets)
 
         return
 
@@ -529,7 +522,6 @@ class TaskChainTests(unittest.TestCase):
                         arguments['Task4'], arguments)
 
         digi = self.workload.getTaskByPath("/YankingTheChain/DigiHLT")
-        lumiMask = LumiList(compactList=lumiDict)
         self.assertEqual(lumiDict, digi.getLumiMask().getCompactList())
         digiStep = digi.getStepHelper("cmsRun1")
         self.assertEqual(digiStep.getGlobalTag(), arguments['GlobalTag'])
@@ -558,22 +550,15 @@ class TaskChainTests(unittest.TestCase):
         # Verify the output datasets
         outputDatasets = self.workload.listOutputDatasets()
         self.assertEqual(len(outputDatasets), 14, "Number of output datasets doesn't match")
-        self.assertTrue("/MinimumBias/ReleaseValidation-RawDigiFilter-v1/RAW-DIGI" in outputDatasets,
-                        "/MinimumBias/ReleaseValidation-RawDigiFilter-v1/RAW-DIGI not in output datasets")
-        self.assertTrue("/MinimumBias/ReleaseValidation-RawDebugDigiFilter-v1/RAW-DEBUG-DIGI" in outputDatasets,
-                        "/MinimumBias/ReleaseValidation-RawDebugDigiFilter-v1/RAW-DEBUG-DIGI not in output datasets")
-        self.assertTrue("/ZeroBias/ReleaseValidation-reco-v1/RECO" in outputDatasets,
-                        "/ZeroBias/ReleaseValidation-reco-v1/RECO not in output datasets")
-        self.assertTrue("/ZeroBias/ReleaseValidation-AOD-v1/AOD" in outputDatasets,
-                        "/ZeroBias/ReleaseValidation-AOD-v1/AOD not in output datasets")
-        self.assertTrue("/ZeroBias/ReleaseValidation-alca-v1/ALCARECO" in outputDatasets,
-                        "/ZeroBias/ReleaseValidation-alca-v1/ALCARECO not in output datasets")
+        self.assertTrue("/MinimumBias/ReleaseValidation-RawDigiFilter-FAKE-v1/RAW-DIGI" in outputDatasets)
+        self.assertTrue("/MinimumBias/ReleaseValidation-RawDebugDigiFilter-FAKE-v1/RAW-DEBUG-DIGI" in outputDatasets)
+        self.assertTrue("/ZeroBias/ReleaseValidation-reco-FAKE-v1/RECO" in outputDatasets)
+        self.assertTrue("/ZeroBias/ReleaseValidation-AOD-FAKE-v1/AOD" in outputDatasets)
+        self.assertTrue("/ZeroBias/ReleaseValidation-alca-FAKE-v1/ALCARECO" in outputDatasets)
         for i in range(1, 5):
-            self.assertTrue("/MinimumBias/ReleaseValidation-alca%d-v1/ALCARECO" % i in outputDatasets,
-                            "/MinimumBias/ReleaseValidation-alca%d-v1/ALCARECO not in output datasets" % i)
+            self.assertTrue("/MinimumBias/ReleaseValidation-alca%d-FAKE-v1/ALCARECO" % i in outputDatasets)
         for i in range(1, 6):
-            self.assertTrue("/MinimumBias/ReleaseValidation-skim%d-v1/RECO-AOD" % i in outputDatasets,
-                            "/MinimumBias/ReleaseValidation-skim%d-v1/RECO-AOD not in output datasets" % i)
+            self.assertTrue("/MinimumBias/ReleaseValidation-skim%d-FAKE-v1/RECO-AOD" % i in outputDatasets)
 
         return