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

importing same aiida export file twice gives error #1710

Closed
ltalirz opened this issue Jul 2, 2018 · 3 comments
Closed

importing same aiida export file twice gives error #1710

ltalirz opened this issue Jul 2, 2018 · 3 comments

Comments

@ltalirz
Copy link
Member

ltalirz commented Jul 2, 2018

I attach an aiida export file (2.3MB, created with aiida-core 0.12.1). It contains a few CifData, ParameterData and Workfunction nodes.

Importing it the first time works fine

verdi import test-db.tar.gz

...

STORING NODE LINKS...
   (600 new links...)
STORING GROUP ELEMENTS...
IMPORTED NODES GROUPED IN IMPORT GROUP NAMED '20180702-173341'
*** WARNING: MISSING EXISTING UUID CHECKS!!
*** WARNING: TODO: UPDATE IMPORT_DATA WITH DEFAULT VALUES! (e.g. calc status, user pwd, ...)
DONE.

Importing it the second time, however, yields an error:

verdi import test-db.tar.gz

...

STORING NEW NODE FILES & ATTRIBUTES...
SETTING THE IMPORTED STATES FOR NEW NODES...
existing aiida.backends.djsite.db.models.DbGroup: 6e9ce2ff-8e6c-4a66-994c-72281b923c61 (8->1)
STORING NODE LINKS...
Rolling back
Traceback (most recent call last):
  File "/Users/leopold/Applications/miniconda3/envs/cof-paper/lib/python2.7/site-packages/aiida/cmdline/commands/importfile.py", line 85, in run
    import_data(filename)
  File "/Users/leopold/Applications/miniconda3/envs/cof-paper/lib/python2.7/site-packages/aiida/orm/importexport.py", line 316, in import_data
    silent=silent)
  File "/Users/leopold/Applications/miniconda3/envs/cof-paper/lib/python2.7/site-packages/aiida/orm/importexport.py", line 1325, in import_data_sqla
    .format(out_id, link['label'], in_id))
ValueError: There exists already an input link to node 1 with label _return but it does not come the expected input 8

> There has been an exception during the import of file
> test-db.tar.gz
> Do you want to continue (c) or stop (S, default)? c

I see a few issues here, in number of decreasing importance:

  1. Unless somebody can convince me otherwise, I believe importing an export file twice should not yield any error
  2. After replying "c" to the prompt, there is no output anymore. The user is left wondering what happened - what was imported, what wasn't ... At the very least, the exception error message needs to be forwarded, probably with some additional info on what is done after the exception occurred (if anything)
  3. verdi import needs a --non-interactive option which does not prompt
  4. I believe the error message was meant to say ... but it does not come from the expected input 8
@szoupanos
Copy link
Contributor

Thanks @ltalirz
I agree that consecutive attempts to import the same file should fail silently (i.e. import the delta that is not imported if there is an overlap and ignore the rest). Of course, if there are rules that are violated (e.g. a node is returned by two jobcalculations) then an error should be thrown but this should not be the case if you import the same file twice.

I think, that it is better to finish the work at #1102 which should be close to the end (that will also affect the behaviour of this issue and then focus on this).

@szoupanos
Copy link
Contributor

This should be very likely be fixed by pull request #1764 for the issue #1758.
During the tests for #1758, some export files were imported more than once (by accident) and no exceptions occurred.

In any case after pull request #1764 is merged, we have to ensure that this is fixed with a final test.

@szoupanos
Copy link
Contributor

Fixed by PR #1769

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

No branches or pull requests

2 participants