Ask Your Question

Even in debug mode, wing still fails to give the completion suggestions for aiida.

asked 2020-04-17 10:11:03 -0500

hongyi-zhao gravatar image

updated 2020-04-21 14:58:31 -0500


Today, I meet a very strange thing. Several days ago, I told that wing can do runtime completion for me but today I find that it fails to do that thing.

See the following minimal example code:

from aiida import load_profile

# * pk 17 - q-e.git-pw@localhost
codename = 'q-e.git-pw@localhost'
from aiida.orm import Code, load_node
from aiida.plugins import CalculationFactory

code = Code.get_from_string(codename)
# code = Code.get(label='q-e.git-pw', machinename='localhost')
# code = load_node(17)

PwCalculation = CalculationFactory('')
builder = PwCalculation.get_builder()

If I put cursor at the last line and debug to that line. Then I check the runtime completion with:


It gives nothing.


edit retag flag offensive close merge delete


Please provide a working example we can try here. The above doesn't work on its own because load_profile() fails and if I comment out that and the call to Code.get_from_string then it fails because I don't have entry point

Wingware Support gravatar imageWingware Support ( 2020-04-17 10:26:55 -0500 )edit

3 Answers

Sort by » oldest newest most voted

answered 2020-04-21 14:58:10 -0500

This was a bug in Wing's runtime inspection code that led to not including attributes of a class if it descends from a class that has a metaclass. It will be fixed in update Thanks for providing the test case!

edit flag offensive delete link more

answered 2020-04-17 18:04:40 -0500

hongyi-zhao gravatar image

updated 2020-04-19 09:40:38 -0500


The environment setting-up for aiida's code and computer is not so easy and intuitive for user who doesn't familiar with solid state physics and HPC.

Could you please instead download and use the ready-to-use ova image for virtualbox to do test here:

The ova image is ubuntu based and with all needed components pre-configed, so easy to do the things we disccussed here.

If you do so, use the following steps after imported the ova into virtualbox and stared it:

# activate the virtualenv to see the python interpreter's location
# and set that python in the wing
$ workon aiida
$ which python

Then use the following code to do the test:

from aiida import load_profile
from aiida.plugins import CalculationFactory

PwCalculation = CalculationFactory('')
builder = PwCalculation.get_builder()


edit flag offensive delete link more


What does dir(PwCalculation) return if typed before the last line? Does it include get_builder?

Wingware Support gravatar imageWingware Support ( 2020-04-20 08:31:33 -0500 )edit

OK, thanks, will try to get to this today to see what is going on.

Wingware Support gravatar imageWingware Support ( 2020-04-21 09:37:22 -0500 )edit

I've replicated the bug now. However, dir(PwCalculation) is correct for me in the Python Shell and debugger. The issue seems to be that our introspection engine is missing some of those items. This may be due to how we probe things very carefully to avoid crashing, but enabling more aggressive probing also doesn't solve it so I think it's a bug.

Wingware Support gravatar imageWingware Support ( 2020-04-21 11:17:53 -0500 )edit

BTW, the out-of-the-box configuration on the ova image above was terrible slow. Shutting it down and increasing its memory to 4GB solved that for me. Not sure if this is part of the reason you asked about performance of analysis in the past but thought I would mention it. From looking at memory usage, it was definitely thrashing.

Wingware Support gravatar imageWingware Support ( 2020-04-21 11:19:03 -0500 )edit

No, just for this bug report, for your convenience, I suggest you use the ova image for debugging. I myself use a real Ubuntu for my jobs instead of virtual machine based virtualenv.


hongyi-zhao gravatar imagehongyi-zhao ( 2020-04-21 20:17:21 -0500 )edit

answered 2020-04-20 09:56:53 -0500

hongyi-zhao gravatar image

In wing, if run the script with print(dir(PwCalculation)) before the last line, it will give the same result as the ones obtained in ipython. But if debug to the last line, will give very few completion info which doesn't including get_builder.

See the result in ipython which should also be obtained by the wing's debug mode:

(aiida-quantum-mobile) werner@ubuntu-01:~$ verdi shell 
Python 3.6.9 (default, Apr 11 2020, 22:07:08) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from aiida.plugins import CalculationFactory                            

In [2]: PwCalculation = CalculationFactory('')                

In [3]: dir(PwCalculation)                                                      

In [4]:
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-04-17 10:11:03 -0500

Seen: 215 times

Last updated: Apr 21