Phase
This page contains the API documentation for the gradual.runners.phase module.
gradual.runners.phase
The phase module provides the Phase class which represents a single test phase in the stress testing framework. A phase is a self-contained unit of testing that can be executed independently and has its own configuration and runtime constraints.
Classes
Phase(phase_config: PhaseConfig, run_name: str)
Represents a single test phase in the stress testing framework.
A phase is a self-contained unit of testing that: 1. Has its own configuration and runtime constraints 2. Manages its own test runner and reporting 3. Can be executed independently of other phases 4. Has timeout protection to prevent indefinite execution
Attributes:
| Name | Type | Description |
|---|---|---|
phase_config |
PhaseConfig
|
Configuration for this test phase |
reporting_object |
Stats
|
Statistics and reporting handler for this phase |
runner |
Runner
|
Test runner instance that executes the actual tests |
Initialize a new test phase.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
phase_config
|
PhaseConfig
|
Configuration for this test phase |
required |
run_name
|
str
|
Unique identifier for this test run |
required |
Source code in src/gradual/runners/phase.py
Attributes
phase_config = phase_config
instance-attribute
reporting_object = Stats(self.phase_config, run_name)
instance-attribute
runner = Runner(self.phase_config.scenario_config)
instance-attribute
Functions
execute()
Execute the test phase.
This method: 1. Spawns a new test runner in a gevent greenlet 2. Monitors the execution with a timeout 3. Handles timeout conditions gracefully 4. Manages the lifecycle of the test execution
Source code in src/gradual/runners/phase.py
stop_phase()
Stop the test phase execution.
This method: 1. Logs the stopping of the phase 2. Stops the test runner 3. Confirms the phase has been stopped