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

verdi import --in-place crashes when export file is on different file system #4392

Closed
ltalirz opened this issue Sep 24, 2020 · 0 comments · Fixed by #4393
Closed

verdi import --in-place crashes when export file is on different file system #4392

ltalirz opened this issue Sep 24, 2020 · 0 comments · Fixed by #4393
Assignees
Labels
Milestone

Comments

@ltalirz
Copy link
Member

ltalirz commented Sep 24, 2020

Describe the bug

verdi import --in-place assumes that the temporary directory and the working directory are on the same file system.
If that is not the case, one can run into errors like these:

   Traceback (most recent call last):
      File "/home/ubuntu/.virtualenvs/aiida/bin/verdi", line 12, in <module>
        sys.exit(verdi())
      File "/home/ubuntu/.virtualenvs/aiida/lib/python3.6/site-packages/click/core.py", line 764, in __call__
        return self.main(*args, **kwargs)
      File "/home/ubuntu/.virtualenvs/aiida/lib/python3.6/site-packages/click/core.py", line 717, in main
        rv = self.invoke(ctx)
      File "/home/ubuntu/.virtualenvs/aiida/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/ubuntu/.virtualenvs/aiida/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/ubuntu/.virtualenvs/aiida/lib/python3.6/site-packages/click/core.py", line 956, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/home/ubuntu/.virtualenvs/aiida/lib/python3.6/site-packages/click/core.py", line 555, in invoke
        return callback(*args, **kwargs)
      File "/home/ubuntu/aiida-core/aiida/cmdline/commands/cmd_export.py", line 235, in migrate
        os.rename(output_file, input_file)
    OSError: [Errno 18] Invalid cross-device link: '/tmp/tmpkoqd1ucq/archive.aiida' -> '/home/ubuntu/aiida_profiles/home/ubuntu/.aiida/repository/sssp/archives/SSSP.1_5.aiida'

os.rename should be replaced by shutil.move

Steps to reproduce

  1. Place an AiiDA export file on a file system that is not the root volume (the one hosting temporary files)
  2. Try importing that file via verdi import --in-place

Your environment

Current aiida-core develop branch.

Additional context

One can use the TMPDIR environment variable to work around this issue by setting it e.g. to the current working directory.

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

Successfully merging a pull request may close this issue.

2 participants