First time here? Check out the FAQ!
1

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

Hi,

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
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('quantumespresso.pw')
builder = PwCalculation.get_builder()

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

 PwCalculation.g<tab>

It gives nothing.

Regards

hongyi-zhao's avatar
547
hongyi-zhao
asked 2020-04-17 10:11:03 -0500
Wingware Support's avatar
4.1k
Wingware Support
updated 2020-04-21 14:58:31 -0500
edit flag offensive 0 remove flag close merge delete

Comments

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 quantumespresso.pw.

Wingware Support's avatar Wingware Support (2020-04-17 10:26:55 -0500) edit
add a comment see more comments

3 Answers

0

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('quantumespresso.pw')                

In [3]: dir(PwCalculation)                                                      
Out[3]: 
['CLASS_NAME',
 'SINGLE_OUTPUT_LINKNAME',
 'STATES',
 'SaveKeys',
 '_DATAFILE_XML_POST_6_2',
 '_DATAFILE_XML_PRE_6_2',
 '_DEFAULT_INPUT_FILE',
 '_DEFAULT_OUTPUT_FILE',
 '_ENVIRON_INPUT_FILE_NAME',
 '_OUTPUT_SUBFOLDER',
 '_PREFIX',
 '_PSEUDO_SUBFOLDER',
 '_STATES_MAP',
 '_StateMachine__ensure_built',
 '__abstractmethods__',
 '__class__',
 '__delattr__',
 '__dict__',
 '__dir__',
 '__doc__',
 '__eq__',
 '__format__',
 '__ge__',
 '__getattribute__',
 '__gt__',
 '__hash__',
 '__init__',
 '__init_subclass__',
 '__le__',
 '__lt__',
 '__module__',
 '__ne__',
 '__new__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__setattr__',
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 '__weakref__',
 '_abc_cache',
 '_abc_negative_cache',
 '_abc_negative_cache_version',
 '_abc_registry',
 '_auto_persist',
 '_automatic_namelists',
 '_blocked_keywords',
 '_cleanups',
 '_closed',
 '_create_and_setup_db_record',
 '_create_interrupt_action',
 '_create_state_instance',
 '_default_symlink_usage',
 '_default_verbosity',
 '_do_pause',
 '_ensure_persist_configured',
 '_ensure_state_class',
 '_enter_next_state',
 '_exit_current_state',
 '_fire_event',
 '_fire_state_event',
 '_flat_inputs',
 '_flat_outputs',
 '_flatten_inputs',
 '_flatten_outputs',
 '_generate_PWCPinputdata',
 '_get_class_name',
 '_get_create_meta',
 '_get_meta_type',
 '_get_namespace_list',
 '_get_value',
 '_if_pos',
 '_internal_retrieve_list',
 '_interrupt_action',
 '_killing',
 '_node_class',
 '_paused',
 '_pausing',
 '_persist_configured',
 '_process_scope',
 '_restart_copy_from',
 '_restart_copy_to',
 '_run_task',
 '_save_checkpoint',
 '_schedule_rpc',
 '_set_class_name',
 '_set_interrupt_action',
 '_set_interrupt_action_from_exception',
 '_set_meta_type',
 '_setup_db_record',
 '_setup_event_hooks',
 '_setup_inputs',
 '_setup_metadata',
 '_spec_class',
 '_stepping',
 '_transition_failing',
 '_transitioning',
 '_use_kpoints',
 'add_cleanup',
 'add_process_listener',
 'add_state_event_callback',
 'auto_persist',
 'broadcast_receive',
 'build_process_type',
 'call_soon',
 'callback_excepted',
 'close',
 'create_initial_state',
 'create_state',
 'creation_time',
 'current',
 'decode_input_args',
 'define',
 'done',
 'encode_input_args',
 'exception',
 'execute',
 'exit_codes',
 'exposed_inputs',
 'exposed_outputs',
 'fail',
 'future',
 'get_builder',
 'get_custom_meta',
 'get_debug',
 'get_description',
 'get_exit_statuses',
 'get_name',
 'get_or_create_db_record',
 'get_parent_calc',
 'get_provenance_inputs_iterator',
 'get_state_class',
 'get_state_classes',
 'get_states',
 'get_states_map',
 'get_status_info',
 'has_terminated',
 'init',
 'initial_state_label',
 'input_file_name_hubbard_file',
 'input_helper',
 'inputs',
 'is_successful',
 'is_valid_cache',
 'kill',
 'killed',
 'killed_msg',
 'launch',
 'link_label_retrieved',
 'load',
 'load_instance_state',
 'load_members',
 'log_with_pid',
 'logger',
 'loop',
 'message_receive',
 'metadata',
 'node',
 'on_close',
 'on_create',
 'on_entered',
 'on_entering',
 'on_except',
 'on_excepted',
 'on_exit_running',
 'on_exit_waiting',
 'on_exiting',
 'on_finish',
 'on_finished',
 'on_kill',
 'on_killed',
 'on_output_emitted',
 'on_output_emitting',
 'on_paused',
 'on_pausing',
 'on_playing',
 'on_run',
 'on_running',
 'on_terminated',
 'on_wait',
 'on_waiting',
 'options',
 'out',
 'out_many',
 'outputs',
 'parse',
 'pause',
 'paused',
 'persist',
 'pid',
 'play',
 'prepare_for_submission',
 'presubmit',
 'raw_inputs',
 'recreate_from',
 'recreate_state',
 'remove_process_listener',
 'remove_state_event_callback',
 'report',
 'result',
 'resume',
 'run',
 'runner',
 'save',
 'save_instance_state',
 'save_members',
 'set_custom_meta',
 'set_debug',
 'set_logger',
 'set_status',
 'spec',
 'spec_metadata',
 'spec_options',
 'state',
 'status',
 'step',
 'step_until_terminated',
 'submit',
 'successful',
 'transition_excepted',
 'transition_failed',
 'transition_to',
 'update_node_state',
 'update_outputs',
 'uuid',
 'xml_filenames',
 'xml_filepaths']

In [4]:
hongyi-zhao's avatar
547
hongyi-zhao
answered 2020-04-20 09:56:53 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

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 7.2.2.5. Thanks for providing the test case!

Wingware Support's avatar
4.1k
Wingware Support
answered 2020-04-21 14:58:10 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

Hi,

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:

https://github.com/marvel-nccr/quantu...

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
load_profile()
from aiida.plugins import CalculationFactory

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

Regards

hongyi-zhao's avatar
547
hongyi-zhao
answered 2020-04-17 18:04:40 -0500, updated 2020-04-19 09:40:38 -0500
edit flag offensive 0 remove flag delete link

Comments

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

Wingware Support's avatar Wingware 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's avatar Wingware 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's avatar Wingware 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's avatar Wingware 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.

Regards

hongyi-zhao's avatar hongyi-zhao (2020-04-21 20:17:21 -0500) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer