Skip to content

Cannot process simple Caliper sampling file #162

@mkre

Description

@mkre

I created a Caliper sampling profile with
CALI_CONFIG=hatchet-sample-profile,source.function=true,source.location=true,source.module=true,sample.frequency=1000 ./a.out
using Caliper's cxx-example.cpp (see here).

The sampling output file is attached here: sample_profile.cali.txt
(I had to add .txt extension to be able to upload it.)

Next, I tried printing a tree of the recorded data using the following script (using from_caliperreader based on #161):

#! /usr/bin/env python3

import hatchet as ht

if __name__ == '__main__':
    gf = ht.GraphFrame.from_caliperreader('sample_profile.cali')
    print(gf.tree())

This resulted in the following error:

Traceback (most recent call last):
  File "/u/ydfb4q/.pyenv/versions/3.8.5/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 3653, in get_loc
    return self._engine.get_loc(casted_key)
  File "pandas/_libs/index.pyx", line 147, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 176, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 7080, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: Node({'name': 'main', 'type': 'function'})

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "./hatchet_test.py", line 9, in <module>
    print(gf.tree())
  File "/u/ydfb4q/.pyenv/versions/3.8.5/lib/python3.8/site-packages/hatchet/util/deprecated.py", line 14, in wrapper
    return f(*args, **kwargs)
  File "/u/ydfb4q/.pyenv/versions/3.8.5/lib/python3.8/site-packages/hatchet/graphframe.py", line 1050, in tree
    return ConsoleRenderer(unicode=unicode, color=color).render(
  File "/u/ydfb4q/.pyenv/versions/3.8.5/lib/python3.8/site-packages/hatchet/external/console.py", line 153, in render
    result += self.render_frame(root, dataframe)
  File "/u/ydfb4q/.pyenv/versions/3.8.5/lib/python3.8/site-packages/hatchet/external/console.py", line 264, in render_frame
    node_metric = dataframe.loc[df_index, self.primary_metric]
  File "/u/ydfb4q/.pyenv/versions/3.8.5/lib/python3.8/site-packages/pandas/core/indexing.py", line 1097, in __getitem__
    return self._getitem_tuple(key)
  File "/u/ydfb4q/.pyenv/versions/3.8.5/lib/python3.8/site-packages/pandas/core/indexing.py", line 1280, in _getitem_tuple
    return self._getitem_lowerdim(tup)
  File "/u/ydfb4q/.pyenv/versions/3.8.5/lib/python3.8/site-packages/pandas/core/indexing.py", line 1000, in _getitem_lowerdim
    section = self._getitem_axis(key, axis=i)
  File "/u/ydfb4q/.pyenv/versions/3.8.5/lib/python3.8/site-packages/pandas/core/indexing.py", line 1343, in _getitem_axis
    return self._get_label(key, axis=axis)
  File "/u/ydfb4q/.pyenv/versions/3.8.5/lib/python3.8/site-packages/pandas/core/indexing.py", line 1293, in _get_label
    return self.obj.xs(label, axis=axis)
  File "/u/ydfb4q/.pyenv/versions/3.8.5/lib/python3.8/site-packages/pandas/core/generic.py", line 4095, in xs
    loc = index.get_loc(key)
  File "/u/ydfb4q/.pyenv/versions/3.8.5/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 3655, in get_loc
    raise KeyError(key) from err
KeyError: Node({'name': 'main', 'type': 'function'})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions