-
Notifications
You must be signed in to change notification settings - Fork 314
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
Preserve pre-existing index templates (#1900). #1912
base: master
Are you sure you want to change the base?
Conversation
63a06d5
to
5a38d2e
Compare
Could we get an update to the docs done too, to explain this feature? Obviously we want to have it tested too before we merge |
I did tested and it works as expected in all cases except one: one the |
6e1cffa
to
2ed976a
Compare
9ed48b4
to
c0c373a
Compare
1fa76d8
to
d1e7004
Compare
In addition to documentation I would also try adding new modules in here to enable full scope of mypy checks: Lines 200 to 206 in 2ef33eb
Context: Until #1798, so recently on Rally timescale, we had no annotations. They were introduced very surgically to reduce the scope. Then in #1859 we introduced mypy overrides that restore full set of checks for selected modules - either new ones, or the ones we are revisiting. As we're planning to broaden annotations it would be best if all new modules were added there. Ultimately the overrides should be removed. |
CI failure will be addressed by elastic/rally-tracks#748. |
95de3dd
to
fef436a
Compare
I enabled some more typing check in more modules (including |
3ef0c5d
to
e07cf14
Compare
I think |
For example, it seems we're dropping some useful tests from |
e07cf14
to
d904b79
Compare
@gbanasiak @gareth-ellis @favilo I think using Literals for defining sections and keys in the config file has been kind of naive and incomplete solution. A better one could be adopted (like for example using We could have for example a loader for every section implemented near the code that is going to use it (for preserving code modularity). The ini file is first converted to a dict of dict and then passed to a For the purpose of scopes it is enough to made up the final objects from multiple set of dictionaries (one for every scope) and in the right order to keep scope priority. I tried to reduce the complexity of the code, but this is still a naive solution, this testing I removed is very weak and it doesn't allow easy further refractory of the code. Could we please forget about this test module and plan a true refactor of this part of the project after this change? |
dba9e78
to
13a3fa4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works great, thank you. I left some comments inline.
I think the same logic should apply to remaining templates - rally-results
, rally-races
, and rally-annotations
, for consistency. WDYT?
Regarding config
refactor my personal preference would be to simply avoid it in this PR due to its size and the fact the PR title does not match the content. I would simply use convert.to_bool()
like in all other places (datastore.overwrite_existing_templates
is not the first true/false setting in the INI file) and work on the refactor in another PR. Note we are note quite there yet, as now we should convert all the boolean config reads to not use convert.to_bool()
which will extend the scope further.
I don't have strong feelings about types_test.py
. I think its form is due to the context in which it came to be. There were no annotations at all and they were inserted surgically. Some of these tests were just to confirm that code edits were complete.
esrally/config.py
Outdated
if v is None or v.scope.value <= scope.value: | ||
self._opts[section][key] = _V(value, scope) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a nice and important simplification. We lose configuration values with broder scope (lower numerical value), but we don't seem to need them? That's the type of thing I would prefer to see in a PR with a different title. Do we need scopes at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized the lower scope value where stored but never read. Therefore I preferred to filter out lower scope value when putting new values instead when retrieving them. This should open to many more simplifications later on. For example at this point because we are using a dictionary of dictionaries we could probably use 3rd party code for the inner implementation as it is the way typically ini file are being loaded (I.E https://docs.python.org/3/library/configparser.html).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see how lower scope could be useful if we say iterated through multiple benchmarks with slightly different settings, and wanted to override settings per-benchmark, then remove this override, then work with another override. But we're not doing this today. I think I'm OK with it unless @favilo has different opinion? We can return to this discussion in the expected new incoming PR.
13a3fa4
to
b720f0a
Compare
I am still processing pending comments. I am going to split this PR. |
5ea8073
to
7eb55d2
Compare
8e8fbb2
to
79b3907
Compare
When opening an `EsMetricsStore`, it creates the index template if any of following: - the index template doesn't exist - `reporting/datastore.overwrite_existing_templates` option is `true` It will preserve existing template on all the other cases. It adds a new method for getting boolean configuration options. It logs a warning when an existing index template is being replaced. It highlights index template differences between the existing one (if any) and the configured one (according to rally.ini).
79b3907
to
92b190d
Compare
Preserve pre-existing index templates (#1900).
When opening an
EsMetricsStore
, it creates the index template if any of following:reporting/overwrite_existing_templates
option istrue
It will preserve existing template on all the other cases.