Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate spec run lists against integer data type #11535

Merged
merged 2 commits into from
Apr 21, 2023

Conversation

vkuznet
Copy link
Contributor

@vkuznet vkuznet commented Apr 5, 2023

Fixes #11466

Status

In development

Description

Provide validation function for RunWhite/Blacklist.

Is it backward compatible (if not, which system it affects?)

YES

Related PRs

External dependencies / deployment changes

@vkuznet vkuznet self-assigned this Apr 5, 2023
@vkuznet
Copy link
Contributor Author

vkuznet commented Apr 5, 2023

@amaltaro , could you please quickly look into this PR and provide me feedback if I'm moving in a right direction. If so, I'll inspect other specs and adjust PR accordingly.

@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: succeeded
    • 1 tests no longer failing
    • 1 tests added
    • 2 changes in unstable tests
  • Python3 Pylint check: failed
    • 26 warnings and errors that must be fixed
    • 10 warnings
    • 114 comments to review
  • Pylint py3k check: succeeded
  • Pycodestyle check: succeeded
    • 15 comments to review

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/14176/artifact/artifacts/PullRequestReport.html

@amaltaro
Copy link
Contributor

amaltaro commented Apr 6, 2023

@vkuznet Valentin, this development is in the right direction.

However, I just noticed that we overlooked something much more simple. Here is how these 2 attributes are defined in StdBase:
https://github.com/dmwm/WMCore/blob/master/src/python/WMCore/WMSpec/StdSpecs/StdBase.py#L1234-L1237

so I think we can simply update the validate function in there to something like:

lambda x: all([isinstance(y, int) for y in x])

It needs to be properly tested though and also propagated to TaskChain/StepChain specs.

@vkuznet
Copy link
Contributor Author

vkuznet commented Apr 11, 2023

test this please

@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: succeeded
    • 1 tests no longer failing
    • 2 tests added
    • 1 changes in unstable tests
  • Python3 Pylint check: failed
    • 28 warnings and errors that must be fixed
    • 10 warnings
    • 117 comments to review
  • Pylint py3k check: succeeded
  • Pycodestyle check: succeeded
    • 15 comments to review

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/14180/artifact/artifacts/PullRequestReport.html

@vkuznet vkuznet requested a review from amaltaro April 11, 2023 15:02
@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: succeeded
    • 2 tests no longer failing
    • 2 tests added
    • 1 changes in unstable tests
  • Python3 Pylint check: failed
    • 36 warnings and errors that must be fixed
    • 12 warnings
    • 208 comments to review
  • Pylint py3k check: failed
    • 1 warnings
  • Pycodestyle check: succeeded
    • 15 comments to review

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/14181/artifact/artifacts/PullRequestReport.html

Copy link
Contributor

@amaltaro amaltaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valentin, I don't think we need the custom validate function. The only places that we should update are the validate function in the factories:
https://github.com/dmwm/WMCore/blob/master/src/python/WMCore/WMSpec/StdSpecs/DataProcessing.py#L48
and
https://github.com/dmwm/WMCore/blob/master/src/python/WMCore/WMSpec/StdSpecs/StdBase.py#L1234

of course, for both RunWhitelist and RunBlacklist.

I left a comment in the unit test as well, suggesting to do the same for TaskChain and StepChain, to ensure that the run validation will get applied to inner task/step description as well.

@@ -52,6 +52,20 @@ def testStdBaseValidation(self):
stdBaseInstance.factoryWorkloadConstruction("TestWorkload", arguments)
return

def testRunlist(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest a similar test for the TaskChain and StepChain factories.

@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: succeeded
    • 1 tests no longer failing
    • 2 tests added
    • 1 changes in unstable tests
  • Python3 Pylint check: failed
    • 39 warnings and errors that must be fixed
    • 12 warnings
    • 213 comments to review
  • Pylint py3k check: failed
    • 1 warnings
  • Pycodestyle check: succeeded
    • 15 comments to review

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/14184/artifact/artifacts/PullRequestReport.html

@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: failed
    • 2 new failures
    • 5 tests added
  • Python3 Pylint check: failed
    • 76 warnings and errors that must be fixed
    • 15 warnings
    • 349 comments to review
  • Pylint py3k check: failed
    • 1 warnings
  • Pycodestyle check: succeeded
    • 118 comments to review

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/14208/artifact/artifacts/PullRequestReport.html

@vkuznet vkuznet requested a review from amaltaro April 17, 2023 14:41
Copy link
Contributor

@amaltaro amaltaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vkuznet Valentin, it could be that you missed my previous review. I suggested to completely get rid of the validateRunlist custom validate function.

I think the lambda functions in the spec will do everything that we need to be done. However, I'd suggest to ensure that this is tested in a TaskChain and StepChain unit test.

When you change it, please initially provide a new commit though (don't squash for now), just so we can make sure it's not really needed.

@vkuznet
Copy link
Contributor Author

vkuznet commented Apr 17, 2023

Alan, I did not miss your review, and intentionally left validateRunlist functions since from the code it is unclear if Task/Step specs will use StdBase validation via lambda functions. I do see that these classes are inherited from StdBase, but I can't conclude from the code that usage of lamda function is enough. The issue is here: https://github.com/dmwm/WMCore/blob/master/src/python/WMCore/WMSpec/StdSpecs/TaskChain.py#L218 where __call__ method of TaskChain (and similar to StepChain) accepts arguments parameter which may contain runlist. Therefore, I concluded that even arguments can be created via StdBase, later in a code they may be modified and passed to Task/StepChain, and therefore run lists may leak undesired data-types. I think my changes cover such possibility. If you think otherwise, I can easily remove such code. But please evaluate properly aforementioned possibility.

@amaltaro
Copy link
Contributor

Okay, here is what I would have to do to confirm the behavior:
a) setup unit tests and play with those run white/blacklist in ReReco, TaskChain and StepChain
b) patch ReqMgr2 in my k8s cluster and test it with the same spec types as above. We have tons of templates for such tests, but of course, you need to update the data type to what is not supposed to be supported.

Instead of me making all of this, I would suggest you to give it a try and learn how to test this code and avoid surprises in production.

In addition, please update the PR title with a more meaningful message (I didn't check the commit, but if needed, update the commit message as well).

@vkuznet
Copy link
Contributor Author

vkuznet commented Apr 19, 2023

@amaltaro , I performed approach (a) and all StdSpec_t in docker image run fine. For approach (b) I can patch reqmgr2 pod on test9 cluster but I have no idea how to locate and run templates for such test. Please provide concrete set of instruction if you think it will be necessary.

@amaltaro
Copy link
Contributor

amaltaro commented Apr 19, 2023

Sure, here is a wiki on injecting and checking/validating test workflows:
https://github.com/dmwm/WMCore/wiki/Injecting,-assigning-and-validating-test-requests#injection-and-assigning-workflows

Note-1: you do not really need to run any workflows, you only want to test their creation in ReqMgr2 (which is when the validation should kick in).
Note-2: many of those parameters need to be updated, so don't blindly copy/paste commands. Same applies to some template names (json file names, that might have been replaced by others).
Note-3: you will have to grep for a workflow that provides RunWhitelist/RunBlacklist, and update the json file with the wrong data type to properly test it.

@vkuznet
Copy link
Contributor Author

vkuznet commented Apr 19, 2023

Alan, the wiki is far from clear. Now, we have installation of WMCore through pypi and it install stuff into /usr/local/lib/python3.8/site-packages/WMCore which contains only source code. The question I need to understand where to get the templates (the JSON files as far as I understand) in order to run injection script.

@amaltaro
Copy link
Contributor

Templates are available under the DMWM and Integration directories in:
https://github.com/dmwm/WMCore/tree/master/test/data/ReqMgr/requests

and they are downloaded automatically whenever you execute the inject.. script.

You definitely do not need to be in your central services to run it. You only need your grid credentials and download the script (well, and python3).

@vkuznet
Copy link
Contributor Author

vkuznet commented Apr 19, 2023

Alan, I patched the reqmgr2 pod in test9 cluster and run the following injection where I adjusted TaskChain_InclParents.json with run white list to be string data-type:

python3 inject-test-wfs.py -u "https://cmsweb-test9.cern.ch" -m DMWM -f TaskChain_InclParents.json -c Agent105_Validation -r Agent105_CDB16_forceComplete -t valentin-devvm --injectOnly
2023-04-19 19:27:04,872:INFO:inject-test-wfs: WMCore directory found. I'm not going to clone it again.
2023-04-19 19:27:04,872:INFO:inject-test-wfs: You have 5 secs to abort this operation or live with that forever...

2023-04-19 19:27:09,877:INFO:inject-test-wfs: Skipping injection for these templates: ['ReReco_badBlocks.json', 'TaskChain_InclParents.json', 'StepChain_InclParents.json', 'SC_Straight.json', 'StoreResults.json', 'Resub_MonteCarlo_eff.json', 'Resub_TaskChain_Multicore.json']

But, somehow the injection script skip the template I provided. What's wrong?

@amaltaro
Copy link
Contributor

We skip those templates because those workflows don't run to the completion (lack of parent data in workqueue).

You can modify this line:
https://github.com/dmwm/WMCore/blob/master/test/data/ReqMgr/inject-test-wfs.py#L203
and set it to an empty list, that way your injection will go through.

To test a StepChain template, you can inject this one:
test/data/ReqMgr/requests/Integration/StepChain_InclParents.json

which btw, will also be skipped by the script unless you modify it.

@vkuznet
Copy link
Contributor Author

vkuznet commented Apr 20, 2023

Alan, I modified injection script, setup proxy but run into SSL issue. Here is full output:

python3 inject-test-wfs.py -u "https://cmsweb-test9.cern.ch" -m DMWM -f TaskChain_InclParents.json -c Agent105_Validation -r Agent105_CDB16_forceComplete -t valentin-devvm --injectOnly
2023-04-20 14:34:15,078:INFO:inject-test-wfs: WMCore directory found. I'm not going to clone it again.
2023-04-20 14:34:15,078:INFO:inject-test-wfs: You have 5 secs to abort this operation or live with that forever...

2023-04-20 14:34:20,080:INFO:inject-test-wfs: Skipping injection for these templates: []

2023-04-20 14:34:20,081:INFO:inject-test-wfs: Processing template: TaskChain_InclParents.json
2023-04-20 14:34:20,212:INFO:reqmgr2: Command line arguments: ['reqmgr2.py', '-u', 'https://cmsweb-test9.cern.ch', '-f', '/tmp/_reqmgr2.json', '-i'] ...
2023-04-20 14:34:20,212:INFO:reqmgr2: ReqMgr url: https://cmsweb-test9.cern.ch
2023-04-20 14:34:20,212:INFO:reqmgr2: RESTClient URL: https://cmsweb-test9.cern.ch
2023-04-20 14:34:20,212:INFO:reqmgr2: Identity files:
        cert file: '/etc/proxy/proxy'
        key file:  '/etc/proxy/proxy'
reqmgr2.py:52: DeprecationWarning: key_file, cert_file and check_hostname are deprecated, use a custom context instead.
  self.conn = HTTPSConnection(url, key_file=key_file, cert_file=cert_file)
2023-04-20 14:34:20,218:INFO:reqmgr2: Loading file '/tmp/_reqmgr2.json' ...
reqmgr2.py:416: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
  logger.warn("No request arguments to override (--json)? Some values will be wrong.")
2023-04-20 14:34:20,218:WARNING:reqmgr2: No request arguments to override (--json)? Some values will be wrong.
2023-04-20 14:34:20,218:WARNING:reqmgr2: Not properly set: DQMHLTonRAWAOD_2017: AcquisitionEra-OVERRIDE-ME
2023-04-20 14:34:20,218:WARNING:reqmgr2: Not properly set: Dashboard: Dashboard-OVERRIDE-ME
2023-04-20 14:34:20,219:WARNING:reqmgr2: Not properly set: DQMHLTonRAWAOD_2017: ProcessingString-OVERRIDE-ME
2023-04-20 14:34:20,219:WARNING:reqmgr2: Not properly set: Team: Team-OVERRIDE-ME
2023-04-20 14:34:20,219:INFO:reqmgr2: Performing 'create_request' ...
2023-04-20 14:34:20,219:INFO:reqmgr2: Injecting request args:
{'AcquisitionEra': {'DQMHLTonRAWAOD_2017': 'CMSSW_7_3_2'}, 'Campaign': 'Agent105_Validation', 'CMSSWVersion': 'CMSSW_7_3_2', 'Comments': {'WorkFlowDesc': ['Single task; IncludeParents True and 3 runs whitelisted; auto-splitting'], 'CheckList': ['TaskChain with IncludeParents', 'TaskChain: Data workflow']}, 'ConfigCacheUrl': 'https://cmsweb.cern.ch/couchdb', 'DbsUrl': 'https://cmsweb-testbed.cern.ch/dbs/int/global/DBSReader', 'GlobalTag': 'GR_P_V49', 'PrepID': 'TEST-CMSSW_7_3_2__test2inwf-1510737328-RunHLTPhy2017B_RAWAOD', 'ProcessingString': {'DQMHLTonRAWAOD_2017': 'DMWM_ProcStr_TEST'}, 'ProcessingVersion': 18, 'RequestPriority': 160000, 'RequestString': 'TaskChain_InclParents_Agent105_CDB16_forceComplete', 'RequestType': 'TaskChain', 'ScramArch': ['slc6_amd64_gcc491'], 'SizePerEvent': 512, 'SubRequestType': 'RelVal', 'Task1': {'AcquisitionEra': 'CMSSW_7_3_2', 'Campaign': 'CMSSW_7_3_2__test2inwf-1510737328', 'ConfigCacheID': '029a0b63329659025f308af53c7e092b', 'GlobalTag': 'GR_P_V49', 'IncludeParents': True, 'InputDataset': '/Cosmics/Commissioning2015-PromptReco-v1/RECO', 'KeepOutput': True, 'RunWhitelist': ['234297', '234321', '234332'], 'Memory': 2300, 'ProcessingString': 'Task1_WMCore_TEST', 'TaskName': 'DQMHLTonRAWAOD_2017'}, 'TaskChain': 1, 'TimePerEvent': 2} ...
Traceback (most recent call last):
  File "reqmgr2.py", line 477, in <module>
    main()
  File "reqmgr2.py", line 471, in main
    reqmgr_client.__getattribute__(action)(config)
  File "reqmgr2.py", line 139, in create_request
    status, data = self.http_request("POST", urn, data=json_args,
  File "reqmgr2.py", line 60, in http_request
    self.conn.request(verb, uri, body=data, headers=headers or self.headers)
  File "/usr/local/lib/python3.8/http/client.py", line 1256, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.8/http/client.py", line 1302, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.8/http/client.py", line 1251, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.8/http/client.py", line 1011, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.8/http/client.py", line 951, in send
    self.connect()
  File "/usr/local/lib/python3.8/http/client.py", line 1425, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "/usr/local/lib/python3.8/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/local/lib/python3.8/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/usr/local/lib/python3.8/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1131)
2023-04-20 14:34:20,252:INFO:inject-test-wfs: TaskChain_InclParents.json request FAILED injection!
2023-04-20 14:34:20,252:INFO:inject-test-wfs:
Injected 0 workflows out of 1 templates in 0.17 secs. Good job!

It seems to me that reqmgr2 pod lacks of something which does not allow me to proceed with our proxy file. Please note we deploy to k8s proxy using robot certs. Said that, I do not know how proxy in your test9 cluster is made and is it valid or not. I suggest that you have a look into this issue. For the record I use /tmp area where I downloaded the injection script and WMCore and the pod name is reqmgr2-879484689-96tjp.

@amaltaro
Copy link
Contributor

@vkuznet Valentin, it could be that there is an openssl incompatibility between the node you are using and the server.

In any case, here is my terminal output injecting that template with my own proxy:

amaltaro@vocms0193:~ $ export X509_USER_PROXY=/data/amaltaro/myproxy.pem
amaltaro@vocms0193:~ $ env | grep X509
X509_USER_PROXY=/data/amaltaro/myproxy.pem
amaltaro@vocms0193:~ $ curl https://raw.githubusercontent.com/dmwm/WMCore/master/test/data/ReqMgr/inject-test-wfs.py > inject-test-wfs.py
amaltaro@vocms0193:~ $ vim inject-test-wfs.py  ## to comment out the disallowed list of templates
amaltaro@vocms0193:~ $ python3 inject-test-wfs.py -u "https://cmsweb-test9.cern.ch" -m DMWM -f TaskChain_InclParents.json -c Agent105_Validation -r Agent105_CDB16_forceComplete -t valentin-devvm --injectOnly
Cloning into 'WMCore'...
...
2023-04-21 01:40:34,430:INFO:inject-test-wfs: WMCore repository successfully cloned!
2023-04-21 01:40:34,430:INFO:inject-test-wfs: Skipping injection for these templates: []

2023-04-21 01:40:34,433:INFO:inject-test-wfs: Processing template: TaskChain_InclParents.json
2023-04-21 01:40:34,521:INFO:reqmgr2: Command line arguments: ['reqmgr2.py', '-u', 'https://cmsweb-test9.cern.ch', '-f', '/tmp/amaltaro.json', '-i'] ...
2023-04-21 01:40:34,521:INFO:reqmgr2: ReqMgr url: https://cmsweb-test9.cern.ch
2023-04-21 01:40:34,521:INFO:reqmgr2: RESTClient URL: https://cmsweb-test9.cern.ch
2023-04-21 01:40:34,521:INFO:reqmgr2: Identity files:
	cert file: '/data/amaltaro/myproxy.pem'
	key file:  '/data/amaltaro/myproxy.pem' 
2023-04-21 01:40:34,529:INFO:reqmgr2: Loading file '/tmp/amaltaro.json' ...
2023-04-21 01:40:34,530:WARNING:reqmgr2: No request arguments to override (--json)? Some values will be wrong.
2023-04-21 01:40:34,530:WARNING:reqmgr2: Not properly set: DQMHLTonRAWAOD_2017: AcquisitionEra-OVERRIDE-ME
2023-04-21 01:40:34,530:WARNING:reqmgr2: Not properly set: Dashboard: Dashboard-OVERRIDE-ME
2023-04-21 01:40:34,530:WARNING:reqmgr2: Not properly set: DQMHLTonRAWAOD_2017: ProcessingString-OVERRIDE-ME
2023-04-21 01:40:34,530:WARNING:reqmgr2: Not properly set: Team: Team-OVERRIDE-ME
2023-04-21 01:40:34,530:INFO:reqmgr2: Performing 'create_request' ...
2023-04-21 01:40:34,530:INFO:reqmgr2: Injecting request args:
{'AcquisitionEra': {'DQMHLTonRAWAOD_2017': 'CMSSW_7_3_2'}, 'Campaign': 'Agent105_Validation', 'CMSSWVersion': 'CMSSW_7_3_2', 'Comments': {'WorkFlowDesc': ['Single task; IncludeParents True and 3 runs whitelisted; auto-splitting'], 'CheckList': ['TaskChain with IncludeParents', 'TaskChain: Data workflow']}, 'ConfigCacheUrl': 'https://cmsweb.cern.ch/couchdb', 'DbsUrl': 'https://cmsweb-testbed.cern.ch/dbs/int/global/DBSReader', 'GlobalTag': 'GR_P_V49', 'PrepID': 'TEST-CMSSW_7_3_2__test2inwf-1510737328-RunHLTPhy2017B_RAWAOD', 'ProcessingString': {'DQMHLTonRAWAOD_2017': 'DMWM_ProcStr_TEST'}, 'ProcessingVersion': 18, 'RequestPriority': 160000, 'RequestString': 'TaskChain_InclParents_Agent105_CDB16_forceComplete', 'RequestType': 'TaskChain', 'ScramArch': ['slc6_amd64_gcc491'], 'SizePerEvent': 512, 'SubRequestType': 'RelVal', 'Task1': {'AcquisitionEra': 'CMSSW_7_3_2', 'Campaign': 'CMSSW_7_3_2__test2inwf-1510737328', 'ConfigCacheID': '029a0b63329659025f308af53c7e092b', 'GlobalTag': 'GR_P_V49', 'IncludeParents': True, 'InputDataset': '/Cosmics/Commissioning2015-PromptReco-v1/RECO', 'KeepOutput': True, 'RunWhitelist': [234297, 234321, 234332], 'Memory': 2300, 'ProcessingString': 'Task1_WMCore_TEST', 'TaskName': 'DQMHLTonRAWAOD_2017'}, 'TaskChain': 1, 'TimePerEvent': 2} ...
2023-04-21 01:40:35,512:INFO:reqmgr2: {'result': [{'request': 'amaltaro_TaskChain_InclParents_Agent105_CDB16_forceComplete_230420_234034_6084'}]}
2023-04-21 01:40:35,512:INFO:reqmgr2: Approving request 'amaltaro_TaskChain_InclParents_Agent105_CDB16_forceComplete_230420_234034_6084' ...
2023-04-21 01:40:35,751:INFO:reqmgr2: Approve succeeded.
2023-04-21 01:40:35,751:INFO:reqmgr2: Create request 'amaltaro_TaskChain_InclParents_Agent105_CDB16_forceComplete_230420_234034_6084' succeeded.
2023-04-21 01:40:35,762:INFO:inject-test-wfs: TaskChain_InclParents.json request successfully created!
2023-04-21 01:40:35,763:INFO:inject-test-wfs: 
Injected 1 workflows out of 1 templates in 1.33 secs. Good job!
amaltaro@vocms0193:~ $ 

@amaltaro
Copy link
Contributor

@vkuznet Valentin, I managed to test a ReReco, TaskChain and StepChain "bad" workflow and all of them failed with the same error message, e.g.:

{'AcquisitionEra': 'Run2016H', 'BlockWhitelist': ['/HLTPhysicsIsolatedBunch/Run2016H-v1/RAW#92049f6e-92f9-11e6-b150-001e67abf228'], 'CMSSWVersion': 'CMSSW_8_0_23', 'Campaign': 'Agent105_Validation', 'Comments': {'WorkFlowDesc': ['ReReco run 283171 from one block (out of 2); harvesting enabled; 3 lumis only', 'Automatic splitting at 389 EpJob (actually 1 lumi and file per job)'], 'CheckList': ['ReReco harvesting']}, 'ConfigCacheID': '31b62d6a0629158d7246ce34e82c20c3', 'ConfigCacheUrl': 'https://cmsweb.cern.ch/couchdb', 'CouchDBName': 'reqmgr_config_cache', 'DQMConfigCacheID': '947d11a5076ed983a3f9aaafd7a2b04c', 'DQMUploadUrl': 'https://cmsweb-testbed.cern.ch/dqm/dev', 'DbsUrl': 'https://cmsweb-testbed.cern.ch/dbs/int/global/DBSReader', 'EnableHarvesting': True, 'GlobalTag': '80X_dataRun2_SPECIALHIGHPUFILL_v0', 'Group': 'DATAOPS', 'IncludeParents': False, 'InputDataset': '/HLTPhysicsIsolatedBunch/Run2016H-v1/RAW', 'Memory': 12000, 'Multicore': 8, 'PrepID': 'TEST-ReReco-Run2016H-v1-09Nov2016-0016', 'ProcessingString': '09Nov2016', 'ProcessingVersion': 2, 'RequestPriority': 190000, 'RequestString': 'ReReco_RunBlockWhite_Agent105_CDB16_forceComplete', 'RequestType': 'ReReco', 'RunWhitelist': ['283171'], 'Scenario': 'pp', 'ScramArch': 'slc6_amd64_gcc530', 'SizePerEvent': 1500, 'SplittingAlgo': 'EventAwareLumiBased', 'TimePerEvent': 73.85} ...
2023-04-21 01:47:57,229:ERROR:reqmgr2: Failed to create request with status: 400, data: b'<!DOCTYPE html PUBLIC\n"-//W3C//DTD XHTML 1.0 Transitional//EN"\n"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html>\n<head>\n    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>\n    <title>400 Bad Request</title>\n    <style type="text/css">\n    #powered_by {\n        margin-top: 20px;\n        border-top: 2px solid black;\n        font-style: italic;\n    }\n\n    #traceback {\n        color: red;\n    }\n    </style>\n</head>\n    <body>\n        <h2>400 Bad Request</h2>\n        <p>Invalid spec parameter value: &lt;@========== WMException Start ==========@&gt;\nException Class: WMSpecFactoryException\nMessage: Argument \'RunWhitelist\' with value [\'283171\'], doesn\'t pass the validate function.\nIt\'s definition is:\n                                     "validate": lambda x: all([isinstance(y, int) for y in x])},\n\n\tClassName : None\n\tModuleName : WMCore.WMSpec.WMWorkloadTools\n\tMethodName : _validateArgFunction\n\tClassInstance : None\n\tFileName : /usr/local/lib/python3.8/site-packages/WMCore/WMSpec/WMWorkloadTools.py\n\tLineNumber : 133\n\tErrorNr : 0\n\nTraceback: \n\n&lt;@---------- WMException End ----------@&gt;</p>\n        <pre id="traceback"></pre>\n    <div id="powered_by">\n      <span>\n        Powered by <a href="http://www.cherrypy.dev">CherryPy 18.8.0</a>\n      </span>\n    </div>\n    </body>\n</html>\n'

which means that the StdBase/DataProcessing spec level validate function is being executed properly.

Could you please clean up this PR by removing the extra function for validating these run lists?

@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: succeeded
    • 3 tests added
    • 2 changes in unstable tests
  • Python3 Pylint check: failed
    • 50 warnings and errors that must be fixed
    • 5 warnings
    • 236 comments to review
  • Pylint py3k check: failed
    • 1 warnings
  • Pycodestyle check: succeeded
    • 103 comments to review

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/14220/artifact/artifacts/PullRequestReport.html

@vkuznet vkuznet requested a review from amaltaro April 21, 2023 13:31
@vkuznet
Copy link
Contributor Author

vkuznet commented Apr 21, 2023

Alan, I removed validateRunlist code. Please review again.

Copy link
Contributor

@amaltaro amaltaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vkuznet sorry if I didn't suggest it before, but I suggest to keep both integer and positive validation in place (see inline comment).

@@ -46,9 +46,9 @@ def getWorkloadCreateArgs():
"PrimaryDataset": {"optional": True, "validate": primdataset,
"attr": "inputPrimaryDataset", "null": True},
"RunBlacklist": {"default": [], "type": makeList, "null": False,
"validate": lambda x: all([int(y) > 0 for y in x])},
"validate": lambda x: all([isinstance(y, int) for y in x])},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valentin, I think we should actually keep the old validation as well. So the code that I would suggest to have in place is isinstance(y, int) and int(y) > 0, thus catching either the data type and a positive number.

@vkuznet
Copy link
Contributor Author

vkuznet commented Apr 21, 2023

good point, I added the positive number check back.

@vkuznet vkuznet requested a review from amaltaro April 21, 2023 13:48
@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: succeeded
    • 1 tests no longer failing
    • 3 tests added
    • 2 changes in unstable tests
  • Python3 Pylint check: failed
    • 50 warnings and errors that must be fixed
    • 5 warnings
    • 236 comments to review
  • Pylint py3k check: failed
    • 1 warnings
  • Pycodestyle check: succeeded
    • 103 comments to review

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/14221/artifact/artifacts/PullRequestReport.html

@amaltaro amaltaro changed the title Fix issue 11466 Validate spec run lists against integer data type Apr 21, 2023
Copy link
Contributor

@amaltaro amaltaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Valentin, it looks good to me!

@amaltaro amaltaro merged commit 330dcdc into dmwm:master Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validate workflow run lists (RunWhitelist and RunBlacklist)
3 participants