Skip to content

Bad refactoring lead to client needing DB access #8218

@chaen

Description

@chaen

The error below is due to #8192

$ dirac-admin-allow-se --AllowRemove Tier1-Archive
Traceback (most recent call last):
  File "/home/chaen/dirac/diracx-project/lhcbdiracx/.pixi/envs/default/bin/dirac-admin-allow-se", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/chaen/dirac/DIRAC/src/DIRAC/Core/Base/Script.py", line 74, in __call__
    return entrypointFunc._func()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chaen/dirac/DIRAC/src/DIRAC/DataManagementSystem/scripts/dirac_admin_allow_se.py", line 62, in main
    from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin
  File "/home/chaen/dirac/DIRAC/src/DIRAC/Interfaces/API/DiracAdmin.py", line 22, in <module>
    from DIRAC.WorkloadManagementSystem.Service.WMSUtilities import (
  File "/home/chaen/dirac/DIRAC/src/DIRAC/WorkloadManagementSystem/Service/WMSUtilities.py", line 15, in <module>
    from DIRAC.Resources.Computing.ComputingElementFactory import ComputingElementFactory
  File "/home/chaen/dirac/DIRAC/src/DIRAC/Resources/Computing/ComputingElementFactory.py", line 5, in <module>
    from DIRAC.Resources.Computing.ComputingElement import getCEConfigDict
  File "/home/chaen/dirac/DIRAC/src/DIRAC/Resources/Computing/ComputingElement.py", line 50, in <module>
    from DIRAC.WorkloadManagementSystem.Utilities.JobParameters import (
  File "/home/chaen/dirac/DIRAC/src/DIRAC/WorkloadManagementSystem/Utilities/JobParameters.py", line 7, in <module>
    from DIRAC.WorkloadManagementSystem.DB.JobDB import JobDB
  File "/home/chaen/dirac/DIRAC/src/DIRAC/WorkloadManagementSystem/DB/JobDB.py", line 22, in <module>
    from DIRAC.Core.Base.DB import DB
  File "/home/chaen/dirac/DIRAC/src/DIRAC/Core/Base/DB.py", line 5, in <module>
    from DIRAC.Core.Utilities.MySQL import MySQL
  File "/home/chaen/dirac/DIRAC/src/DIRAC/Core/Utilities/MySQL.py", line 156, in <module>
    import MySQLdb
ModuleNotFoundError: No module named 'MySQLdb'

Moving a DB import into a utility which is used a lot client side is not a good thing.
I've temporarily fixed it with #8217 but probably a better overhaul is needed

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions