1. 31 Oct, 2023 1 commit
    • Kirill Smelkov's avatar
      promise/plugin/check_sdr_busy: Don't hardcode /dev/sdr0@0 · 60d1bc2c
      Kirill Smelkov authored
      Currently check_sdr_busy always checks /dev/sdr0 (via `-c 0`) and
      also implicitly DMA channel 0 as sdr_util help explains:
      
          ./sdr_util  -h
          ...
          -c device_num              select the device (default = all)
          -d channel_num             select the channel (default = 0)
      
      This works well for ORS, which always has only single SDR board.
      
      However for cases when there are either a) multiple SDR boards, or b)
      single CPRI board, the assumption is incorrect:
      
      - for multiple SDR boards we need to be able to specify /dev/sdrX
        instead of sdr0.
      
      - for the case of one CPRI boards, links to different Radio Units
        attached to different SFP ports are associated with different DMA
        channels, so to test e.g. whether RU1 is being used it is necessary to
        check e.g. sdr0@0, while for RU2 it is necessary to check sdr0@1.
      
        I explicitly verified that for CPRI case
      
        a) Amarisoft kernel driver allows /dev/sdrX associated with CPRI card
           to be opened multiple times simultaneously - up to the amount of SFP
           ports = # of DMA channels, and
      
        b) that only DMA channels / SFP ports actually being in use are
           reported as busy by sdr_util, while the other DMA channels / SFP
           ports are not reported as busy.
      
        I also verified that for regular SDR board (not CPRI) using -d 0 does
        not change any verification semantic as such SDR boards have only one
        DMA channel.
      
      -> As a preparatory step for multiRU work adjust check_sdr_busy promise
      to take SDR device number and DMA channel number as arguments instead of
      hardcoding sdr0@0.
      
      For now this change is accompanied by the following change in
      ors-amarisoft SR to keep it working as before:
      
          --- a/software/ors-amarisoft/instance-enb.jinja2.cfg
          +++ b/software/ors-amarisoft/instance-enb.jinja2.cfg
          @@ -615,6 +615,8 @@ name = ${:_buildout_section_name_}
           promise = check_sdr_busy
           config-testing = {{ slapparameter_dict.get("testing", False) }}
           config-sdr = {{ sdr }}
          +config-sdr_dev  = 0
          +config-dma_chan = 0
      
      (posted in slapos!1458)
      
      /cc @xavier_thompson, @Daetalus
      /reviewed-by @jhuge, @lu.xu
      /partly-reviewed-by @tomo
      /reviewed-on !125
      60d1bc2c
  2. 27 Oct, 2023 4 commits
    • Kirill Smelkov's avatar
      promis/plugin/check_free_disk_space: np.float -> float · 5c1d2f76
      Kirill Smelkov authored
      Running tests with recent numpy (1.26.0) yields the following:
      
          slapos.toolbox$ python -m unittest discover -v   -s slapos/test/promise/plugin/ -t . -k test_display_prediction
          ...
          Enable to display disk space predictions: True
          module 'numpy' has no attribute 'float'.
          `np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
          The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
              https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
          Traceback (most recent call last):
            File "/home/kirr/src/wendelin/slapos/slapos.core/slapos/grid/promise/generic.py", line 500, in run
              self.sense()
            File "/home/kirr/src/wendelin/slapos/slapos.toolbox/slapos/promise/plugin/check_free_disk_space.py", line 327, in sense
              disk_space_prediction_tuple = self.diskSpacePrediction(
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^
            File "/home/kirr/src/wendelin/slapos/slapos.toolbox/slapos/promise/plugin/check_free_disk_space.py", line 182, in diskSpacePrediction
              df = df.astype({'free': np.float})
                                      ^^^^^^^^
            File "/home/kirr/src/wendelin/venv/py3.venv/lib/python3.11/site-packages/numpy/__init__.py", line 324, in __getattr__
              raise AttributeError(__former_attrs__[attr])
          AttributeError: module 'numpy' has no attribute 'float'.
          `np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
          The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
              https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
          ERROR
      
      -> Replace np.float with float as the error says.
      
      /cc @Just1, @lu.xu, @jhuge, @tomo
      /reviewed-on !123
      5c1d2f76
    • Kirill Smelkov's avatar
      promis/plugin/check_free_disk_space: test: Fix unclosed file ResourceWarning · daf7820f
      Kirill Smelkov authored
      folder_disk_test.sql was opened to be read but was not closed:
      
          slapos.toolbox$ python -m unittest discover -v   -s slapos/test/promise/plugin/ -t . -k test_display_prediction
          test_display_prediction (slapos.test.promise.plugin.test_check_free_disk_space.testcheckfreediskspace.test_display_prediction) ...
          /usr/lib/python3.11/unittest/case.py:576: resourcewarning: unclosed file <_io.textiowrapper name='/home/kirr/src/wendelin/slapos/slapos.toolbox/slapos/test/promise/data/disktest.sql' mode='r' encoding='utf-8'>
            self.setup()
      
      /cc @Just1, @lu.xu, @jhuge, @tomo
      /reviewed-on !124
      daf7820f
    • Kirill Smelkov's avatar
      *: Compare integers by == or != instead of by `is` or `is not` · dfb32247
      Kirill Smelkov authored
      Same logic as in previous patch. Suggested by @jeorme in
      !122 (comment 193062) .
      
      /suggested-and-reviewed-by @jerome
      /reviewed-n !122
      dfb32247
    • Kirill Smelkov's avatar
      *: Compare strings by == or != instead of by `is` or `is not` · b1c4c044
      Kirill Smelkov authored
      In python `is` checks object identity, not content:
      
          In [1]: a = 'hello'
      
          In [2]: a += ' world'
      
          In [3]: b = 'hello world'
      
          In [4]: id(a)
          Out[4]: 139735676540976
      
          In [5]: id(b)
          Out[5]: 139735675829040
      
          In [6]: a is b              <-- NOTE
          Out[6]: False
      
          In [7]: a == b              <-- NOTE
          Out[7]: True
      
      So comparing strings by is is generally incorrect.
      
      -> Fix strings comparision to use == / != everywhere (at least in found
      places where string is compared wrt string literal)
      
      We already had similar fix in a8526f4e, but seems the story continues
      again.
      
      /cc @alain.takoudjou, @Just1, @lu.xu, @jhuge, @tomo
      /reviewed-by @jerome
      /reviewed-on !122
      b1c4c044
  3. 12 Oct, 2023 2 commits
  4. 11 Oct, 2023 4 commits
  5. 22 Sep, 2023 2 commits
  6. 21 Sep, 2023 4 commits
  7. 07 Aug, 2023 1 commit
  8. 15 Jun, 2023 1 commit
  9. 08 Jun, 2023 1 commit
  10. 16 May, 2023 3 commits
  11. 15 May, 2023 1 commit
  12. 31 Mar, 2023 1 commit
  13. 20 Mar, 2023 2 commits
  14. 09 Mar, 2023 13 commits