Skip to content

Conversation

@vsaravind01
Copy link
Collaborator

  • Added _download_data function to retrieve file path and metadata for downloading data from the datastore.
  • Introduced get_info method in DataStore and DiskDataStore classes to fetch object information.
  • Updated FastAPI router to include a new endpoint for downloading data, handling both files and directories.
  • Added tests for the new download functionality and datastore methods to ensure proper behavior and error handling.

Type of change

Please check the option that is related to your PR.

  • 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 not work as expected)
    • In this case, we recommend to discuss your modification on GitHub issues before creating the PR
  • Documentations (modification for documents)

Checklist

  • Run lint.sh and ensure that it passes (Use ./lint.sh --fix to fix formatting issues automatically)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

- Added `_download_data` function to retrieve file path and metadata for downloading data from the datastore.
- Introduced `get_info` method in `DataStore` and `DiskDataStore` classes to fetch object information.
- Updated FastAPI router to include a new endpoint for downloading data, handling both files and directories.
- Added tests for the new download functionality and datastore methods to ensure proper behavior and error handling.
- Updated `disk_datastore` and `alternate_disk_datastore` fixtures to instantiate `DiskDataStore` directly instead of using the `_init_datastore` utility.
- Modified test cases in `test_utils.py` to pass the `disk_datastore` fixture to the `_download_data` function, ensuring proper integration with the new datastore structure.
- Updated the _download_data function to include an optional datastore parameter, allowing for more flexible data retrieval.
- Adjusted the internal logic to initialize the datastore only if it is not provided, improving usability and integration with existing datastore structures.
os.remove(zip_base + ".zip")
raise HTTPException(status_code=500, detail=f"Failed to create zip file: {str(e)}")
else:
# For single file models (unlikely but handle it)
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you please elaborate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If the model is not a directory and if it is a single file we should be able to handle this case as well. That's the reason why I've explicitly mentioned that it's unlikely but we still handle it.

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.

3 participants