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

Faster aiida imports #6092

Closed
wants to merge 52 commits into from
Closed

Conversation

danielhollas
Copy link
Collaborator

This is a PR showcasing my faster-import branch, as desribed in detail on Discourse topic.
https://aiida.discourse.group/t/why-is-aiidalab-base-widget-import-so-slow/32

This is not really meant to be merged, since there are a lot of changes, it will be easier to review by submitting individual PRs.
This first one is in #6091.

Also there were some exploratory changes that might not be needed / desirable in the end.

sphuber and others added 30 commits July 7, 2023 04:48
These class attributes require a look up whether the `Node` class has a
registered entry point which can have a non-negligible cost. These
attributes were defined in the `AbstractNodeMeta` class, which is the
metaclass of the `Node` class, which would cause this code to be
executed as soon as the class was imported.

Here, the `AbstractNodeMeta` metaclass is removed. The
`_plugin_type_string` and `_query_type_string` class attributes are
changed to class properties. The actual value is stored in the private
attribute analog which is defined lazily the first time the property is
accessed.
The module 'aiida.manage.external.postgres' is only
imported in certain verdi commands so it does not
make sense to always import it. It also doesn't
need to be a public API I guess.
This call has quadratic complexity
so we want to avoid calling it as much as possible.
@sphuber
Copy link
Contributor

sphuber commented Sep 6, 2023

@danielhollas since we are in the process of merging these changes in other PRs, can this be closed?

@danielhollas
Copy link
Collaborator Author

@sphuber I'd prefer to keep it open for a while longer as a reference to see what has been merged and what remains.

@sphuber
Copy link
Contributor

sphuber commented Sep 6, 2023

I don't see how keeping this PR open helps with that, but ok

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

Successfully merging this pull request may close these issues.

2 participants