Skip to content

Conversation

@todor-ivanov
Copy link
Contributor

@todor-ivanov todor-ivanov commented Sep 29, 2025

Fixes #12395

Status

Ready

Description

With the current PR we enable python-oracledb ThickMode + sqlalchemy 1.4

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

Yes

Related PRs

External dependencies / deployment changes

This PR introduces a new OS level dependency, which must be enforced also to our wmcore-dev images which we run within our Jenkins setup. The new image is switched to at the configuration of this Jenkins job: https://cmssdt.cern.ch/dmwm-jenkins/job/WMCore-PR-Test/

@todor-ivanov
Copy link
Contributor Author

test this please

@todor-ivanov
Copy link
Contributor Author

I've injected one validation workflow in vocms0290, which is not having the old cx-Oracle python driver, but is using only python-oracledb . The workflow is healthy so far: https://cmsweb-testbed.cern.ch/reqmgr2/fetch?rid=tivanov_SC_Parent_LumiMask_cx_oracle_Test_v2_250929_170435_4055

No errors in the logs were observed either.

@todor-ivanov
Copy link
Contributor Author

todor-ivanov commented Sep 30, 2025

Just an update about the Jenkins errors which we observe.

They are all following from the missing OS level Oracle driver libraries. The underlying error is:

  • oracledb.exceptions.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file, look at: [1].

This comes from the fact that we decided to go with the python-oracledb Thick mode instead of Thin mode. And the reason to chose the former before the later was this error which was thrown in Thin mode:

  • DPY-3001: Native Network Encryption and Data Integrity is only supported in python-oracledb thick mode, look at: [2].

And more details about this error is given in the python-oracledb documentation: https://python-oracledb.readthedocs.io/en/latest/user_guide/troubleshooting.html#dpy3001

And indeed fetching this information from the database gives the result:

(WMAgent.venv3.ora) [cmst1@vocms0290 WMAgent.venv3.ora]$ manage db-prompt

...

SQL> SELECT network_service_banner FROM v$session_connect_info; 
text

NETWORK_SERVICE_BANNER
===================================================================================================================================================================================================================
Oracle Bequeath NT Protocol Adapter for Linux: Version 19.0.0.0.0 - Production
Authentication service for Linux: Version 19.0.1.0.0 - Production
Encryption service for Linux: Version 19.0.1.0.0 - Production
AES256 Encryption service adapter for Linux: Version 19.0.1.0.0 - Production
Crypto-checksumming service for Linux: Version 19.0.1.0.0 - Production
SHA512 Crypto-checksumming service adapter for Linux: Version 19.0.1.0.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 19.0.0.0.0 - Production

Which basically tells us that ORacle Native Network Encryption and Data Integrity (NNE) is enabled on the server side. so we must resort to one of the two solutions suggested in the documentation:

"""
If NNE or checksumming are enabled, you can resolve this error by either:

"""

I chose to go with the Think Mode, because the first of the two alternatives would require a significant change in our whole DB configuration and connection stack.

p.s. The fact that we are using SQLAlchemy on top of the native database libraries did not make things any simpler :)

FYI: @amaltaro @anpicci

[1]

+ python3 /home/cmsbld/WMCore/setup.py test --buildBotMode=true --reallyDeleteMyDatabaseAfterEveryTest=true --testCertainPath=/home/cmsbld/WMCore/test/python --testTotalSlices=12 --testCurrentSlice=0
/home/cmsbld/.local/wmcore-venv/lib/python3.12/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
!!

        ********************************************************************************
        Please consider removing the following classifiers in favor of a SPDX license expression:

        License :: OSI Approved :: Apache Software License

        See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
        ********************************************************************************

!!
  self._finalize_license_expression()
