jpgxs / python-sadf

Parse sysstat (sa/sar) output into Pandas Dataframes
Apache License 2.0
9 stars 5 forks source link

Shape of passed values vs indices imply #5

Open MysticRyuujin opened 4 years ago

MysticRyuujin commented 4 years ago

code:

import sadf
from sadf import fieldgroups as fg
cmd = sadf.SadfCommand()
cmd.field_groups = [ fg.Network(dev=True) ]
report = cmd.run()

Error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/pandas/core/internals/managers.py", line 1671, in create_block_manager_from_arrays
    mgr = BlockManager(blocks, axes)
  File "/usr/local/lib/python3.8/dist-packages/pandas/core/internals/managers.py", line 139, in __init__
    self._verify_integrity()
  File "/usr/local/lib/python3.8/dist-packages/pandas/core/internals/managers.py", line 334, in _verify_integrity
    construction_error(tot_items, block.shape[1:], self.axes)
  File "/usr/local/lib/python3.8/dist-packages/pandas/core/internals/managers.py", line 1694, in construction_error
    raise ValueError(f"Shape of passed values is {passed}, indices imply {implied}")
ValueError: Shape of passed values is (9, 8), indices imply (27, 8)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/dist-packages/sadf/__init__.py", line 149, in run
    return SadfReport(host, self.field_groups)
  File "/usr/local/lib/python3.8/dist-packages/sadf/__init__.py", line 52, in __init__
    self.reports = self._make_reports()
  File "/usr/local/lib/python3.8/dist-packages/sadf/__init__.py", line 64, in _make_reports
    return {
  File "/usr/local/lib/python3.8/dist-packages/sadf/__init__.py", line 65, in <dictcomp>
    group._label: group.to_report(index)
  File "/usr/local/lib/python3.8/dist-packages/sadf/fieldgroups.py", line 206, in to_report
    return {
  File "/usr/local/lib/python3.8/dist-packages/sadf/fieldgroups.py", line 207, in <dictcomp>
    g._label: g.to_report(index)
  File "/usr/local/lib/python3.8/dist-packages/sadf/fieldgroups.py", line 145, in to_report
    return {
  File "/usr/local/lib/python3.8/dist-packages/sadf/fieldgroups.py", line 146, in <dictcomp>
    iface: pd.DataFrame(data, columns=self.columns, index=index)
  File "/usr/local/lib/python3.8/dist-packages/pandas/core/frame.py", line 486, in __init__
    mgr = arrays_to_mgr(arrays, columns, index, columns, dtype=dtype)
  File "/usr/local/lib/python3.8/dist-packages/pandas/core/internals/construction.py", line 74, in arrays_to_mgr
    return create_block_manager_from_arrays(arrays, arr_names, axes)
  File "/usr/local/lib/python3.8/dist-packages/pandas/core/internals/managers.py", line 1675, in create_block_manager_from_arrays
    construction_error(len(arrays), arrays[0].shape, axes, e)
  File "/usr/local/lib/python3.8/dist-packages/pandas/core/internals/managers.py", line 1694, in construction_error
    raise ValueError(f"Shape of passed values is {passed}, indices imply {implied}")
ValueError: Shape of passed values is (9, 8), indices imply (27, 8)

Output of sar -n DEV network.sar.output.txt

MysticRyuujin commented 4 years ago

Clearing my sar stats completely is a workaround 🤷‍♂️

MysticRyuujin commented 4 years ago

After more research, I think this is due to the way docker is creating network interfaces, I'm guessing the dynamic nature of the interfaces being created/removed is the problem...