Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build_call_graph shows 'NoneType' object has no attribute 'value' #6585

Open
superstar54 opened this issue Oct 21, 2024 · 1 comment
Open

Comments

@superstar54
Copy link
Member

superstar54 commented Oct 21, 2024

Steps to reproduce

from aiida.cmdline.utils.ascii_vis import build_call_graph

I called build_call_graph every three seconds to get the status of a process. This is used to update the GUI in AiiDAlab.

At some point (in rare case, randomly), I got this error:

    process_status = build_call_graph(node)
                     ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/aiida/cmdline/utils/ascii_vis.py", line 96, in build_call_graph
    return info_string, [
                        ^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/aiida/cmdline/utils/ascii_vis.py", line 97, in <listcomp>
    build_call_graph(c, max_depth=max_depth, call_link_label=call_link_label, info_fn=info_fn) for c in called
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/aiida/cmdline/utils/ascii_vis.py", line 96, in build_call_graph
    return info_string, [
                        ^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/aiida/cmdline/utils/ascii_vis.py", line 97, in <listcomp>
    build_call_graph(c, max_depth=max_depth, call_link_label=call_link_label, info_fn=info_fn) for c in called
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/aiida/cmdline/utils/ascii_vis.py", line 96, in build_call_graph
    return info_string, [
                        ^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/aiida/cmdline/utils/ascii_vis.py", line 97, in <listcomp>
    build_call_graph(c, max_depth=max_depth, call_link_label=call_link_label, info_fn=info_fn) for c in called
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/aiida/cmdline/utils/ascii_vis.py", line 96, in build_call_graph
    return info_string, [
                        ^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/aiida/cmdline/utils/ascii_vis.py", line 97, in <listcomp>
    build_call_graph(c, max_depth=max_depth, call_link_label=call_link_label, info_fn=info_fn) for c in called
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/aiida/cmdline/utils/ascii_vis.py", line 90, in build_call_graph
    info_string = info_fn(calc_node, call_link_label)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xing/apps/miniforge3/envs/aiida/lib/python3.11/site-packages/aiida/cmdline/utils/ascii_vis.py", line 32, in calc_info
    process_state = node.process_state.value.capitalize()
                    ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'value'
@agoscinski
Copy link
Contributor

agoscinski commented Oct 21, 2024

The process_state can be None

def process_state(self) -> Optional[ProcessState]:
so the function
process_state = node.process_state.value.capitalize()
should handle this case. That is the easy fix to not let it crash.

The harder fix is to figure out why the process_state is None. The only entry point I know for creating a process is when they are run or submitted, but in this case they should be directly in state Created, after that the process state is never set to None AFAIK. If no one has an idea we can first implement the above fix. When the application does not crash, we might get more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants