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

Add reset method toProgressReporterAbstract #4522

Merged
merged 6 commits into from
Oct 28, 2020

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented Oct 28, 2020

This PR adds the update method to the progress reporter.
This in-turn, allows for the implmentation of a callback mechanism in ArchiveReaderAbstract.iter_node_repos.
The callback implmentation is taken from the disk-objectstore package, and so facilitates a later migration to its use.

The PR also moves the (common) repository import code out of the backend specific modules, reducing code duplication.

This PR is intended to facilitate the transition to the new node repository in #4345

@chrisjsewell chrisjsewell requested a review from ltalirz October 28, 2020 03:12
@chrisjsewell
Copy link
Member Author

chrisjsewell commented Oct 28, 2020

I've tested this against my 40,000 node archive, and looks to be all be working as expected:

$ verdi import -v DEBUG tmp/mount_folder/out.aiida 
Info: importing archive tmp/mount_folder/out.aiida
Calling import function import_data_dj for the django backend.

IMPORT
--------  ---------
Archive   out.aiida

Parameters
--------------------------  ------
Comment rules               newest
New Node Extras rules       import
Existing Node Extras rules  kcl
CHECKING IF NODES FROM LINKS ARE IN DB OR ARCHIVE...
CREATING PK-2-UUID/EMAIL MAPPING...
Importing 40066 entities
ASSESSING IMPORT DATA...
Finding existing entities - User         100.0%|████████████████████████████████████████████████████| 1/1
Reading archived entities - User         100.0%|████████████████████████████████████████████████████| 1/1
Reading archived entities - Node         100.0%|████████████████████████████████████████████| 40065/40065
STORING ENTITIES...
Users -  existing entries                100.0%|████████████████████████████████████████████████████| 1/1
CREATING NEW NODE REPOSITORIES...
Iterating node repositories              100.0%|████████████████████████████████████████████| 40065/40065
Nodes -  storing new                     100.0%|████████████████████████████████████████████| 40065/40065
STORING NODE LINKS...
Links - label=input                      100.0%|████████████████████████████████████████████| 40064/40064
   (40064 new links...)
STORING GROUP ELEMENTS...
Done (cleaning up)                       100.0%|████████████████████████████████████████████| 40065/40065

Summary
-----------------------  ---------------
Auto-import Group label  20201028-032117
User(s)                  1 existing
Node(s)                  40065 new
Link(s)                  40064 new

Success: imported archive tmp/mount_folder/out.aiida

Oct-28-2020 04-19-22

This commit adds the update method to the progress reporter.
This in-turn, allows for the implmentation of a callback mechanism
in `ArchiveReaderAbstract.iter_node_repos`.
The callback implmentation is taken from the
[disk-objectstore](https://github.com/aiidateam/disk-objectstore) package,
and so facilitates a later migration to its use.

The commit also moves the common repository import code
out of the backend specific modules, reducing code duplication.
@codecov
Copy link

codecov bot commented Oct 28, 2020

Codecov Report

Merging #4522 into develop will increase coverage by 0.01%.
The diff coverage is 87.33%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4522      +/-   ##
===========================================
+ Coverage    79.39%   79.40%   +0.01%     
===========================================
  Files          480      480              
  Lines        35080    35087       +7     
===========================================
+ Hits         27850    27858       +8     
+ Misses        7230     7229       -1     
Flag Coverage Δ
#django 73.53% <85.92%> (+0.03%) ⬆️
#sqlalchemy 72.70% <85.92%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiida/tools/importexport/archive/readers.py 86.37% <81.82%> (+0.17%) ⬆️
aiida/common/progress_reporter.py 91.12% <83.34%> (-5.76%) ⬇️
...ida/tools/importexport/dbimport/backends/common.py 98.51% <100.00%> (+0.51%) ⬆️
...ida/tools/importexport/dbimport/backends/django.py 92.94% <100.00%> (-0.14%) ⬇️
aiida/tools/importexport/dbimport/backends/sqla.py 93.71% <100.00%> (-0.12%) ⬇️
aiida/engine/daemon/runner.py 79.32% <0.00%> (-3.44%) ⬇️
aiida/transports/plugins/local.py 81.54% <0.00%> (+0.26%) ⬆️
aiida/engine/daemon/client.py 73.57% <0.00%> (+1.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 55f8706...e213d33. Read the comment docs.

Copy link
Member

@ltalirz ltalirz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some questions before approving (see comments)

aiida/common/progress_reporter.py Show resolved Hide resolved
aiida/tools/importexport/archive/readers.py Outdated Show resolved Hide resolved
@chrisjsewell chrisjsewell requested a review from ltalirz October 28, 2020 18:58
Copy link
Member

@ltalirz ltalirz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @chrisjsewell !

@chrisjsewell chrisjsewell merged commit 9ff07c1 into aiidateam:develop Oct 28, 2020
@chrisjsewell chrisjsewell deleted the progress/add-update branch October 28, 2020 19:17
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