Skip to content

update_inclusive_columns fails with AttributeError #106

@ilumsden

Description

@ilumsden

When running update_inclusive_columns on various datasets with a row MultiIndex, the function errors with an AttributeError. I originally discovered this while testing profiles associated with DYAD. I've managed to reproduce using HPCToolkit data in the Hatchet unit tests, but I'm not sure if HPCToolkit is still supported due to changes in the database format. So, I've attached the Caliper file from my DYAD testing. Because of GitHub requirements, I had to convert the file to a .txt file. It can be converted back into a .cali file by just changing the file extension. The code to reproduce is simply:

import hatchet as ht
gf = ht.GraphFrame.from_caliperreader("cons.cali")
gf.update_inclusive_columns()

On Corona, this fails with the following traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/WS2/lumsden1/hatchet/hatchet/graphframe.py", line 883, in update_inclusive_columns
    self.subgraph_sum(self.exc_metrics, self.inc_metrics)
  File "/usr/WS2/lumsden1/hatchet/hatchet/graphframe.py", line 725, in subgraph_sum
    self.subtree_sum(columns, out_columns, function)
  File "/usr/WS2/lumsden1/hatchet/hatchet/graphframe.py", line 694, in subtree_sum
    self.dataframe.loc[df_index1, col] = function(
  File "/collab/usr/gapps/python/build/spack-toss4.2/var/spack/environments/python310/._view/i74j3perqsso644fvgbrjnzhyuvpn42l/lib/python3.10/site-packages/pandas/core/indexing.py", line 814, in __setitem__
    indexer = self._get_setitem_indexer(key)
  File "/collab/usr/gapps/python/build/spack-toss4.2/var/spack/environments/python310/._view/i74j3perqsso644fvgbrjnzhyuvpn42l/lib/python3.10/site-packages/pandas/core/indexing.py", line 692, in _get_setitem_indexer
    return ax.get_loc(key)
  File "/collab/usr/gapps/python/build/spack-toss4.2/var/spack/environments/python310/._view/i74j3perqsso644fvgbrjnzhyuvpn42l/lib/python3.10/site-packages/pandas/core/indexes/multi.py", line 2945, in get_loc
    start, stop = self.slice_locs(lead_key, lead_key)
  File "/collab/usr/gapps/python/build/spack-toss4.2/var/spack/environments/python310/._view/i74j3perqsso644fvgbrjnzhyuvpn42l/lib/python3.10/site-packages/pandas/core/indexes/multi.py", line 2775, in slice_locs
    return super().slice_locs(start, end, step)
  File "/collab/usr/gapps/python/build/spack-toss4.2/var/spack/environments/python310/._view/i74j3perqsso644fvgbrjnzhyuvpn42l/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 6810, in slice_locs
    start_slice = self.get_slice_bound(start, "left")
  File "/collab/usr/gapps/python/build/spack-toss4.2/var/spack/environments/python310/._view/i74j3perqsso644fvgbrjnzhyuvpn42l/lib/python3.10/site-packages/pandas/core/indexes/multi.py", line 2714, in get_slice_bound
    return self._partial_tup_index(label, side=side)
  File "/collab/usr/gapps/python/build/spack-toss4.2/var/spack/environments/python310/._view/i74j3perqsso644fvgbrjnzhyuvpn42l/lib/python3.10/site-packages/pandas/core/indexes/multi.py", line 2793, in _partial_tup_index
    loc = algos.searchsorted(lev, lab, side=side)
  File "/collab/usr/gapps/python/build/spack-toss4.2/var/spack/environments/python310/._view/i74j3perqsso644fvgbrjnzhyuvpn42l/lib/python3.10/site-packages/pandas/core/algorithms.py", line 1665, in searchsorted
    return arr.searchsorted(value, side=side, sorter=sorter)  # type: ignore[arg-type]
  File "/collab/usr/gapps/python/build/spack-toss4.2/var/spack/environments/python310/._view/i74j3perqsso644fvgbrjnzhyuvpn42l/lib/python3.10/site-packages/pandas/core/base.py", line 1298, in searchsorted
    return algorithms.searchsorted(
  File "/collab/usr/gapps/python/build/spack-toss4.2/var/spack/environments/python310/._view/i74j3perqsso644fvgbrjnzhyuvpn42l/lib/python3.10/site-packages/pandas/core/algorithms.py", line 1665, in searchsorted
    return arr.searchsorted(value, side=side, sorter=sorter)  # type: ignore[arg-type]
  File "/usr/WS2/lumsden1/hatchet/hatchet/node.py", line 197, in __lt__
    return self._hatchet_nid < other._hatchet_nid
AttributeError: 'int' object has no attribute '_hatchet_nid'

cons.txt

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