Closed maxnoe closed 5 months ago
We are running tests with warnings turned into errors by default and this lead us to an unclosed file resource warning in the WMS:
Traceback (most recent call last): File "/home/dirac/diracos/lib/python3.11/site-packages/DIRAC/WorkloadManagementSystem/Client/SandboxStoreClient.py", line 163, in uploadFilesAsSandbox result = transferClient.sendFile(tmpFilePath, [f"{oMD5.hexdigest()}.tar.bz2", assignTo]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/LDSB.worp7w_b' mode='r' encoding='utf-8'> warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
using this simple test in a minimal dirac setup:
def test_job_submission(): from DIRAC.Interfaces.API.Dirac import Dirac from DIRAC.Interfaces.API.Job import Job dirac = Dirac() job = Job() job.setExecutable("echo", arguments="Hello world") job.setName("testjob") job.setDestination("CTAO.CI.de") res = dirac.submitJob(job) assert res["OK"] job_id = res["Value"] wait_for_status(dirac, job_id=job_id, status="Done", timeout=180)
Would you mind testing https://github.com/DIRACGrid/DIRAC/pull/7651 ?
Sure, will come back to you tomorrow
@fstagni Warning is gone with your fix, thanks a lot!
We are running tests with warnings turned into errors by default and this lead us to an unclosed file resource warning in the WMS:
using this simple test in a minimal dirac setup: