DIRACGrid / DIRAC

DIRAC Grid
http://diracgrid.org
GNU General Public License v3.0
113 stars 174 forks source link

[v8.0] fix (RSS): do not use timezone datetime #7761

Closed chaen closed 1 month ago

chaen commented 1 month ago

As deprecated as it may be, DIRAC does not support timezone, and still needs utcnow

2024-08-25 19:13:47 UTC ResourceStatus/CacheFeederAgent/ResourceStatus/CacheFeederAgent ERROR: Failed to execute command, with exception: FreeDiskSpace
Traceback (most recent call last):
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/ResourceStatusSystem/Agent/CacheFeederAgent.py", line 135, in execute
    results = commandObject.doCommand()
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/ResourceStatusSystem/Command/Command.py", line 47, in doCommand
    return self.returnSObj(self.doMaster())
                           ^^^^^^^^^^^^^^^
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/ResourceStatusSystem/Command/FreeDiskSpaceCommand.py", line 195, in doMaster
    return self._cleanCommand()
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/ResourceStatusSystem/Command/FreeDiskSpaceCommand.py", line 206, in _cleanCommand
    res = self.rmClient.selectSpaceTokenOccupancyCache(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/ResourceStatusSystem/Client/ResourceManagementClient.py", line 751, in selectSpaceTokenOccupancyCache
    return self._getRPC().select("SpaceTokenOccupancyCache", prepareDict(columnNames, columnValues))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/Core/DISET/RPCClient.py", line 36, in __call__
    return self.__doRPCFunc(self.__remoteFuncName, args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/Core/DISET/RPCClient.py", line 82, in __doRPC
    return self.__innerRPCClient.executeRPC(sFunctionName, args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/Core/DISET/private/InnerRPCClient.py", line 63, in executeRPC
    retVal = transport.sendData(S_OK(list(args)))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/Core/DISET/private/Transports/BaseTransport.py", line 164, in sendData
    sCodedData = MixedEncode.encode(uData)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/Core/Utilities/MixedEncode.py", line 17, in encode
    return DEncode.encode(inData)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/Core/Utilities/DEncode.py", line 515, in encode
    g_dEncodeFunctions[type(uObject)](uObject, eList)
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/Core/Utilities/DEncode.py", line 486, in encodeDict
    g_dEncodeFunctions[type(dValue[key])](dValue[key], eList)
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/Core/Utilities/DEncode.py", line 430, in encodeList
    g_dEncodeFunctions[type(uObject)](uObject, eList)
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/Core/Utilities/DEncode.py", line 486, in encodeDict
    g_dEncodeFunctions[type(dValue[key])](dValue[key], eList)
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/Core/Utilities/DEncode.py", line 486, in encodeDict
    g_dEncodeFunctions[type(dValue[key])](dValue[key], eList)
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/Core/Utilities/DEncode.py", line 430, in encodeList
    g_dEncodeFunctions[type(uObject)](uObject, eList)
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/Core/Utilities/DEncode.py", line 370, in encodeDateTime
    g_dEncodeFunctions[type(tDateTime)](tDateTime, eList)
  File "/opt/dirac/versions/v11.0.46-1723623328/Linux-x86_64/lib/python3.11/site-packages/DIRAC/Core/Utilities/DEncode.py", line 457, in encodeTuple
    g_dEncodeFunctions[type(uObject)](uObject, eList)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: <class 'datetime.timezone'>

it would be easy to add timezone support in DEncode, but we would run into way more issues, so I think it's just not worth it

BEGINRELEASENOTES

*RSS FIX: Do not use tinezone aware datetime

ENDRELEASENOTES

DIRACGridBot commented 1 month ago

Sweep summary

Sweep ran in https://github.com/DIRACGrid/DIRAC/actions/runs/10581412295

Successful: