-
Notifications
You must be signed in to change notification settings - Fork 214
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
Inefficient order of checks in verdi import
#2979
Comments
Other issues/feature requests:
This is not the behavior you want e.g. when you try migrating files automatically - this should be considered a
Since we're about to migrate a number of archives for Materials Cloud, I will have a brief look into this. |
The issue seems to be here: aiida-core/aiida/tools/importexport/common/archive.py Lines 213 to 222 in 9d918e0
The
@sphuber Could you please point me to this context manager? |
That phrase might be a bit misleading. It does allow you to retrieve the contents of a single file, but it still requires unpacking the whole thing. Currently, AiiDA archives can be either |
It certainly is possible, both for .zip and for .tar.gz files. Python syntax: tarfile.open('tarfile.tar').extract('file/to/extract', path='dest') for zipfile see https://stackoverflow.com/a/17729939/1069467 So it seems that we should generalize the extraction code a bit to allow extracting single files and then let this functionality bubble up here... |
Just to mention that
I.e. we can keep discussions on this thread to speed issues in inspecting/loading archive files. |
Thanks to #4510, the archive reader is now just reading (and caching) the files that are needed. In particular, the version check will just read the metadata aiida-core/aiida/tools/importexport/archive/readers.py Lines 123 to 147 in 2f8e845
At the moment |
verdi import
currently first extracts the node data before checking the metadata. When trying to import a big archive with an old version, one first has to wait for the data to be extracted before getting the message that the version is incompatible. Only then does it go automatically toverdi export migrate
, but there the same problem happens. Version compatibility happens after all the data is extracted. TheArchive
class provides useful context managers to read just a single file. This should be used in both these commands to first read themetadata.json
and report any errors if it is incompatible before doing anything else.The text was updated successfully, but these errors were encountered: