chainbench
Advanced tools
+33
-8
@@ -87,2 +87,16 @@ import os | ||
| def validate_profile_path(ctx: Context, param: Parameter, value: str) -> str: | ||
| if value is not None: | ||
| if "profile_dir" or "profile" in ctx.params: | ||
| click.echo("WARNING: Profile and Profile Directory options are ignored when --profile-path flag is used.") | ||
| if "method" in ctx.params: | ||
| click.echo("WARNING: Profile and Profile Directory options are ignored when method argument is used.") | ||
| """Validate profile path.""" | ||
| abs_profile_path = Path(value).resolve() | ||
| if not abs_profile_path.exists(): | ||
| raise FileNotFoundError(f"Profile path not found: {abs_profile_path}") | ||
| profile_exists(abs_profile_path.name.removesuffix(".py"), abs_profile_path.parent) | ||
| return value | ||
| @cli.command( | ||
@@ -112,2 +126,10 @@ help="Start a load test on the specified method. " | ||
| @click.option( | ||
| "--profile-path", | ||
| default=None, | ||
| callback=validate_profile_path, | ||
| type=click.Path(exists=True, dir_okay=False, file_okay=True, path_type=Path), | ||
| help="Path to profile locustfile to be run. Overrides --profile and --profile-dir options.", | ||
| show_default=True, | ||
| ) | ||
| @click.option( | ||
| "-s", | ||
@@ -198,2 +220,3 @@ "--shape", | ||
| profile_dir: Path | None, | ||
| profile_path: Path | None, | ||
| shape: str | None, | ||
@@ -249,14 +272,16 @@ host: str, | ||
| if method: | ||
| profile_path = Path(all_methods[method]) | ||
| final_profile_path = Path(all_methods[method]) | ||
| elif profile_path: | ||
| final_profile_path = profile_path | ||
| elif profile: | ||
| profile_path = get_profile_path(profile_dir, profile) | ||
| final_profile_path = get_profile_path(profile_dir, profile) | ||
| else: | ||
| profile_path = profile_dir | ||
| final_profile_path = profile_dir | ||
| if not profile_path.exists(): | ||
| click.echo(f"Profile path {profile_path} does not exist.") | ||
| if not final_profile_path.exists(): | ||
| click.echo(f"Profile path {final_profile_path} does not exist.") | ||
| sys.exit(1) | ||
| user_classes = {} | ||
| for locustfile in parse_locustfile_paths([profile_path.__str__()]): | ||
| for locustfile in parse_locustfile_paths([final_profile_path.__str__()]): | ||
| _, _user_classes, _ = load_locustfile(locustfile) | ||
@@ -280,3 +305,3 @@ for key, value in _user_classes.items(): | ||
| sys.exit(1) | ||
| profile = profile_path.name | ||
| profile = final_profile_path.name | ||
| if not headless: | ||
@@ -337,3 +362,3 @@ enable_class_picker = True | ||
| locust_options = LocustOptions( | ||
| profile_path=profile_path, | ||
| profile_path=final_profile_path, | ||
| host=host, | ||
@@ -340,0 +365,0 @@ port=port, |
@@ -45,2 +45,12 @@ import subprocess | ||
| def validate_profile_path(profile_path: Path) -> None: | ||
| """Validate profile path.""" | ||
| abs_profile_path = profile_path.resolve() | ||
| if not profile_path.resolve().exists(): | ||
| raise FileNotFoundError(f"Profile file not found: {profile_path}") | ||
| profiles = get_profiles(abs_profile_path.parent) | ||
| if profile_path.stem.removesuffix(".py") not in profiles: | ||
| raise ValueError(f"Profile file not found: {profile_path}") | ||
| def generate_unique_dir_name() -> str: | ||
@@ -47,0 +57,0 @@ return datetime.now().strftime("%Y-%m-%d_%H-%M-%S") |
+12
-11
| Metadata-Version: 2.1 | ||
| Name: chainbench | ||
| Version: 0.8.3 | ||
| Version: 0.8.4 | ||
| Summary: | ||
@@ -58,7 +58,6 @@ Author: Egor Molodik | ||
| Chainbench lets you to easily define profiles for any EVM-compatible chain. | ||
| You can use not only hard-coded values but also real chain data to generate dynamic call parameters. | ||
| Chainbench allows easy profile definition for any EVM-compatible blockchain and Solana, including partial support for Starknet. You can use both hard-coded values and real chain data for dynamic call parameters. | ||
| Main features: | ||
| - Built-in profiles for Ethereum, Binance Smart Chain, Polygon, Oasis, Avalanche and Solana | ||
| - Built-in profiles for Ethereum, Binance Smart Chain, Polygon, Solana, Base, Arbitrum, Avalanche, Fantom, Gnosis, Oasis, Optimism, Ronin and Starknet, as well as some generic EVM-based profiles | ||
| - Support for custom profiles | ||
@@ -138,8 +137,10 @@ - Dynamic call params generation using real chain data | ||
| ### Parameters and Flags | ||
| - `-p, --profile`: Specifies the profile to use for the benchmark. Available profiles can be found in the profile directory. Sample usage `-p bsc.general` | ||
| - `-s, --shape`: Specifies the shape of the load pattern. List available shapes with `chainbench list shapes`. | ||
| - `-u, --users`: Sets the number of simulated users to use for the benchmark. | ||
| - `-r, --spawn-rate`: Sets the spawn rate of users per second. | ||
| - `-w, --workers`: Sets the number of worker threads to use for the benchmark. | ||
| - `-t, --test-time`: Sets the duration of the test to run. | ||
| - `-p`, `--profile`: Specifies the profile to use for the benchmark. Available profiles can be found in the profile directory. Sample usage `-p bsc.general` | ||
| - `-d`, `--profile-dir`: Specifies the base directory to use which contain profiles, supporting up to one-level of subdirectories. | ||
| - `--profile-path`: Specifies the full path to the profile file to use for the benchmark. Overrides `--profile` and `--profile-dir` options. | ||
| - `-s`, `--shape`: Specifies the shape of the load pattern. List available shapes with `chainbench list shapes`. | ||
| - `-u`, `--users`: Sets the number of simulated users to use for the benchmark. | ||
| - `-r`, `--spawn-rate`: Sets the spawn rate of users per second. | ||
| - `-w`, `--workers`: Sets the number of worker threads to use for the benchmark. | ||
| - `-t`, `--test-time`: Sets the duration of the test to run. | ||
| - `--target`: Specifies the target blockchain node URL that the benchmark will connect to. | ||
@@ -150,3 +151,3 @@ - `--headless`: Runs the benchmark in headless mode, meaning that no graphical user interface (GUI) will be displayed during the test. This is useful for running the test on a remote server or when the GUI is not needed. | ||
| - `--debug-trace-methods`: Enables tasks tagged with debug or trace to be executed | ||
| - `-E, --exclude-tags`: Exclude tasks tagged with custom tags from the test. You may specify this option multiple times. | ||
| - `-E`, `--exclude-tags`: Exclude tasks tagged with custom tags from the test. You may specify this option multiple times. | ||
| - `--use-latest-blocks`: Use latest blocks for test data generation and runs a background process to update the test data with latest blocks. | ||
@@ -153,0 +154,0 @@ - `--size`: Specifies the test data size. Available values are XS, S, M, L, XL. Default is S. |
+1
-1
| [tool.poetry] | ||
| name = "chainbench" | ||
| version = "0.8.3" | ||
| version = "0.8.4" | ||
| description = "" | ||
@@ -5,0 +5,0 @@ authors = [ |
+11
-10
@@ -35,7 +35,6 @@ <img width="1200" alt="Labs" src="https://user-images.githubusercontent.com/99700157/213291931-5a822628-5b8a-4768-980d-65f324985d32.png"> | ||
| Chainbench lets you to easily define profiles for any EVM-compatible chain. | ||
| You can use not only hard-coded values but also real chain data to generate dynamic call parameters. | ||
| Chainbench allows easy profile definition for any EVM-compatible blockchain and Solana, including partial support for Starknet. You can use both hard-coded values and real chain data for dynamic call parameters. | ||
| Main features: | ||
| - Built-in profiles for Ethereum, Binance Smart Chain, Polygon, Oasis, Avalanche and Solana | ||
| - Built-in profiles for Ethereum, Binance Smart Chain, Polygon, Solana, Base, Arbitrum, Avalanche, Fantom, Gnosis, Oasis, Optimism, Ronin and Starknet, as well as some generic EVM-based profiles | ||
| - Support for custom profiles | ||
@@ -115,8 +114,10 @@ - Dynamic call params generation using real chain data | ||
| ### Parameters and Flags | ||
| - `-p, --profile`: Specifies the profile to use for the benchmark. Available profiles can be found in the profile directory. Sample usage `-p bsc.general` | ||
| - `-s, --shape`: Specifies the shape of the load pattern. List available shapes with `chainbench list shapes`. | ||
| - `-u, --users`: Sets the number of simulated users to use for the benchmark. | ||
| - `-r, --spawn-rate`: Sets the spawn rate of users per second. | ||
| - `-w, --workers`: Sets the number of worker threads to use for the benchmark. | ||
| - `-t, --test-time`: Sets the duration of the test to run. | ||
| - `-p`, `--profile`: Specifies the profile to use for the benchmark. Available profiles can be found in the profile directory. Sample usage `-p bsc.general` | ||
| - `-d`, `--profile-dir`: Specifies the base directory to use which contain profiles, supporting up to one-level of subdirectories. | ||
| - `--profile-path`: Specifies the full path to the profile file to use for the benchmark. Overrides `--profile` and `--profile-dir` options. | ||
| - `-s`, `--shape`: Specifies the shape of the load pattern. List available shapes with `chainbench list shapes`. | ||
| - `-u`, `--users`: Sets the number of simulated users to use for the benchmark. | ||
| - `-r`, `--spawn-rate`: Sets the spawn rate of users per second. | ||
| - `-w`, `--workers`: Sets the number of worker threads to use for the benchmark. | ||
| - `-t`, `--test-time`: Sets the duration of the test to run. | ||
| - `--target`: Specifies the target blockchain node URL that the benchmark will connect to. | ||
@@ -127,3 +128,3 @@ - `--headless`: Runs the benchmark in headless mode, meaning that no graphical user interface (GUI) will be displayed during the test. This is useful for running the test on a remote server or when the GUI is not needed. | ||
| - `--debug-trace-methods`: Enables tasks tagged with debug or trace to be executed | ||
| - `-E, --exclude-tags`: Exclude tasks tagged with custom tags from the test. You may specify this option multiple times. | ||
| - `-E`, `--exclude-tags`: Exclude tasks tagged with custom tags from the test. You may specify this option multiple times. | ||
| - `--use-latest-blocks`: Use latest blocks for test data generation and runs a background process to update the test data with latest blocks. | ||
@@ -130,0 +131,0 @@ - `--size`: Specifies the test data size. Available values are XS, S, M, L, XL. Default is S. |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
324730
0.77%9016
0.35%