From 88fba0fdb08844183ca4f6ffc7ea1ff0f6b76a70 Mon Sep 17 00:00:00 2001 From: Guillaume Raffy Date: Thu, 8 Jun 2023 11:18:07 +0200 Subject: [PATCH] fixed regression from commit 270304f58efec336902225b9baa4261a4894effc - this bug was found when working on Bug 3575 - la page physix status renvoit internal server error - in order to ease the detection of such regressions, added a unittest that covers this code --- cocluto/SunGridEngine/SgeConfig.py | 2 +- test/qconf-se-physix71.stdout | 40 ++++++++++++++++++++++++++++++ test/test_cocluto.py | 9 ++++++- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 test/qconf-se-physix71.stdout diff --git a/cocluto/SunGridEngine/SgeConfig.py b/cocluto/SunGridEngine/SgeConfig.py index d0cff68..88379cf 100755 --- a/cocluto/SunGridEngine/SgeConfig.py +++ b/cocluto/SunGridEngine/SgeConfig.py @@ -53,7 +53,7 @@ class SgeConfig: for strAttrDef in strSgeConfigString.split("\n"): # print("strAttrDef=%s" % strAttrDef) if len(strAttrDef) != 0: - matchObj = re.match(r"^(?P[^\s]+)[]+(?P[^\s].*)$", strAttrDef) + matchObj = re.match(r"^(?P[^\s]+)[ ]+(?P[^\s].*)$", strAttrDef) assert matchObj is not None # print('%s = %s\n' % (matchObj.group("attrName"), matchObj.group("attrValue"))) self.m_attrs[matchObj.group("attrName")] = matchObj.group("attrValue") diff --git a/test/qconf-se-physix71.stdout b/test/qconf-se-physix71.stdout new file mode 100644 index 0000000..b734fea --- /dev/null +++ b/test/qconf-se-physix71.stdout @@ -0,0 +1,40 @@ +hostname physix71.ipr.univ-rennes1.fr +load_scaling NONE +complex_values pelicans_version=-1.000000,openfoam_version=2.003000, \ + julia_version=1.005001,dsmcmodfoam_version=-1.000000, \ + quantumespresso_version=-1.000000,vasp_version=5.003003, \ + r_version=3.002003,liggghts_version=3.005000, \ + hibricol_version=1.000005,abinit_version=8.010003, \ + meep_version=1.003000,mem_available=67501117440, \ + gpaw_version=1.004000, \ + dielectricproperties_version=4.006005, \ + lammps_version=2019.008007,molpro_version=2015.001000, \ + slots=16,magma_version=2.005004, \ + suitesparse_version=1.004000,ls-dyna_version=-1.000000, \ + vasp_so_version=5.003003,operating_system=debian_9.13, \ + mess_version=-1.000000,arpack_version=-1.000000, \ + optifdtd_version=11.000000,gaussian_version=16.001003, \ + matlab_version=7.013000,cuda_devices=0 +load_values arch=lx-amd64,num_proc=16,mem_total=64374.082031M, \ + swap_total=31247.996094M,virtual_total=95622.078125M, \ + m_topology=SCCCCCCCCSCCCCCCCC,m_socket=2,m_core=16, \ + m_thread=16,load_avg=9.030000,load_short=9.010000, \ + load_medium=9.030000,load_long=9.000000, \ + mem_free=60332.898438M,swap_free=31178.839844M, \ + virtual_free=91511.738281M,mem_used=4041.183594M, \ + swap_used=69.156250M,virtual_used=4110.339844M, \ + cpu=56.400000,m_topology_inuse=SCCCCCCCCSCCCCCCCC, \ + cpu_features=fpu:vme:de:pse:tsc:msr:pae:mce:cx8:apic:sep:mtrr:pge:mca:cmov:pat:pse36:clflush:dts:acpi:mmx:fxsr:sse:sse2:ss:ht:tm:pbe:syscall:nx:pdpe1gb:rdtscp:lm:constant_tsc:arch_perfmon:pebs:bts:rep_good:nopl:xtopology:nonstop_tsc:aperfmperf:pni:pclmulqdq:dtes64:monitor:ds_cpl:vmx:smx:est:tm2:ssse3:cx16:xtpr:pdcm:pcid:dca:sse4_1:sse4_2:x2apic:popcnt:tsc_deadline_timer:aes:xsave:avx:lahf_lm:epb:kaiser:tpr_shadow:vnmi:flexpriority:ept:vpid:xsaveopt:dtherm:ida:arat:pln:pts, \ + installed_python_packages=;python-appdirs;python-apptools;python-apt;python-apt-common;python-ase;python-attr;python-autobahn;python-backports-shutil-get-terminal-size;python-cbor;python-cffi;python-cffi-backend;python-concurrent.futures;python-configobj;python-configparser;python-constantly;python-cryptography;python-cycler;python-dateutil;python-decorator;python-dev;python-enum34;python-envisage;python-functools32;python-future;python-h5py;python-httplib2;python-idna;python-incremental;python-ipaddress;python-ipython;python-ipython-genutils;python-lz4;python-mako;python-markupsafe;python-matplotlib;python-matplotlib-data;python-minimal;python-mpi4py;python-mpmath;python-msgpack;python-nacl;python-networkx;python-numpy;python-openssl;python-packaging;python-pathlib2;python-pexpect;python-pickleshare;python-pil:amd64;python-pip;python-pip-whl;python-pkg-resources;python-ply;python-prompt-toolkit;python-ptyprocess;python-pyasn1;python-pyasn1-modules;python-pycparser;python-pycuda;python-pycurl;python-pyface;python-pygments;python-pyparsing;python-pytools;python-qrcode;python-qt4;python-scipy;python-service-identity;python-setuptools;python-simplegeneric;python-sip;python-six;python-snappy;python-sss;python-subprocess32;python-sympy;python-talloc;python-tk;python-traitlets;python-traits;python-traitsui;python-trollius;python-twisted;python-twisted-bin:amd64;python-twisted-core;python-txaio;python-tz;python-virtualenv;python-vtk6;python-wcwidth;python-wheel;python-wxgtk3.0;python-wxversion;python-zope.interface;, \ + installed_python3_packages=;python3-appdirs;python3-apt;python3-cycler;python3-dateutil;python3-decorator;python3-dev;python3-future;python3-h5py;python3-httplib2;python3-ipython;python3-ipython-genutils;python3-mako;python3-markupsafe;python3-matplotlib;python3-minimal;python3-mpi4py;python3-mpmath;python3-networkx;python3-numpy;python3-packaging;python3-pexpect;python3-pickleshare;python3-pip;python3-pkg-resources;python3-prompt-toolkit;python3-ptyprocess;python3-pycuda;python3-pycurl;python3-pygments;python3-pyparsing;python3-pytools;python3-scipy;python3-setuptools;python3-simplegeneric;python3-six;python3-sympy;python3-tk:amd64;python3-traitlets;python3-tz;python3-venv;python3-virtualenv;python3-wcwidth;python3-wheel;, \ + installed_packages=;gnuplot-data;gnuplot-x11;libsdl1.2-dev;libsdl1.2debian:amd64;libsdl2-2.0-0:amd64;, \ + env_modules=:compilers/ifort/12.0.3:compilers/ifort/15.0.2:compilers/ifort/17.0.1:compilers/ifort/18.0.1:compilers/ifort/19.0.3:compilers/ifort/19.1.1:lib/cuda/9.1.85:lib/maths/magma/2.1.0:lib/maths/magma/2.5.4:lib/maths/suitesparse/5.4.0:lib/mkl/10.3.3:lib/mkl/11.2.2:lib/mkl/2017.0.1:lib/mkl/2018.0.1:lib/mkl/2019.0.3:lib/mkl/2020.0.1:lib/mpi/intelmpi/2017.0.1:lib/mpi/intelmpi/2018.0.1:lib/mpi/intelmpi/2019.0.3:lib/mpi/intelmpi/2019.0.7:lib/mpi/intelmpi/4.0.1:lib/mpi/intelmpi/5.0.1:lib/mpi/openmpi/bin/4.0.0:lib/mpi/openmpi/dev/4.0.0:programming/julia/1.2.0:programming/julia/1.5.1:science/comsol/5.6:science/dft/abinit/8.10.3:science/dft/dielectricproperties/4.6.5:science/dft/gpaw/1.4.0:science/gaussian/16.1.3:science/gaussian/ifort/16.1.3:science/gaussrate/17.2.0:science/hibricol/1.0.2:science/hibricol/1.0.3:science/hibricol/1.0.5:science/lammps/2019.8.7:science/ls-dyna/11.1.0:, \ + np_load_avg=0.564375,np_load_short=0.563125, \ + np_load_medium=0.564375,np_load_long=0.562500 +processors 16 +user_lists NONE +xuser_lists NONE +projects NONE +xprojects NONE +usage_scaling NONE +report_variables NONE diff --git a/test/test_cocluto.py b/test/test_cocluto.py index 5b9b94d..acfe1bc 100644 --- a/test/test_cocluto.py +++ b/test/test_cocluto.py @@ -3,6 +3,7 @@ import logging # from cocluto import ClusterController from cocluto.ClusterController.QstatParser import QstatParser from cocluto.ClusterController.JobsState import JobsState +from cocluto.SunGridEngine.SgeConfig import SgeConfig class CoclutoTestCase(unittest.TestCase): @@ -22,7 +23,13 @@ class CoclutoTestCase(unittest.TestCase): job_state = qstatParser.parseQstatOutput(qstat_output) self.assertIsInstance(job_state, JobsState) - # self.assertEqual(rv.status, '200 OK') + + def test_sgeformat1_parser(self): + logging.info('test_sgeformat1_parser') + with open('test/qconf-se-physix71.stdout', 'rt') as f: + qconf_output = f.read() + exec_host_attrs = SgeConfig() + exec_host_attrs.loadFromSgeFormat1String(qconf_output) if __name__ == '__main__':