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

Fallback to closest minor branch for track/team repositories #1165

Merged
merged 5 commits into from
Feb 4, 2021

Conversation

dliappis
Copy link
Contributor

@dliappis dliappis commented Feb 2, 2021

So far Rally's fallback logic for picking the track/team repository
branch has been basically either that of exact match, or failing that
use the matching major version.

This means that e.g. a major change introduced in 7.11 would mean that
e.g. rally-teams would require branches 7.11, 7.12 etc. throughout the
entire lifecycle of the 7 version.

This commit alters this fallback logic and instead will prefer the
nearest minor branch, if available.

Also convert all utils/versions.py tests to pytest.

So far Rally's fallback logic for picking the track/team repository
branch has been basically either that of exact match, or failing that
use the matching major version.

This means that e.g. a major change introduced in 7.11 would mean that
e.g. rally-teams would require branches 7.11, 7.12 etc. throughout the
entire lifecycle of the 7 version.

This commit alters this fallback logic and instead will prefer the
nearest minor branch, if available.
@dliappis dliappis added enhancement Improves the status quo :Usability Makes Rally easier to use labels Feb 2, 2021
@dliappis dliappis added this to the 2.0.4 milestone Feb 2, 2021
@dliappis dliappis self-assigned this Feb 2, 2021
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 the PR. I left a couple of comments, mostly around terminology.

docs/track.rst Outdated
Rally tries to use the branch with the best match to the benchmarked version of Elasticsearch.
Assuming the track repository has several branches, the order is:

1. Exact branch matches; e.g. if the repo contains branches `7`, `7.1` and `7.10.2` and Elasticsearch version is `7.10.2`, `7.10.2` will be chosen as the track repo.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe say "will be chosen as branch" or "checked out" instead of "will be chosen as the track repo"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 3ae2fa4

docs/track.rst Outdated
Assuming the track repository has several branches, the order is:

1. Exact branch matches; e.g. if the repo contains branches `7`, `7.1` and `7.10.2` and Elasticsearch version is `7.10.2`, `7.10.2` will be chosen as the track repo.
2. Nearest minor matches; e.g. if the repo contains branches `7`, `7.1` and `7.10` and Elasticsearch version is `7.10.2`, `7.10` will be chosen as the track repo. Alternatively if version is `7.9`, `7.1` will be chosen.
Copy link
Member

Choose a reason for hiding this comment

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

I think the term "nearest" is too vague. Consider the version is 7.8.0 and we have branches 7.9 and 7.1. To me, 7.9 is "nearer than" 7.1 because it's only one minor version distance. Therefore we need to refer to this behavior more accurately, e.g. as "nearest prior minor"?

Note that the term "nearest" is used elsewhere too (e.g. in code comments).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 861a176

@@ -103,7 +103,7 @@ def update(self, distribution_version):

def _find_matching_tag(self, distribution_version):
tags = git.tags(self.repo_dir)
for version in versions.versions(distribution_version):
for version, _ in versions.VersionVariants(distribution_version).all_versions:
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to expose this as a function instead? This would maybe read a bit nicer:

for version, _ in versions.variants_of(distribution_version):
    ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The class VersionVariants is used in utils/versions.py leveraging state. repo.py doesn't require state, just the list expansion of all versions.
Are you suggesting variants_of() could be a utility function within util/versions.py that does the object instantiation/calling of .all_versions() or?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I am proposing a utility function along the lines of:

def variants_of(distribution_version):
    for version, _ in versions.VersionVariants(distribution_version).all_versions
        yield version

This implementation would even get rid of the superfluous second return value of #all_versions() and give us the chance to keep the class VersionVariants internal to to the versions module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok fixed in 13ba1ad

"Best match for specific minor version"

assert versions.best_match(["7", "7.11", "7.2", "5", "6", "master"], "7.12.0") == "7.11",\
"If no exact match, best match is the closest minor"
Copy link
Member

Choose a reason for hiding this comment

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

I interpret "closest" as a synonym for "nearest" in this context. IMHO we should stick to one term consistently.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 861a176

@danielmitterdorfer danielmitterdorfer modified the milestones: 2.0.4, 2.1.0 Feb 2, 2021
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 iterating! LGTM

dliappis added a commit to dliappis/rally-teams that referenced this pull request Feb 4, 2021
This commit updates the versioning scheme docs to reflect the changes
brought in elastic/rally#1165
dliappis added a commit to dliappis/rally-tracks that referenced this pull request Feb 4, 2021
This commit updates the versioning scheme docs to reflect the changes
brought in elastic/rally#1165
dliappis added a commit to elastic/rally-tracks that referenced this pull request Feb 4, 2021
This commit updates the versioning scheme docs to reflect the changes
brought in elastic/rally#1165
dliappis added a commit to elastic/rally-teams that referenced this pull request Feb 4, 2021
This commit updates the versioning scheme docs to reflect the changes
brought in elastic/rally#1165
dliappis added a commit to elastic/rally-tracks that referenced this pull request Feb 4, 2021
This commit updates the versioning scheme docs to reflect the changes
brought in elastic/rally#1165
dliappis added a commit to elastic/rally-tracks that referenced this pull request Feb 4, 2021
This commit updates the versioning scheme docs to reflect the changes
brought in elastic/rally#1165
dliappis added a commit to elastic/rally-tracks that referenced this pull request Feb 4, 2021
This commit updates the versioning scheme docs to reflect the changes
brought in elastic/rally#1165
dliappis added a commit to elastic/rally-tracks that referenced this pull request Feb 4, 2021
This commit updates the versioning scheme docs to reflect the changes
brought in elastic/rally#1165
dliappis added a commit to elastic/rally-tracks that referenced this pull request Feb 4, 2021
This commit updates the versioning scheme docs to reflect the changes
brought in elastic/rally#1165
dliappis added a commit to elastic/rally-teams that referenced this pull request Feb 4, 2021
This commit updates the versioning scheme docs to reflect the changes
brought in elastic/rally#1165
dliappis added a commit to elastic/rally-teams that referenced this pull request Feb 4, 2021
This commit updates the versioning scheme docs to reflect the changes
brought in elastic/rally#1165
dliappis added a commit to elastic/rally-teams that referenced this pull request Feb 4, 2021
This commit updates the versioning scheme docs to reflect the changes
brought in elastic/rally#1165
dliappis added a commit to elastic/rally-teams that referenced this pull request Feb 4, 2021
This commit updates the versioning scheme docs to reflect the changes
brought in elastic/rally#1165
dliappis added a commit to elastic/rally-teams that referenced this pull request Feb 4, 2021
This commit updates the versioning scheme docs to reflect the changes
brought in elastic/rally#1165
dliappis added a commit to elastic/rally-teams that referenced this pull request Feb 4, 2021
This commit updates the versioning scheme docs to reflect the changes
brought in elastic/rally#1165
dliappis added a commit to elastic/rally-teams that referenced this pull request Feb 4, 2021
This commit updates the versioning scheme docs to reflect the changes
brought in elastic/rally#1165
@dliappis
Copy link
Contributor Author

dliappis commented Feb 4, 2021

@danielmitterdorfer it occurs to me that the final step, before merging this is to create the following branches:

rally-tracks

branch based_on intended for ES versions
7.2 7 >=7.2.0 and <7.11.0 (otherwise e.g. ES 7.10.2 would use Rally tracks 7.1)

rally-teams

branch based_on intended for ES versions
6.3 6 >=6.3.0 and <7.0.0 (otherwise ES 6.8.7 would use rally-teams 6.2)

WDYT?

@danielmitterdorfer
Copy link
Member

As discussed offline this sounds reasonable.

@dliappis
Copy link
Contributor Author

dliappis commented Feb 4, 2021

Earlier comment has now been addressed:

@dliappis dliappis merged commit f859867 into elastic:master Feb 4, 2021
@dliappis dliappis deleted the fallback-to-closest-minor branch February 4, 2021 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves the status quo :Usability Makes Rally easier to use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants