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

Fixed dataset download re-linking. #1989

Merged
merged 4 commits into from
Feb 17, 2023

Conversation

rpartsey
Copy link
Collaborator

Motivation and Context

Assume you already have all the assets downloaded.
When the habitat-sim data download utility is run again for the same type of assets without specifying '--data-path' argument, the data_path variable defaults to data_path = os.path.abspath("./data/") and os.path.exists(data_path) is True for a data symlink. Code checks whether the assets exist the same way os.path.exists(data_path path_to_asset) and command also returns True and all of the assets are accessible via symlink (note that at this step some of the assets in /path/to/data may be symlinks but all will have "/path/to/data" as their prefix (as expected)). However, then the symlinks to the assets are unlinked and linked back but with "/path/to/habitat-lab/data" .
All this is caused because at the beginning, this command os.path.abspath("./data/") treats data not as symlink but as actual path (directory). More context in this Slack thread.

How Has This Been Tested

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes.
  • [] All new and existing tests passed.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Jan 19, 2023
print(f"Note, {default_data_path} is a symbolic link that points to {data_path}.")

try:
os.makedirs(data_path, exist_ok=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

What kind of errors can arise here? I think it would just be permission errors?
What is the advantage of printing these messages over just raising the error?

Copy link
Collaborator Author

@rpartsey rpartsey Jan 19, 2023

Choose a reason for hiding this comment

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

To be honest, I didn't ask myself these questions during fixing, but it seems to me that this is a "graceful way" to exit a program. Exceptions should be raised on program errors. Here everything is fine, user specified wrong path and we inform him about it. Why the program should fail with exception?

Copy link
Contributor

Choose a reason for hiding this comment

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

@rpartsey probably should still be restricted to IOException? LIke no reason to catch SystemError exceptions from Python etc.

Copy link
Contributor

@aclegg3 aclegg3 left a comment

Choose a reason for hiding this comment

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

Thanks for this fix. 👍

@rpartsey rpartsey merged commit 9c0a4dd into facebookresearch:main Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants