-
Notifications
You must be signed in to change notification settings - Fork 192
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
Import/export progress bar #3599
Import/export progress bar #3599
Conversation
The main thing I am not convinced about with this PR, is the design of the headers of meta data printed when im- and exporting. Feedback on this would be great, contributing commits or PR's against my branch are even more welcome. |
7d2d336
to
add686f
Compare
This has now been fixed and brought into line with the rest of AiiDA, using |
add686f
to
dff3e71
Compare
@ltalirz @sphuber @dev-zero @yakutovicha @chrisjsewell I consider this ready for review. Since this is very much a UX addition, it will probably be needed for you to checkout the branch and test ex- and importing. |
So far tested it only on a small export - on first impression it looks great and seems to provide very useful information, well done! I've also checked the new dependency tqdm. I would therefore ask @CasperWA to motivate which features of tqdm warrant the addition of a new dependency (vs the various 50ish lines implementations in pure python). |
The features I expect from the progress bar:
How
The justification for |
cb7eaf9
to
d94b54e
Compare
Some comments from a production test.
The group loading phase seems extremely slow to me - perhaps this is a good point to look into optimizing the code. |
As far as I remember, it is indeed just this: An initialization. Nothing quantifiable is truly happening, other than some memory-caching/-reserving, I believe? Edit: A closer look shows me that I can indeed me more explicit, since we are collecting
Right! In the beginning I played around with having multiple progress bars as well: An overarching one and then sub-progress bars for each "part". This may be the solution for this. What do you think?
It indeed is. The code section looks like this: # Add all the nodes contained within the specified groups
for group in given_groups:
if not silent:
group_count = group.count()
if group_count:
progress_bar.reset(total=group_count)
progress_bar.set_description_str('Loading Group - LABEL={}'.format(group.label))
for entry in group.nodes:
if not silent:
progress_bar.update()
progress_bar.refresh()
entities_starting_set[NODE_ENTITY_NAME].add(entry.uuid)
if issubclass(entry.__class__, orm.Data):
given_data_entry_ids.add(entry.pk)
elif issubclass(entry.__class__, orm.ProcessNode):
given_calculation_entry_ids.add(entry.pk) It may be that it is the On another note, I must say that putting a progress bar on all of this truly exposes the slow parts of both the import and export functions - something that is quite neat for optimization purposes, but may be bothersome for users. Although I still think it is nicer than the current "print a bunch of stuff" approach :) (For future references of this/these comment(s), these concern the export part only.) |
I'm working on fixing this now. |
I've opened a PR for fixing making the search over groups more performant (for the moment on top of develop). Furthermore, here is a branch that contains this fix + some further changes to the progress bar - in particular I have removed the "refresh" from a couple of places since constant refreshing is costly and already handled in a sensible way by tqdm (it has an internal timeout set to 100ms). https://github.com/ltalirz/aiida-core/tree/fix-progress-bar-rebased Edit: here is the link for comparing changes |
Cheers. I see @lekah has already come up with some improvements.
Right! I knew there was a reason why I chose
I knew this, and I am also not doing this some places, but mostly I am, since I "forgot" about the I will take a look at it, thanks! |
0b104a6
to
766527a
Compare
0f6e53d
to
dce4778
Compare
@ltalirz I have incorporated some changes, especially concerning the Furthermore, I have gone through the export function |
As a first step, I'm now running the benchmark export I used for the AGE with current |
Great! Though to that effect, I applaud the benchmark tests you are currently running, since they will act as a "before" to the import/export remake. |
This removes the debug parameter in the importexport module, and instead a logger is used to print all debug messages at the debug level.
The progress bar becomes a single global variable in the `aiida.tools.importexport.common.progress_bar` module. It should only be handled via the functions in said module.
`what` is deprecated in favor of `entities`. `outfile` is deprecated in favor of `filename`. Support for the deprecated parameters should be upheld until v2.
Use a new `override_log_formatter` to temporarily override the Formatter for all AiiDA log handlers. Then log console output at the custom AiiDA REPORT level. If silent, set logging level to CRITICAL.
78df6ab
to
7e2547e
Compare
@sphuber NOTE: I have very slightly altered the |
This logging stuff is seriously messing up the tests now. I think this continuous re-integration of "new" updates in an existing "old" PR is not at all desireable and should be discouraged as much as possible (in short, I'm tired of having to fix this PR due to seemingly pointless change requests). |
Locally, only a |
I think this PR and I are properly angry with each other at this point. Please when reviewing, keep in mind that non-essential changes can be put into an issue and addressed later. |
Due to the import/export functions logging summaries they can not be captured properly for the test.
c330592
to
2f217dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @CasperWA
Fixes #2776
This PR does a multitude of things/is a bit complex. Therefore, I have tried to keep each "thing" kept in its own commit. Upon merging, these may be squashed in a way that makes sense.
I will try to keep this commit segregation throughout the lifetime of the PR, meaning if I commit changes, they will be squashed into the respective commit, where they belong, or a new commit will be made, following a complete rebase. EDIT: I failed to do this, but at least the history is more clear now.
Some of the things introduced in this PR:
debug
parameter for import/export.This is now logged at the debug level instead.
headersummary for import/export.verdi
commands, but also for the backend functions.But most importantly, this PR creates a progress bar for import, export, and extracting export archives.
Possible updates (either in this PR or in the future):