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

Allow writers to overwrite existing data #594

Merged
merged 7 commits into from Feb 14, 2024

Conversation

JAEarly
Copy link
Contributor

@JAEarly JAEarly commented Feb 7, 2024

Description of changes:

CloudUploader has an exist_ok kwarg that is set to False by default.
Writers (e.g. MDSWriter) cannot overwrite this.

This PR makes two changes:

  1. exist_ok can now be set by a writer.
  2. If exist_ok is True, existing files are now deleted. This allows easy debugging when developing streaming datasets as the files do not have to be manually deleted each time the code is run.

Tests and docs updated accordingly.

Merge Checklist:

Put an x without space in the boxes that apply. If you are unsure about any checklist, please don't hesitate to ask. We are here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

  • I have read the contributor guidelines
  • This is a documentation change or typo fix. If so, skip the rest of this checklist.
  • I certify that the changes I am introducing will be backward compatible, and I have discussed concerns about this, if any, with the MosaicML team.
  • I have updated any necessary documentation, including README and API docs (if appropriate).

Tests

  • I ran pre-commit on my change. (check out the pre-commit section of prerequisites)
  • I have added tests that prove my fix is effective or that my feature works (if appropriate).
  • I ran the tests locally to make sure it pass. (check out testing)
  • I have added unit and/or integration tests as appropriate to ensure backward compatibility of the changes.

Copy link
Collaborator

@karan6181 karan6181 left a comment

Choose a reason for hiding this comment

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

Thank you for creating the PR. The changes looks good to me. I have posted some minor comments.

@XiaohanZhangCMU Can you please also take a look?

streaming/base/storage/upload.py Outdated Show resolved Hide resolved
streaming/base/format/base/writer.py Show resolved Hide resolved
@JAEarly
Copy link
Contributor Author

JAEarly commented Feb 7, 2024

Looking at the tests that are failing: I believe there's now a conflict when exists_ok=True and keep_local=True, or at least this seems to be what the GitHub test log says. I'm having issues running the failing tests locally so I'm unable to debug. @karan6181 do you have further insight on this?

@XiaohanZhangCMU
Copy link
Member

@JAEarly Currently exists_ok=True in clouduploader.py is only used by merging index (streaming/base/utils/merge_index). Your change will make that fail.

I suggest you add the "file-removing behavior" to mdswriter instead of upload.py.

streaming/base/storage/upload.py Outdated Show resolved Hide resolved
Copy link
Member

@XiaohanZhangCMU XiaohanZhangCMU left a comment

Choose a reason for hiding this comment

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

Lgtm. Wait for ci checks /

@JAEarly
Copy link
Contributor Author

JAEarly commented Feb 12, 2024

Should be good to merge, I've rebased just need the CI checks to be run again, thanks!

@XiaohanZhangCMU
Copy link
Member

Sure. Just kicked off the CI tests.

Copy link
Member

@XiaohanZhangCMU XiaohanZhangCMU left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the improvement!

@XiaohanZhangCMU XiaohanZhangCMU enabled auto-merge (squash) February 14, 2024 18:05
@XiaohanZhangCMU XiaohanZhangCMU merged commit 3de2e68 into mosaicml:main Feb 14, 2024
6 checks passed
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.

None yet

3 participants