Repository: dmwm/wmcore
Issue: ReqMgr2 -> request info without ProcessingString or Processing version

@ticoann @amaltaro 
When an acdc is created, the information provided in this API:
https://cmsweb.cern.ch/reqmgr2/data/request?name=jbadillo_ACDC_Run2015BHINPFJet100-16Oct2015_7414_151106_101855_6024
Comes without ProcessingString or ProcessingVersion.
In contrast with the old API:
https://cmsweb.cern.ch/reqmgr/reqMgr/request?requestName=jbadillo_ACDC_Run2015BHINPFJet100-16Oct2015_7414_151106_101855_6024


Changed files:
src/python/WMCore/WMSpec/WMWorkloadTools.py, src/python/WMCore/ReqMgr/Utils/Validation.py, src/python/WMCore/HTTPFrontEnd/RequestManager/ReqMgrWebTools.py, src/python/WMCore/WMSpec/StdSpecs/StdBase.py

diff --git a/src/python/WMCore/HTTPFrontEnd/RequestManager/ReqMgrWebTools.py b/src/python/WMCore/HTTPFrontEnd/RequestManager/ReqMgrWebTools.py
index 29fe609b7..c4c1361cf 100644
--- a/src/python/WMCore/HTTPFrontEnd/RequestManager/ReqMgrWebTools.py
+++ b/src/python/WMCore/HTTPFrontEnd/RequestManager/ReqMgrWebTools.py
@@ -421,6 +421,8 @@ def buildWorkloadAndCheckIn(webApi, reqSchema, couchUrl, couchDB, wmstatUrl, clo
                       "SizePerEvent",
                       "PrepID",
                       "RequestNumEvents",
+                      "ProcessingString",
+                      "ProcessingVersion",
                       ]
     
     couchDb = Database(reqDetails["CouchWorkloadDBName"], reqDetails["CouchURL"])
@@ -481,6 +483,8 @@ def requestDetails(requestName):
     schema['UnmergedLFNBase'] = str(helper.getUnmergedLFNBase())
     schema['Campaign']        = str(helper.getCampaign()) 
     schema['AcquisitionEra']  = str(helper.getAcquisitionEra())
+    schema["ProcessingString"] = str(helper.getProcessingString())
+    schema["ProcessingVersion"] = int(helper.getProcessingVersion())
     if schema['SoftwareVersions'] == ['DEPRECATED']:
         schema['SoftwareVersions'] = helper.getCMSSWVersions()
 
diff --git a/src/python/WMCore/ReqMgr/Utils/Validation.py b/src/python/WMCore/ReqMgr/Utils/Validation.py
index 42ea76ad9..19e514b11 100644
--- a/src/python/WMCore/ReqMgr/Utils/Validation.py
+++ b/src/python/WMCore/ReqMgr/Utils/Validation.py
@@ -7,7 +7,7 @@ import time
 import logging
 
 from WMCore.WMSpec.WMWorkload import WMWorkloadHelper
-from WMCore.WMSpec.WMWorkloadTools import loadSpecByType
+from WMCore.WMSpec.WMWorkloadTools import loadSpecByType, loadSpecClassByType, setArgumentsWithDefault
 from WMCore.REST.Auth import authz_match
 from WMCore.WMFactory import WMFactory
 
@@ -136,6 +136,10 @@ def validate_request_create_args(request_args, config, *args, **kwargs):
     permission = getWritePermission(request_args)
     authz_match(permission['role'], permission['group'])
     
+    # set default values for teh request_args
+    specClass = loadSpecClassByType(request_args["RequestType"])
+    setArgumentsWithDefault(request_args, specClass.getWorkloadArguments())
+    
     # get the spec type and validate arguments
     spec = loadSpecByType(request_args["RequestType"])
     if request_args["RequestType"] == "Resubmission":
diff --git a/src/python/WMCore/WMSpec/StdSpecs/StdBase.py b/src/python/WMCore/WMSpec/StdSpecs/StdBase.py
index aaf5cbc1c..76c07962b 100644
--- a/src/python/WMCore/WMSpec/StdSpecs/StdBase.py
+++ b/src/python/WMCore/WMSpec/StdSpecs/StdBase.py
@@ -8,7 +8,7 @@ import logging
 
 from WMCore.Cache.WMConfigCache import ConfigCache, ConfigCacheException
 from WMCore.Configuration import ConfigSection
-from WMCore.Lexicon import lfnBase, identifier, acqname, cmsswversion, cmsname, couchurl, block
+from WMCore.Lexicon import lfnBase, identifier, acqname, cmsswversion, cmsname, couchurl, block, procstring
 from WMCore.Services.Dashboard.DashboardReporter import DashboardReporter
 from WMCore.WMSpec.WMSpecErrors import WMSpecFactoryException
 from WMCore.WMSpec.WMWorkload import newWorkload
@@ -939,8 +939,8 @@ class StdBase(object):
                      "ScramArch": {"default": "slc5_amd64_gcc462", "optional": False},
                      "GlobalTag": {"null": True},
                      "GlobalTagConnect": {"null": True},
-                     "ProcessingVersion": {"default": 1, "type": int},
-                     "ProcessingString": {"null": True},
+                     "ProcessingVersion": {"default": 1, "type": int, "assign_optional": False},
+                     "ProcessingString": {"default": "", "validate": procstring, "assign_optional": False},
                      "LumiList": {"default": {}, "type": makeLumiList},
                      "SiteBlacklist": {"default": [], "type": makeList,
                                        "validate": lambda x: all([cmsname(y) for y in x])},
diff --git a/src/python/WMCore/WMSpec/WMWorkloadTools.py b/src/python/WMCore/WMSpec/WMWorkloadTools.py
index 2d6ccecfc..ce0888fa9 100644
--- a/src/python/WMCore/WMSpec/WMWorkloadTools.py
+++ b/src/python/WMCore/WMSpec/WMWorkloadTools.py
@@ -274,6 +274,14 @@ def setAssignArgumentsWithDefault(arguments, argumentDefinition, checkList):
             arguments[argument] = argumentDefinition[argument]["default"]
     return
 
+def setArgumentsWithDefault(arguments, argumentDefinition):
+    """
+    sets the default value if arguments value is specified as None
+    """
+    for argument in argumentDefinition:
+        if argument not in arguments and "default" in argumentDefinition[argument]:
+            arguments[argument] = argumentDefinition[argument]["default"]
+    return
 
 def loadSpecClassByType(specType):
     factoryName = "%sWorkloadFactory" % specType