elastic / elastic/rally

Simplify `esrally/config.py` module.

Open
#1,920 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2k
Forks
347
Avg merge
6d 17h
Merged PRs (30d)
5

Description

Unnecessary code complexity has been spotted in `esrally/config.py` module:
- There is a separate module `esrally/types.py` defining typing hints for it. This makes code hard to follow because of the need to include both modules (types and config) with types two types (`types.Config` and `config.Config`) referring to exactly the same thing where the protocol is not always in sync with its implementation.
- The implementation of the key retrieval makes often use of the full content iteration because storing value scope data as keys instead of values. Despite making keys insertion simpler, it is affected later by a much more complex retrieval approach. The scope should instead be stored as a value, not as a key.
- There is a sort of cyclic dependency between modules dependency involving `config.py` and `paths.py` that should be resolved.
- Testing for `esrally/config.py` is using a dummy lower level component that is not implementing exaclty the methods of the implementation class it replaces. This has been spotted while passing linters verifications when adding typing hints.

Contributor guide

Open the contributing guide

Research direction

Start by reading esrally/config.py alongside esrally/types.py and esrally/paths.py to understand the duplicated types, scope storage, and cyclic dependency. Inspect the config tests and their dummy lower-level component, then run the relevant tests and linters; done means the modules are simplified, the dependency cycle is resolved, and the test double matches the implementation interface.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.