running test
Using the tests below: /home/cmsbld/WMCore/test/python
#### WE ARE DELETING YOUR DATABASE. 3 SECONDS TO CANCEL ####
#### buildbotmode is true
Traceback (most recent call last):
  File "/home/cmsbld/WMCore/setup.py", line 96, in <module>
    setup(
  File "/home/cmsbld/.local/wmcore-venv/lib/python3.12/site-packages/setuptools/__init__.py", line 115, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cmsbld/.local/wmcore-venv/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 186, in setup
    return run_commands(dist)
           ^^^^^^^^^^^^^^^^^^
  File "/home/cmsbld/.local/wmcore-venv/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 202, in run_commands
    dist.run_commands()
  File "/home/cmsbld/.local/wmcore-venv/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 1002, in run_commands
    self.run_command(cmd)
  File "/home/cmsbld/.local/wmcore-venv/lib/python3.12/site-packages/setuptools/dist.py", line 1102, in run_command
    super().run_command(command)
  File "/home/cmsbld/.local/wmcore-venv/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 1021, in run_command
    cmd_obj.run()
  File "/home/cmsbld/WMCore/setup_test.py", line 279, in run
    import WMQuality.TestInit
  File "/home/cmsbld/WMCore/src/python/WMQuality/TestInit.py", line 31, in <module>
    from WMCore.WMInit import WMInit
  File "/home/cmsbld/WMCore/src/python/WMCore/WMInit.py", line 21, in <module>
    from WMCore.Database.DBFactory import DBFactory
  File "/home/cmsbld/WMCore/src/python/WMCore/Database/DBFactory.py", line 8, in <module>
    oracledb.init_oracle_client()
  File "src/oracledb/impl/thick/utils.pyx", line 527, in oracledb.thick_impl.init_oracle_client
  File "src/oracledb/impl/thick/utils.pyx", line 562, in oracledb.thick_impl.init_oracle_client
  File "src/oracledb/impl/thick/utils.pyx", line 474, in oracledb.thick_impl._raise_from_info
oracledb.exceptions.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file: No such file or directory". See https://python-oracledb.readthedocs.io/en/latest/user_guide/initialization.html for help
Help: https://python-oracledb.readthedocs.io/en/latest/user_guide/troubleshooting.html#dpi-1047

[2]

(WMAgent.venv3.ora) [cmst1@vocms0290 WMAgent.venv3.ora]$ bin/wmagent-resource-control -p
Thresholds and current status for all sites:

Traceback (most recent call last):
  File "/data/WMAgent.venv3.ora/bin/wmagent-resource-control", line 318, in <module>
    printThresholds(myResourceControl, options.siteName)
  File "/data/WMAgent.venv3.ora/bin/wmagent-resource-control", line 173, in printThresholds
    thresholds = resourceControl.listThresholdsForSubmit()
  File "/data/WMAgent.venv3.ora/srv/WMCore/src/python/WMCore/ResourceControl/ResourceControl.py", line 201, in listThresholdsForSubmit
    return listAction.execute(conn=self.getDBConn(),
  File "/data/WMAgent.venv3.ora/srv/WMCore/src/python/WMCore/ResourceControl/MySQL/ListThresholdsForSubmit.py", line 157, in execute
    results = self.dbi.processData(self.sql, conn=conn, transaction=transaction)
  File "/data/WMAgent.venv3.ora/srv/WMCore/src/python/WMCore/Database/DBCore.py", line 133, in processData
    connection = self.connection()
  File "/data/WMAgent.venv3.ora/srv/WMCore/src/python/WMCore/Database/DBCore.py", line 120, in connection
    return self.engine.connect()
  File "/data/WMAgent.venv3.ora/lib64/python3.9/site-packages/sqlalchemy/engine/base.py", line 3325, in connect
    return self._connection_cls(self, close_with_result=close_with_result)
  File "/data/WMAgent.venv3.ora/lib64/python3.9/site-packages/sqlalchemy/engine/base.py", line 96, in __init__
    else engine.raw_connection()
...

  File "/data/WMAgent.venv3.ora/lib64/python3.9/site-packages/oracledb/connection.py", line 721, in __init__
    impl.connect(params_impl)
  File "src/oracledb/impl/thin/connection.pyx", line 536, in oracledb.thin_impl.ThinConnImpl.connect
  File "src/oracledb/impl/thin/connection.pyx", line 532, in oracledb.thin_impl.ThinConnImpl.connect
  File "src/oracledb/impl/thin/connection.pyx", line 475, in oracledb.thin_impl.ThinConnImpl._connect_with_params
  File "src/oracledb/impl/thin/connection.pyx", line 456, in oracledb.thin_impl.ThinConnImpl._connect_with_description
  File "src/oracledb/impl/thin/connection.pyx", line 418, in oracledb.thin_impl.ThinConnImpl._connect_with_address
  File "/data/WMAgent.venv3.ora/lib64/python3.9/site-packages/oracledb/errors.py", line 199, in _raise_err
    raise error.exc_type(error) from cause
sqlalchemy.exc.OperationalError: (oracledb.exceptions.OperationalError) DPY-6005: cannot connect to database (CONNECTION_ID=/zA3Tm2/DJH91zrcyMN7Gg==).
DPY-3001: Native Network Encryption and Data Integrity is only supported in python-oracledb thick mode
(Background on this error at: https://sqlalche.me/e/14/e3q8)

@todor-ivanov
Copy link
Contributor Author

test this please

@todor-ivanov
Copy link
Contributor Author

test this please

@todor-ivanov
Copy link
Contributor Author

test this please

@dmwm-bot
Copy link

dmwm-bot commented Oct 2, 2025

Jenkins results:

  • Python3 Unit tests: failed
    • 3 new failures
    • 2 changes in unstable tests
  • Python3 Pylint check: failed
    • 3 warnings and errors that must be fixed
    • 24 comments to review
  • Pycodestyle check: succeeded
    • 12 comments to review

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

@todor-ivanov
Copy link
Contributor Author

Jenkins is finally fixed... After loosing one day to figure out how to configure the failing WMCore-PR-Test to run with the latest image of wmcore-dev (which contains the Oracle instant client libraries) and which is uploaded to resgistry.cern.ch

The so failing unit tests are another story though. I will look into them now, but I am not sure I can do much.

@todor-ivanov
Copy link
Contributor Author

test this please

@todor-ivanov
Copy link
Contributor Author

As mentioned yesterday, None of these failing unit tests are actually related to the code changes here.

@amaltaro @anpicci I can say this PR is in final state. Feel free to leave your review comments so that we can merge. In the meantime I'll create a local build and a tag one docker image in one of my agents only (not uploading it to CERN registry) so that I can deploy and confirm that this change does not affect our MariaDB containers.

@todor-ivanov todor-ivanov requested a review from anpicci October 3, 2025 07:15
@dmwm-bot
Copy link

dmwm-bot commented Oct 3, 2025

Jenkins results:

  • Python3 Unit tests: failed
    • 3 new failures
    • 2 changes in unstable tests
  • Python3 Pylint check: failed
    • 3 warnings and errors that must be fixed
    • 24 comments to review
  • Pycodestyle check: succeeded
    • 12 comments to review

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/WMCore-PR-Report/1042/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.

@todor-ivanov I left a comment along the code for your consideration.
In addition,

  • can you please update the initial description of the PR with all relevant changes to integrate this Oracle library (CMSKubernetes, Jenkins, etc)?
  • the PR title suggests a change in SQLAlchemy library, but I see no changes to the requirements.txt file. Does it mean the version didn't really change?

import oracledb
oracledb.version = "8.3.0"
sys.modules["cx_Oracle"] = oracledb
oracledb.init_oracle_client()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add a note or a pointer to the PR explaining why we need to make these tweaks?
It sounds strange to me that we need to define a cx_Oracle module in our code, considering that it has been deprecated/replaced in 2022 by python-oracledb.

In addition, I think this should only be applied if we identify that the dialect is oracle. In other words, this isn't really needed for MariaDB backend agents.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hi @amaltaro I'll reply to this comment not inline but in the main thread, because it will be long: #12451 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add something like "Ensure SQLAlchemy is able to find the oracledb python libraries.\nFurther details at: "
It will help if anyone needs to look into this code in the future.

@anpicci
Copy link
Contributor

anpicci commented Oct 6, 2025

Hi @todor-ivanov, thank you for your work! May you fix the failed unit tests?

@todor-ivanov
Copy link
Contributor Author

Hi @amaltaro @anpicci ,
I have patched vocms0260 (which is a MariaDB agent) with this PR, and started tests on that. So far it is all good. There are no errors at the agent due to the fact that even if it is a MariaDB agent it gets the oracle driver initialized at import time.

I have also injected a workflow to confirm it explicitly: https://cmsweb-testbed.cern.ch/reqmgr2/fetch?rid=tivanov_SC_Parent_LumiMask_cx_oracle_Test_v3_251007_082926_9592

I will report the results from it later.

@todor-ivanov
Copy link
Contributor Author

@todor-ivanov
Copy link
Contributor Author

todor-ivanov commented Oct 7, 2025

Hi @amaltaro in reply to your comment inline: https://github.com/dmwm/WMCore/pull/12451/files#r2401650002

Can you please add a note or a pointer to the PR explaining why we need to make these tweaks?

  • These tweaks are needed because we are using sqlalchemy on top of the oracle libraries. That said, it is important to mention also that it makes difference how you initialize the underlying db/oracle drivers. This initialization mechanism also depends on the sqlalchemy version we use either v1.4 or v2.0. And as clarified in the PR name and description, we are upgrading cx_oracle to python-oracledb but not touching sqlalchemy. Here are the pointers I was following for this:

It sounds strange to me that we need to define a cx_Oracle module in our code, considering that it has been deprecated/replaced in 2022 by python-oracledb.

  • We are not defining a cx_Oracle in our code, we are tricking sqlAlchemy to think that we have loaded this system module, while in reality we are loading the oracledb driver at the same place where it would be searched for as cx_Oracle.
sys.modules["cx_Oracle"] = oracledb
  • This (I suspect, but have not checked explicitly) implies the need to also tamper/fake the oracledb.version one line above:
oracledb.version = "8.3.0"

In addition, I think this should only be applied if we identify that the dialect is oracle. In other words, this isn't really needed for MariaDB backend agents.

Well, this even though at a first glance sounds a legit request, it is difficult to implement on a cost which I am not sure, we are willing to pay at this stage. What I am talking about - The module which is actually creating the DB connection is indeed: https://github.com/dmwm/WMCore/blob/master/src/python/WMCore/Database/DBFactory.py (where the current dialect is not known) but not in the https://github.com/dmwm/WMCore/blob/master/src/python/WMCore/WMInit.py which is calling the former and knows the exact dialect for the current agent:

if dialect.lower() in ['mysql', 'mariadb']:
dialect = 'mariadb' # Both MySQL and MariaDB use the mariadb directory
if socketLoc != None:
options['unix_socket'] = socketLoc
elif dialect.lower() == 'oracle':
dialect = 'oracle' # Keep lowercase for consistency
elif dialect.lower() == 'http':
dialect = 'CouchDB'
else:
msg = "Unsupported dialect %s !" % dialect
logging.error(msg)
raise WMInitException(msg)

Of course at DBFactory it can be taken from the thread itslef... because it is written there from WMInit:

myThread.dialect = dialect

But I, considered it more dangerous because WMInit is not the only user of DBSFactory. It seemed harmless to me to set the version of the driver even for the MariaDB agents. This step won't hurt the rest of the code execution, The driver is to be loaded anyway. And for the proof of this I made an explicit test byt patching one MariaDB agent with this PR and injected one workflow, which went flawlessly through the system:

@todor-ivanov
Copy link
Contributor Author

About: #12451 (review)

can you please update the initial description of the PR with all relevant changes to integrate this Oracle library (CMSKubernetes, Jenkins, etc)?

They are already there. I've put them in this description as I was developing them.

the PR title suggests a change in SQLAlchemy library, but I see no changes to the requirements.txt file. Does it mean the version didn't really change?

The PR's does not suggest anything. It is explicit on the sqlAlchemy version - v1.4. Which is the version we are currently using.

@anpicci
Copy link
Contributor

anpicci commented Oct 7, 2025

@todor-ivanov , thank you for the thorough investigation about the ties between oracle and the SQLAlchemy version. We will not upgrade SQLAlchemy, so I strongly suggest to stick with the recommendations from oracle about how to interface the new python library with SQLAlchemy 1.4. Efforts should only deliver a working python-oracledb + SQLAlchemy 1.4 configuration, as we did not target an SQLAlchemy update when making this issue part of the Q3 development plan.

About the dialect, if what has been already provided is enough to consistently propagate the database flavor all over the stack, please do not take any other action.

About the unit tests, we can proceed as agreed in private on MM.

@amaltaro
Copy link
Contributor

amaltaro commented Oct 8, 2025

Thank you for the follow up, Todor.
In short, my understanding is that SQLAlchemy 1.4 is not fully compatible with python-oracledb, which requires this extra tampering with the library to properly locate the underlying python library. Is that correct?

The PR's does not suggest anything. It is explicit on the sqlAlchemy version - v1.4. Which is the version we are currently using.

Mentioning SQLAlchemy in the title looks confusing to me and it lead me to think that it was being changed as well.

@amaltaro
Copy link
Contributor

amaltaro commented Oct 8, 2025

By the way, dmwm/CMSKubernetes#1663 only shows changes to the wmcore-dev image. Where are the changes to the wmagent - or upstream - image?

@todor-ivanov todor-ivanov changed the title Enable python-oracledb ThickMode + sqlalchemy 1.4 Enable python-oracledb ThickMode while keeping sqlalchemy on 1.4 Oct 8, 2025
@todor-ivanov
Copy link
Contributor Author

thanks @amaltaro

In short, my understanding is that SQLAlchemy 1.4 is not fully compatible with python-oracledb, which requires this extra tampering with the library to properly locate the underlying python library. Is that correct?

I did not see anywhere a claim that sqlAlchemy 1.4 is not compatible with python-oracle. I've just followed the recommended way of setting it up. On the other hand, the official page of SqlAlchemy: https://docs.sqlalchemy.org/en/14/dialects/oracle.html mentions only cx-Oracle as valid backend client. There is nothing related toe python-oracle

Mentioning SQLAlchemy in the title looks confusing to me and it lead me to think that it was being changed as well.

I changed the title to avoid confusion.

@todor-ivanov
Copy link
Contributor Author

By the way, dmwm/CMSKubernetes#1663 only shows changes to the wmcore-dev image. Where are the changes to the wmagent - or upstream - image

It was related only to fixing our dev image which we run at Jenkins. Once we converge on which Oracle instant client we moe on with I'll add also this PR to the description link as well.

@todor-ivanov
Copy link
Contributor Author

test this please

Add OracleDB initializtion comment
@dmwm-bot
Copy link

dmwm-bot commented Oct 8, 2025

Jenkins results:

  • Python3 Unit tests: failed
    • 3 new failures
    • 3 changes in unstable tests
  • Python3 Pylint check: succeeded
    • 23 comments to review
  • Pycodestyle check: succeeded
    • 11 comments to review

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

@todor-ivanov todor-ivanov force-pushed the feature_WMAgent_Migrate_cx_Oracle_fix-12395 branch from e0e1d37 to 43936c0 Compare October 8, 2025 14:46
@amaltaro
Copy link
Contributor

amaltaro commented Oct 8, 2025

@todor-ivanov please investigate the 3 new failing unit tests before merging this.

@todor-ivanov
Copy link
Contributor Author

test this please

@dmwm-bot
Copy link

dmwm-bot commented Oct 8, 2025

Jenkins results:

  • Python3 Unit tests: failed
    • 3 new failures
    • 1 changes in unstable tests
  • Python3 Pylint check: succeeded
    • 23 comments to review
  • Pycodestyle check: succeeded
    • 11 comments to review

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

@todor-ivanov
Copy link
Contributor Author

Hi @amaltaro those seemed transient. And the Jenkins error is gone now
I thing we can merge it now

@todor-ivanov todor-ivanov requested a review from amaltaro October 8, 2025 18:12
@amaltaro
Copy link
Contributor

amaltaro commented Oct 8, 2025

test this please

@dmwm-bot
Copy link

dmwm-bot commented Oct 8, 2025

Jenkins results:

  • Python3 Unit tests: failed
    • 3 new failures
  • Python3 Pylint check: succeeded
    • 23 comments to review
  • Pycodestyle check: succeeded
    • 11 comments to review

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

@amaltaro
Copy link
Contributor

amaltaro commented Oct 8, 2025

@todor-ivanov the unstable unittests cleared out, but these 3 are still persisting and I think it is important to understand and fix what is causing their failure:

    Utils_t.ProcessStats_t.TestProcessTHreadsInfo:testProcessThreadsInfo changed from success to failure
    WMCore_t.MicroService_t.MicroService_t.MicroServiceTest:testGetStatusIdentity changed from success to error
    WMCore_t.ReqMgr_t.Service_t.Auxiliary_t.AuxiliaryTest:testCampaignConfig changed from success to error

@todor-ivanov
Copy link
Contributor Author

Hi @amaltaro

I changed nothing in my Jenkins setup related to the latest failures. I just requested a fresh test through the GH actions.

As of the failing unit tests, none of them seem to be related to the current code change.

@todor-ivanov
Copy link
Contributor Author

todor-ivanov commented Oct 9, 2025

Nevertheless, lets look into each one of them individually.

With the tests you refer to in the top 3 from the list. ( I have no idea if that matters actually)

Which is far from enough, so lets do a manual run and add some printouts:

(WMAgent.venv3.ora) [cmst1@vocms0290 WMCore]$ ipython -i test/python/Utils_t/ProcessStats_t.py
Python 3.9.21 (main, Aug 19 2025, 00:00:00) 
Type 'copyright', 'credits' or 'license' for more information
IPython 8.18.1 -- An enhanced Interactive Python. Type '?' for help.
%reload_ext autoreload
%autoreload 2
/data/WMAgent.venv3.ora/srv/WMCore/src/python/Utils/ProcessStats.py:113: DeprecationWarning: connections() is deprecated and will be removed; use net_connections() instead
  "num_connections": len(process.connections()),  # Number of active connections
/data/WMAgent.venv3.ora/srv/WMCore/src/python/Utils/ProcessStats.py:165: DeprecationWarning: connections() is deprecated and will be removed; use net_connections() instead
  thread_info["num_connections"] = len(psutil.Process(thread_id).connections())
{'cmdline': ['/data/WMAgent.venv3.ora/bin/python',
             '/data/WMAgent.venv3.ora/bin/ipython',
             '-i',
             'test/python/Utils_t/ProcessStats_t.py'],
 'cpu_usage_percent': 0.0,
 'is_running': True,
 'memory_rss': 53612544,
 'memory_usage_percent': 0.35586337173815696,
 'num_connections': 0,
 'num_open_files': 3,
 'pid': 1086628,
 'ppid': 1020629,
 'process_name': 'ipython',
 'status': 'running',
 'threads': [{'cpu_usage_percent': 0.0,
              'is_running': True,
              'memory_usage_bytes': 53612544,
              'name': 'thread',
              'num_connections': 0,
              'num_open_files': 3,
              'status': 'sleeping',
              'system_time': 0.0,
              'thread_id': 1086629,
              'user_time': 0.0}]}
F
======================================================================
FAIL: testProcessThreadsInfo (__main__.TestProcessTHreadsInfo)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/WMAgent.venv3.ora/srv/WMCore/test/python/Utils_t/ProcessStats_t.py", line 25, in testProcessThreadsInfo
    self.assertTrue(len(info['threads']) == 0)
AssertionError: False is not true

----------------------------------------------------------------------
Ran 1 test in 2.007s

FAILED (failures=1)
---------------------------------------------------------------------------
SystemExit                                Traceback (most recent call last)
File /data/WMAgent.venv3.ora/srv/WMCore/test/python/Utils_t/ProcessStats_t.py:29
     25         self.assertTrue(len(info['threads']) == 0)
     28 if __name__ == "__main__":
---> 29     unittest.main()

File /usr/lib64/python3.9/unittest/main.py:101, in TestProgram.__init__(self, module, defaultTest, argv, testRunner, testLoader, exit, verbosity, failfast, catchbreak, buffer, warnings, tb_locals)
     99 self.progName = os.path.basename(argv[0])
    100 self.parseArgs(argv)
--> 101 self.runTests()

File /usr/lib64/python3.9/unittest/main.py:273, in TestProgram.runTests(self)
    271 self.result = testRunner.run(self.test)
    272 if self.exit:
--> 273     sys.exit(not self.result.wasSuccessful())

SystemExit: True

So, nothing to do with the current development

This time lets run it individually (only the failing one reported: testGetStatusIdentity):

(WMAgent.venv3.ora) [cmst1@vocms0290 WMCore]$ ipython -i test/python/WMCore_t/MicroService_t/MicroService_t.py
...
In [2]: microServiceTest = MicroServiceTest()

In [3]: microServiceTest.setUp()

[09/Oct/2025:08:39:49]  MicroService entire configuration:
from WMCore.Configuration import Configuration
config = Configuration()
config.section_('main')
config.main.port = 8833
config.main.section_('server')
config.main.server.thread_pool = 30
config.main.index = 'ui'
config.main.application = 'microservice'
config.section_('microservice')
config.microservice.admin = '[email protected]'
config.microservice.title = 'CMS MicroService'
config.microservice.description = 'CMS data operations MicroService'
config.section_('views')
config.views.section_('data')
config.views.data.object = 'WMCore.MicroService.Service.RestApiHub.RestApiHub'
config.views.data.manager = 'WMCore_t.MicroService_t.MicroService_t.ServiceManager'
config.views.section_('ui')
config.views.ui.object = 'WMCore.MicroService.WebGui.FrontPage.FrontPage'
config.views.ui.static = '/data/WMAgent.venv3.ora/srv/WMCore'

[09/Oct/2025:08:39:49]  MicroService REST configuration subset:
<module 'WMCore_t.MicroService_t.TestConfig' from '/data/WMAgent.venv3.ora/srv/WMCore/test/python/WMCore_t/MicroService_t/TestConfig.py'>
[09/Oct/2025:08:39:49] ENGINE Bus STARTING
CherryPy Checker:
The Application mounted at '/microservice/data' has an empty config.

[09/Oct/2025:08:39:49] ENGINE Started monitor thread 'Autoreloader'.
[09/Oct/2025:08:39:49] ENGINE Already serving on http://127.0.0.1:8833
[09/Oct/2025:08:39:49] ENGINE Bus STARTED

In [4]: microServiceTest.testGetStatusIdentity()

### CALL status API with service name True
127.0.0.1 - - [09/Oct/2025:08:42:32] "GET /microservice/data/status HTTP/1.1" 200 168 "" "PycURL/7.45.7 libcurl/8.16.0-DEV OpenSSL/3.5.3 zlib/1.2.11 brotli/1.1.0 libssh2/1.11.1_DEV nghttp2/1.67.1"
### CALL status API with service name True
127.0.0.1 - - [09/Oct/2025:08:42:32] "GET /microservice/data/status?service=transferor HTTP/1.1" 200 193 "" "PycURL/7.45.7 libcurl/8.16.0-DEV OpenSSL/3.5.3 zlib/1.2.11 brotli/1.1.0 libssh2/1.11.1_DEV nghttp2/1.67.1"

This one even runs successfully on my setup!

Again, lets run it individually (only the failing one reported - testCampaignConfig) :

(WMAgent.venv3.ora) [cmst1@vocms0290 WMCore]$ ipython -i test/python/WMCore_t/ReqMgr_t/Service_t/Auxiliary_t.py
...
In [1]: auxiliaryTest = AuxiliaryTest()

In [2]: auxiliaryTest.setUp()
Installing ReqMgr app into database: http://127.0.0.1:5984/reqmgr_workload_cache
Installing ReqMgrAux app into database: http://127.0.0.1:5984/reqmgr_auxiliary
init root

In [3]: auxiliaryTest.testCampaignConfig()

Successful again!

While if we really want to see what is breaking for this unittest file, it is not the testCampaignConfig test. It is testPutUnifiedConfig:

In [1]: auxiliaryTest = AuxiliaryTest()

In [2]: auxiliaryTest.setUp()
Installing ReqMgr app into database: http://127.0.0.1:5984/reqmgr_workload_cache
Installing ReqMgrAux app into database: http://127.0.0.1:5984/reqmgr_auxiliary
init root

In [3]: auxiliaryTest.testPutUnifiedConfig()
---------------------------------------------------------------------------
HTTPException                             Traceback (most recent call last)
Cell In[3], line 1
----> 1 auxiliaryTest.testPutUnifiedConfig()

File /data/WMAgent.venv3.ora/srv/WMCore/test/python/WMCore_t/ReqMgr_t/Service_t/Auxiliary_t.py:180, in AuxiliaryTest.testPutUnifiedConfig(self)
    178 docName = "uni1"
    179 myDoc = {"key2": ["blah"], "key3": True}
--> 180 res = self.jsonSender.put("data/unifiedconfig/%s" % docName, myDoc)
    181 self.assertTrue(res)
    183 res = self.jsonSender.get("data/unifiedconfig/%s" % docName)

File /data/WMAgent.venv3.ora/srv/WMCore/src/python/WMCore/Services/Requests.py:162, in Requests.put(self, uri, data, incoming_headers, encode, decode, contentType)
    157 def put(self, uri=None, data={}, incoming_headers={},
    158         encode=True, decode=True, contentType=None):
    159     """
    160     PUT some data
    161     """
--> 162     return self.makeRequest(uri, data, 'PUT', incoming_headers,
    163                             encode, decode, contentType)

File /data/WMAgent.venv3.ora/srv/WMCore/src/python/WMCore/Services/Requests.py:185, in Requests.makeRequest(self, uri, data, verb, incoming_headers, encoder, decoder, contentType)
    183 uri = self['host'] + uri
    184 if self.pycurl:
--> 185     result, response = self.makeRequest_pycurl(uri, data, verb, headers)
    186 else:
    187     result, response = self.makeRequest_httplib(uri, data, verb, headers)

File /data/WMAgent.venv3.ora/srv/WMCore/src/python/WMCore/Services/Requests.py:202, in Requests.makeRequest_pycurl(self, uri, data, verb, headers)
    198 capath = self.getCAPath()
    200 headers["Accept-Encoding"] = "gzip,deflate,identity"
--> 202 response, result = self.reqmgr.request(uri, data, headers, verb=verb,
    203                                        ckey=ckey, cert=cert, capath=capath)
    204 return result, response

File /data/WMAgent.venv3.ora/srv/WMCore/src/python/Utils/PortForward.py:68, in portForward.<locals>.portForwardDecorator.<locals>.portMangle(callObj, url, *args, **kwargs)
     66     return callFunc(callObj, newUrl, *args, **kwargs)
     67 else:
---> 68     return callFunc(callObj, url, *args, **kwargs)

File /data/WMAgent.venv3.ora/srv/WMCore/src/python/WMCore/Services/pycurl_manager.py:353, in RequestHandler.request(self, url, params, headers, verb, verbose, ckey, cert, capath, doseq, encode, decode, cainfo, cookie)
    351     bbuf.flush()
    352     hbuf.flush()
--> 353     raise exc
    355 bbuf.flush()
    356 hbuf.flush()

HTTPException: url=http://127.0.0.1:9988/reqmgr2/data/unifiedconfig/uni1, code=400, reason=Bad Request, headers={'Content-Type': 'text/html;charset=utf-8', 'Server': 'CherryPy/18.10.0', 'Date': 'Thu, 09 Oct 2025 07:29:01 GMT', 'X-Rest-Status': '1202', 'X-Error-Http': '400', 'X-Error-Id': '008e774d1fab2091a84cc378ee3b7606', 'X-Error-Detail': "Unified schema error. It is missing some of the required parameters: {'tiers_to_DDM', 'tiers_no_DDM', 'tiers_with_no_custodial'}", 'X-Rest-Time': '500.917 us', 'Content-Length': '2805'}, result=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>Unified schema error. It is missing some of the required parameters: {\'tiers_to_DDM\', \'tiers_no_DDM\', \'tiers_with_no_custodial\'}</p>\n        <pre id="traceback">Traceback (most recent call last):\n  File "/data/WMAgent.venv3.ora/srv/WMCore/src/python/WMCore/REST/Server.py", line 749, in default\n    return self._call(RESTArgs(list(args), kwargs))\n  File "/data/WMAgent.venv3.ora/srv/WMCore/src/python/WMCore/REST/Server.py", line 828, in _call\n    v(apiobj, request.method, api, param, safe)\n  File "/data/WMAgent.venv3.ora/srv/WMCore/src/python/WMCore/ReqMgr/Service/Auxiliary.py", line 160, in validate\n    raise InvalidUnifiedSchema(str(exc)) from None\nWMCore.REST.Error.InvalidUnifiedSchema: InvalidUnifiedSchema 008e774d1fab2091a84cc378ee3b7606 [HTTP 400, APP 1202, MSG "Unified schema error. It is missing some of the required parameters: {\'tiers_to_DDM\', \'tiers_no_DDM\', \'tiers_with_no_custodial\'}", INFO None, ERR None]\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File "/data/WMAgent.venv3.ora/lib64/python3.9/site-packages/cherrypy/_cprequest.py", line 659, in respond\n    self._do_respond(path_info)\n  File "/data/WMAgent.venv3.ora/lib64/python3.9/site-packages/cherrypy/_cprequest.py", line 718, in _do_respond\n    response.body = self.handler()\n  File "/data/WMAgent.venv3.ora/lib64/python3.9/site-packages/cherrypy/lib/encoding.py", line 223, in __call__\n    self.body = self.oldhandler(*args, **kwargs)\n  File "/data/WMAgent.venv3.ora/lib64/python3.9/site-packages/cherrypy/_cpdispatch.py", line 54, in __call__\n    return self.callable(*self.args, **self.kwargs)\n  File "/data/WMAgent.venv3.ora/srv/WMCore/src/python/WMCore/REST/Server.py", line 755, in default\n    report_rest_error(e, format_exc(), True)\n  File "/data/WMAgent.venv3.ora/srv/WMCore/src/python/WMCore/REST/Error.py", line 310, in report_rest_error\n    if throw: raise cherrypy.HTTPError(err.http_code, err.message)\ncherrypy._cperror.HTTPError: (400, "Unified schema error. It is missing some of the required parameters: {\'tiers_to_DDM\', \'tiers_no_DDM\', \'tiers_with_no_custodial\'}")\n</pre>\n    <div id="powered_by">\n      <span>\n        Powered by <a href="http://www.cherrypy.dev">CherryPy 18.10.0</a>\n      </span>\n    </div>\n    </body>\n</html>\n'

Which is an Http error, and has nothing to do with the current code change

@amaltaro
Copy link
Contributor

amaltaro commented Oct 9, 2025

test this please

@dmwm-bot
Copy link

dmwm-bot commented Oct 9, 2025

Jenkins results:

  • Python3 Unit tests: failed
    • 3 new failures
    • 2 changes in unstable tests
  • Python3 Pylint check: succeeded
    • 23 comments to review
  • Pycodestyle check: succeeded
    • 11 comments to review

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

@amaltaro
Copy link
Contributor

test this please

@amaltaro
Copy link
Contributor

And now the same 3 unittests are also failing in the baseline tests, as can be seen in this report:
https://cmssdt.cern.ch/dmwm-jenkins/view/WMCore%20Docker/job/WMCore-Aggregate-Baseline/lastBuild/

I don't think any of them are related to these changes, but the testProcessThreadsInfo was probably overlooked either by Valentin's or Todor's recent developments on component/thread monitoring.

@amaltaro
Copy link
Contributor

test this please

@dmwm-bot
Copy link

Jenkins results:

  • Python3 Unit tests: succeeded
    • 1 changes in unstable tests
  • Python3 Pylint check: succeeded
    • 23 comments to review
  • Pycodestyle check: succeeded
    • 11 comments to review

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

@amaltaro amaltaro merged commit 42a2277 into dmwm:master Oct 13, 2025
3 checks passed
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.

Migrate from cx_Oracle to python-oracledb package

4 participants