llnl / llnl/hatchet

Cannot process simple Caliper sampling file

Open
#162 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
37
Forks
21
PR merge metrics
No merged PRs in 30d

Description

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'})

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the from_caliperreader call in the supplied script and trace how the attached sample_profile.cali file becomes a GraphFrame. Then inspect GraphFrame.tree() and the console renderer at the traceback's external/console.py entry point. Done means the sample profile can be loaded and its tree rendered without the reported KeyError.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.