-
Notifications
You must be signed in to change notification settings - Fork 322
It enables the new multipart transfer manager inside track downloader. #1965
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
Merged
Merged
Changes from all commits
Commits
Show all changes
154 commits
Select commit
Hold shift + click to select a range
7d8fca1
Update storage tools with last changes from `storage` branch.
fressi-elastic a5dd993
Add `storage.max_workers` otpion to `types` module.
fressi-elastic 6a43ab4
It adds TrasferManager class.
fressi-elastic 9bab2cb
Add test case for TransferManager.get method.
fressi-elastic 757f634
It adds missing options keys to `èsrally.types` module.
fressi-elastic eda1435
Merge branch 'master' of github.com:elastic/rally into storage.manager
fressi-elastic d9ec8a3
Merge branch 'master' of github.com:elastic/rally into storage.transfer
fressi-elastic 1057cd9
Add documentation for `storage.max_workers` configuration key.
fressi-elastic f73efca
Merge branch 'storage.transfer' into storage.manager
fressi-elastic 68e9cc1
Add documentation for new `storage.*` configuration keys.
fressi-elastic 0f0fc44
It enables the new multipart tranfer manager inside track downloader.
fressi-elastic 03617d2
Update configuration documentation.
fressi-elastic 2f42d1f
Use legacy downloader in case the transfer manager fails.
fressi-elastic 2b6f42b
Enable the multipart downloader to test in in CI
fressi-elastic 9178a6a
Writing tests for Downloader class
fressi-elastic d3cb691
Improve loader and test using transfer manager.
fressi-elastic 468f27d
Backport changes from track loader integration branch.
fressi-elastic c194eda
Merge branch 'storage.transfer' into storage.manager
fressi-elastic d1e64ff
Merge branch 'storage.manager' into track.loader
fressi-elastic 2ec02bc
Remove unused adapter methods.
fressi-elastic 6f4d116
Merge branch 'storage.transfer' into storage.manager
fressi-elastic b3a07b0
Merge branch 'storage.manager' into track.loader
fressi-elastic f61845a
WIP making Downloader serializable.
fressi-elastic 6c19dfa
Merge branch 'master' of github.com:elastic/rally into storage.transfer
fressi-elastic ed0b386
Skip 'url' field and use 'all()' function in 'Head.check' method.
fressi-elastic ef65a10
Skip 'url' field and use 'all()' function in 'Head.check' method.
fressi-elastic 8700efb
Merge branch 'storage.transfer' of github.com:fressi-elastic/rally in…
fressi-elastic ab6ae8e
Remove unused property
fressi-elastic 3c925be
Add a comment to remind to implement Data header in the http adapter.
fressi-elastic a69678a
It Raises an NotImplementedError for unsupported multi-range feature …
fressi-elastic f6d7943
Adapter.match_url now returns a bool once again.
fressi-elastic 50dfe95
Merge branch 'master' of github.com:elastic/rally into storage.transfer
fressi-elastic eee450c
Merge branch 'storage.transfer' into storage.manager
fressi-elastic e6b9f19
Merge branch 'storage.manager' into track.loader
fressi-elastic 1eed7e7
Remove unnecessary match_url method overriding.
fressi-elastic b2cc421
Merge branch 'master' of github.com:elastic/rally into storage.transfer
fressi-elastic ea9eaa0
Merge branch 'storage.transfer' into storage.manager
fressi-elastic e4fd57e
It adds support to AWS/S3 client adapter.
fressi-elastic f6f2e88
Testing the new AWS/S3 client adapter.
fressi-elastic 79b7873
Testing the new AWS/S3 client adapter.
fressi-elastic dc6aea1
Remove Head.create method.
fressi-elastic 66a3817
Update HTTPAdapter to make easier to reuse its head to headers methods.
fressi-elastic c1b6d2b
It adds tests for AWS/S3 client adapter.
fressi-elastic 5c1c649
Fix S3Adapter.put object
fressi-elastic 6b7ca58
Merge branch 'master' of github.com:elastic/rally into storage.manager
fressi-elastic 98dd83d
Merge branch 'storage.manager' into track.loader
fressi-elastic 959fd39
Downloader class now uses a global storage manager instance.
fressi-elastic a27cd1e
Backport changes from track.loader branch.
fressi-elastic 26f67a5
Merge branch 'storage.manager' into track.loader
fressi-elastic 6ea3fca
Use global LOG reference instead of self.logger.
fressi-elastic e54d4c3
Use `Self` as return type for `Adapter.from_config` methods.
fressi-elastic 2bfd1ef
Use `Self` as return type for `Adapter.from_config` methods.
fressi-elastic 6a27931
Use `Self` as return type for `Adapter.from_config` methods.
fressi-elastic 98ce831
Add comment to explain client limitation.
fressi-elastic 04e535d
Add missing typing for boto3 library.
fressi-elastic 2333aaa
Add missing typing for boto3 library.
fressi-elastic c2a8d32
Import `Self` from typing_extensions
fressi-elastic d57320c
Merge branch 'master' of github.com:elastic/rally into storage.manager
fressi-elastic 8770e6d
Remove list and put methods from storage Adapter interface
fressi-elastic db3c73b
Merge branch 'storage.manager' into track.loader
fressi-elastic 8279215
Update documentation after introducing S3 adapter.
fressi-elastic 039112f
Merge branch 'storage.manager' into track.loader
fressi-elastic 2814a0e
Fix configuration documentation.
fressi-elastic 71cbce3
Write logs lines for when using transfer manager a single transfer do…
fressi-elastic f752155
Force using transfer manager
fressi-elastic d40b73a
Revert "Force using transfer manager"
fressi-elastic 7557449
Merge branch 'master' of github.com:elastic/rally into track.loader
fressi-elastic 8359a57
Get improvements from storage branch.
fressi-elastic 0fb0d6e
Disable the use of the new transfer manager by default.
fressi-elastic 66b91d5
Send storage configuration toghether with the Downloader object.
fressi-elastic f213196
Merge branch 'master' of github.com:elastic/rally into actor
fressi-elastic b5ad390
Update test_types and launcher.py
fressi-elastic 168f7ea
Revert changes of mechanic launcher.
fressi-elastic 0a5cb40
Ask Thespian to spawn actors subprocess instead of using fork
fressi-elastic 3c00838
Correct actor initialization procedure.
fressi-elastic 903e4d1
revert changes to rally.py
fressi-elastic b8a8822
Revert unrelated changes.
fressi-elastic 544b157
Revert unrelated changes.
fressi-elastic 0e23b15
Revert unrelated changes.
fressi-elastic 7dae951
Revert unrelated changes.
fressi-elastic a9fb89a
Merge branch 'actor' of github.com:fressi-elastic/rally into actor
fressi-elastic b3dd751
Add test case for actor.bootstrap_actor_system
fressi-elastic a85135d
Add test case for actor.actor_system_already_running
fressi-elastic a9db7f3
Test setting process_startup_method when bootstrapping actor system.
fressi-elastic 5286cdf
It allows configuring actor process startup method.
fressi-elastic 42b6bc4
Test behaviour when joining actor system offline.
fressi-elastic e3103fd
actor_system_already_running returns `None` for unsupported system base.
fressi-elastic 48a11c0
It joins the remote actor system with the requested IP and port.
fressi-elastic e8008e9
It wraps actor_system_already_running to keep the old behavior.
fressi-elastic b22ad2f
Merge branch 'actor' into track.loader
fressi-elastic 3000678
Fix actor_test.py
fressi-elastic 16e2da1
Merge branch 'actor' into track.loader
fressi-elastic d3a078d
Mock log.load_configuration in test_actor.py
fressi-elastic ac7a301
Merge branch 'actor' into track.loader
fressi-elastic 02b4ffa
Fix manager_test.py
fressi-elastic 9d0c148
Update configuration documentation.
fressi-elastic 09d0f93
Update configuration documentation.
fressi-elastic 93ffb39
Merge branch 'actor' into track.loader
fressi-elastic 75b6711
Fix/refactor bootstrap_actor_system function.
fressi-elastic f6d75d9
Merge branch 'actor' into track.loader
fressi-elastic d3d98a3
Remove wrappers for actor_system_already_running method.
fressi-elastic bb605b1
Fix actor_test.py
fressi-elastic 45159a6
Merge branch 'actor' into track.loader
fressi-elastic 055061f
Merge branch 'master' of github.com:elastic/rally into track.loader
fressi-elastic f4cee02
Revert unnecessary changes from rally.py
fressi-elastic 49234fe
Revert unnecessary changes in types_test.py
fressi-elastic 6310247
Simplyfy trasfer manager interface.
fressi-elastic 8881058
Simplyfy trasfer manager interface.
fressi-elastic fd50af5
Make default client TTLs configurable.
fressi-elastic c83c956
Merge branch 'master' of github.com:elastic/rally into track.loader
fressi-elastic e745779
Backport changes from other PRs
fressi-elastic 05aa104
Fix transfer manager.
fressi-elastic 151da50
Fix make install to restore the old behavior.
fressi-elastic 7827c49
Rename function after last day refactoring.
fressi-elastic b0b4b00
Remove files added by mistake.
fressi-elastic e135e48
Remove unnecessary lines.
fressi-elastic 346f8b3
Update configuration documentation.
fressi-elastic 47152f0
Fix Makefile -> make docs
fressi-elastic 981fce9
It adds http and s3 adapters to the main package module.
fressi-elastic 8bfa04b
Update configuration document style.
fressi-elastic 95d591b
Remove file added by mistake.
fressi-elastic 2cc497b
Remove [track] section platform issue mention from configuration docu…
fressi-elastic 6a64709
Merge branch 'master' into track.loader
elasticmachine 4413f0b
Recover all known loggers by copying __dict__ reference from new to o…
fressi-elastic 4e628e8
Some further iteration with all loggers recovered and actor using the…
fressi-elastic 559da2a
Refactor typing annotations and improve code readability.
fressi-elastic 16e4567
Merge branch 'log' into track.loader
fressi-elastic 8d9de3c
Merge branch 'track.loader' of github.com:fressi-elastic/rally into t…
fressi-elastic 3b47362
Use `uv sync` in `make install` goal.
fressi-elastic fae4c00
Fix link to storage section in configuration.rst
fressi-elastic 7ae1bdb
Fix docstring in _adapter.py
fressi-elastic 57b3cc2
Explain how an why the CachedHeadException is being created.
fressi-elastic b463a7d
Update esrally/storage/_manager.py
fressi-elastic 22e87f7
Remove unused attribute.
fressi-elastic 90ee9b7
Remove from __future__ import annotations.
fressi-elastic 51eed90
Update make *docs rules to use `uv run`.
fressi-elastic 65fe996
Create local directory only before starting download to the final des…
fressi-elastic 546d2b3
Some other additional cleanup for readibility to help identify integr…
fressi-elastic 3a59cf7
It updates logging configuration after actor creation.
fressi-elastic e00cf8c
Silence eslastic.log logger.
fressi-elastic c40812b
Backport changes from branch track.loader
fressi-elastic 71754b1
Remove unnecessary checks.
fressi-elastic b6702e8
Merge branch 'log' into track.loader
fressi-elastic f297744
Remove unrelated changes.
fressi-elastic 1704a8f
Merge branch 'log' into track.loader
fressi-elastic 5d323cd
Merge branch 'master' of github.com:elastic/rally into track.loader
fressi-elastic 80dd747
Merge branch 'master' of github.com:elastic/rally into log
fressi-elastic 13dbe36
Merge branch 'log' into track.loader
fressi-elastic 9a1dbeb
Merge branch 'master' of github.com:elastic/rally into track.loader
fressi-elastic c77d3f6
Make S3 adapter optional (once again).
fressi-elastic 014d6aa
Cache missing adapter error to avoid spamming the logging with errors…
fressi-elastic b0685dc
Rename http package and make it used from its final implementation mo…
fressi-elastic 374a8be
Correct configuration documentation.
fressi-elastic 487f818
Relax test_execute_schedule_throughput_throttled test case requirements.
fressi-elastic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,15 +16,21 @@ | |
| # under the License. | ||
|
|
||
| import configparser | ||
| import contextvars | ||
| import logging | ||
| import os.path | ||
| import shutil | ||
| import typing | ||
| from enum import Enum | ||
| from string import Template | ||
|
|
||
| from typing_extensions import Self | ||
|
|
||
| from esrally import PROGRAM_NAME, exceptions, paths, types | ||
| from esrally.utils import io | ||
|
|
||
| LOG = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class Scope(Enum): | ||
| # Valid for all benchmarks, typically read from the configuration file | ||
|
|
@@ -40,6 +46,7 @@ class Scope(Enum): | |
|
|
||
|
|
||
| class ConfigFile: | ||
|
|
||
| def __init__(self, config_name=None, **kwargs): | ||
| self.config_name = config_name | ||
|
|
||
|
|
@@ -124,22 +131,66 @@ def auto_load_local_config(base_config, additional_sections=None, config_file_cl | |
| return cfg | ||
|
|
||
|
|
||
| class Config: | ||
| EARLIEST_SUPPORTED_VERSION = 17 | ||
| CONFIG = contextvars.ContextVar[typing.Optional[types.Config]](f"{__name__}.config", default=None) | ||
|
|
||
|
|
||
| def get_config() -> types.Config: | ||
| cfg = CONFIG.get() | ||
| if cfg is None: | ||
| raise exceptions.ConfigError("Config not initialized.") | ||
| return cfg | ||
|
|
||
|
|
||
| def init_config(cfg: types.Config, *, force=False) -> types.Config: | ||
| if not force and CONFIG.get(): | ||
| raise exceptions.ConfigError(f"Config already set: {cfg}") | ||
| cfg = Config.from_config(cfg) | ||
| CONFIG.set(cfg) | ||
| return cfg | ||
|
|
||
| CURRENT_CONFIG_VERSION = 17 | ||
|
|
||
| def clear_config() -> None: | ||
| CONFIG.set(None) | ||
|
Comment on lines
+144
to
+153
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 2 methods are not used it seems. |
||
|
|
||
|
|
||
| class Config(types.Config): | ||
| """ | ||
| Config is the main entry point to retrieve and set benchmark properties. It provides multiple scopes to allow overriding of values on | ||
| different levels (e.g. a command line flag can override the same configuration property in the config file). These levels are | ||
| transparently resolved when a property is retrieved and the value on the most specific level is returned. | ||
| """ | ||
|
|
||
| def __init__(self, config_name=None, config_file_class=ConfigFile, **kwargs): | ||
| EARLIEST_SUPPORTED_VERSION = 17 | ||
|
|
||
| CURRENT_CONFIG_VERSION = 17 | ||
|
|
||
| @classmethod | ||
| def from_config(cls, cfg: types.Config | None = None) -> Self: | ||
| if cfg is None: | ||
| cfg = get_config() | ||
| if isinstance(cfg, cls): | ||
| return cfg | ||
| if isinstance(cfg, types.Config): | ||
| return cls(opts_from=cfg) | ||
|
Comment on lines
+173
to
+174
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is |
||
| raise TypeError(f"unexpected cfg: got type {type(cfg).__name__}, expected types.Config") | ||
|
|
||
| def __init__(self, config_name: str | None = None, config_file_class=ConfigFile, copy_from: types.Config | None = None, **kwargs): | ||
| self.name = config_name | ||
| self.config_file = config_file_class(config_name, **kwargs) | ||
| self._opts = {} | ||
| self._clear_config() | ||
| if copy_from is not None: | ||
| self.update(copy_from) | ||
| self._override_config() | ||
|
|
||
| def update(self, cfg: types.Config): | ||
| if isinstance(cfg, Config): | ||
| self.name = cfg.name | ||
| self.config_file = cfg.config_file | ||
| self._opts.update(cfg._opts) # pylint: disable=protected-access | ||
| return | ||
| for section in cfg.all_sections(): | ||
| for name, value in cfg.all_opts(section).items(): | ||
| self.add(Scope.application, section, name, value) | ||
|
|
||
| def add(self, scope, section: types.Section, key: types.Key, value): | ||
| """ | ||
|
|
@@ -185,7 +236,10 @@ def opts(self, section: types.Section, key: types.Key, default_value=None, manda | |
| else: | ||
| raise exceptions.ConfigError(f"No value for mandatory configuration: section='{section}', key='{key}'") | ||
|
|
||
| def all_opts(self, section: types.Section): | ||
| def all_sections(self) -> list[types.Section]: | ||
| return list(typing.get_args(types.Section)) | ||
|
|
||
| def all_opts(self, section: types.Section) -> dict[str, typing.Any]: | ||
| """ | ||
| Finds all options in a section and returns them in a dict. | ||
|
|
||
|
|
@@ -233,21 +287,24 @@ def load_config(self, auto_upgrade=False): | |
| def _do_load_config(self): | ||
| config = self.config_file.load() | ||
| # It's possible that we just reload the configuration | ||
| self._clear_config() | ||
| self._opts = {} | ||
| self._override_config() | ||
| self._fill_from_config_file(config) | ||
|
|
||
| def _clear_config(self): | ||
| def _override_config(self): | ||
| # This map contains default options that we don't want to sprinkle all over the source code but we don't want users to change | ||
| # them either | ||
| self._opts = { | ||
| (Scope.application, "source", "distribution.dir"): "distributions", | ||
| (Scope.application, "benchmarks", "track.repository.dir"): "tracks", | ||
| (Scope.application, "benchmarks", "track.default.repository"): "default", | ||
| (Scope.application, "provisioning", "node.name.prefix"): "rally-node", | ||
| (Scope.application, "provisioning", "node.http.port"): 39200, | ||
| (Scope.application, "mechanic", "team.repository.dir"): "teams", | ||
| (Scope.application, "mechanic", "team.default.repository"): "default", | ||
| } | ||
| self._opts.update( | ||
| { | ||
| (Scope.application, "source", "distribution.dir"): "distributions", | ||
| (Scope.application, "benchmarks", "track.repository.dir"): "tracks", | ||
| (Scope.application, "benchmarks", "track.default.repository"): "default", | ||
| (Scope.application, "provisioning", "node.name.prefix"): "rally-node", | ||
| (Scope.application, "provisioning", "node.http.port"): 39200, | ||
| (Scope.application, "mechanic", "team.repository.dir"): "teams", | ||
| (Scope.application, "mechanic", "team.default.repository"): "default", | ||
| } | ||
| ) | ||
|
|
||
| def _fill_from_config_file(self, config): | ||
| for section in config.sections(): | ||
|
|
@@ -279,6 +336,15 @@ def _k(self, scope, section: types.Section, key: types.Key): | |
| else: | ||
| return scope, section, key | ||
|
|
||
| def __eq__(self, other): | ||
| if not isinstance(other, Config): | ||
| return False | ||
| if other.name != self.name: | ||
| return False | ||
| if other._opts != self._opts: | ||
| return False | ||
| return True | ||
|
|
||
|
|
||
| def migrate(config_file, current_version, target_version, out=print, i=input): | ||
| logger = logging.getLogger(__name__) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What is the problem this contextvar addresses?
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 would like to be able to pass a shared configuration object from the very first parent thread (produced after parsing the cmd line), and from actor to actor so we do have global settings always available in the app without having to care to pass them. We should be able to deploy the whole app from it in a deterministic and reproducible way. It would make all the parts far easier to test being a functions of it. Something similar of how I implemented the storage part.
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 don't understand how contextvars facilitate sharing. Each thread has it's own context.
Example:
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.
We should copy the context before when running task and use it in the submitted function. This could be transparently done by the executor itself. Some TODO for later. The nice point with contextvars is you can decide at which point in time you make a copy (fork) of the variables, and later changes will not be considered by other threads. This makes concurrent behavior a bit more predictable.