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

Add isLiveDataset field #494

Merged
merged 16 commits into from
Feb 7, 2024
Merged

Add isLiveDataset field #494

merged 16 commits into from
Feb 7, 2024

Conversation

ccl-core
Copy link
Contributor

@ccl-core ccl-core commented Feb 6, 2024

No description provided.

@ccl-core ccl-core requested a review from a team as a code owner February 6, 2024 17:09
Copy link

github-actions bot commented Feb 6, 2024

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@ccl-core ccl-core changed the title Ccl core 2 Add isLiveDataset field Feb 6, 2024
@ccl-core
Copy link
Contributor Author

ccl-core commented Feb 6, 2024

Addresses #495

Manually correct formatting
Manually fix formatting
@ccl-core ccl-core requested a review from marcenacp February 6, 2024 21:38
Manually fix file
Fix manually file
Copy link
Contributor

@marcenacp marcenacp left a comment

Choose a reason for hiding this comment

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

Great, thanks!

ctx = self.node.ctx
# For live datasets, we do not raise an error if the hashes checks fail, but
# only the warning above.
if ctx.is_live_dataset:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a unit test in download_test.py? Something like:

@pytest.mark.parametrize("conforms_to", CroissantVersion)
# Test the hex and base64 hash values
def test_hashes_are_not_checked_for_live_datasets(conforms_to):
    with tempfile.NamedTemporaryFile(delete=False) as f:
        filepath = f.name
        ctx = Context(conforms_to=conforms_to, is_live_dataset=True)
        metadata = Metadata(ctx=ctx, name="bar")
        file_object = create_test_file_object(
            name="foo",
            content_url=os.fspath(filepath),
        )
        file_object.parents = [metadata]
        download = Download(operations=operations(), node=file_object)
        download()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great point, done.

# only the warning above.
if ctx.is_live_dataset:
return
# In v0.8 only, hashes were not checked.
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of the comment, use not ctx.is_v0()? (Probably this line is anterior to the creation of the function)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I just moved the pre-existing line below. I think ctx.is_v0() would do the same.

@ccl-core ccl-core merged commit 32c229c into main Feb 7, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 7, 2024
@ccl-core ccl-core deleted the ccl-core-2 branch February 7, 2024 12:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants