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

Raise an error when attempting to bulk-index without any corpora #967

Merged

Conversation

bartier
Copy link
Contributor

@bartier bartier commented Apr 17, 2020

This PR attempts to solve the issue #568.

As discussed in the issue, now the BulkIndexParamSource constructor checks whether that self.corpora is empty and if it is raise exceptions.InvalidSyntax.

Summary of changes:

  • Explicit error is raised when list of corpora is empty and you try to bulk requests to Elasticsearch.
    example
    Output example when running a Rally race without corpora definition.

  • Fix tests that started to fail after the new error check.

  • Add new test for this new error check.

    def test_create_without_corpora_definition(self):
        with self.assertRaises(exceptions.InvalidSyntax) as ctx:
            params.BulkIndexParamSource(track=track.Track(name="unit-test"), params={})

        self.assertEqual("There is no document corpora definition for track unit-test. "
                         "You must add at least one before making bulk requests to Elasticsearch.", ctx.exception.args[0])

I hope this helps :)

@danielmitterdorfer
Copy link
Member

@elasticmachine test this please

@danielmitterdorfer danielmitterdorfer added :Track Management New operations, changes in the track format, track download changes and the like :Usability Makes Rally easier to use enhancement Improves the status quo labels Apr 17, 2020
@danielmitterdorfer danielmitterdorfer added this to the 1.5.0 milestone Apr 17, 2020
Copy link
Member

@danielmitterdorfer danielmitterdorfer left a comment

Choose a reason for hiding this comment

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

Great change! I left one grammar-related nit but apart from that the change looks good. Thank you. :)

esrally/track/params.py Outdated Show resolved Hide resolved
@bartier
Copy link
Contributor Author

bartier commented Apr 17, 2020

@danielmitterdorfer I made the requested changes. Could you check again? BTW, I found a small typo in runner.py, I think it would be okay to add to this PR :)

@danielmitterdorfer
Copy link
Member

@elasticmachine test this please

Copy link
Member

@danielmitterdorfer danielmitterdorfer 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 your PR and thanks for iterating! The change looks good now and I'll merge it as soon as CI passes.

@danielmitterdorfer danielmitterdorfer merged commit 137b4fc into elastic:master Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves the status quo :Track Management New operations, changes in the track format, track download changes and the like :Usability Makes Rally easier to use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants