Execution Modes
Overview
When executing a test configuration (a set of tests against an endpoint), Rhesis supports two execution modes: Sequential and Parallel. The mode determines how multiple tests are scheduled and executed.
Parallel Execution (Default)
Description
A single Celery task runs the tests concurrently through an async batch engine. This is the default mode and the fastest.
How It Works
- Tests are executed asynchronously within a single worker task
- Concurrency is managed internally using an asyncio batch runner and semaphore limits
- Results are collected after the entire batch completes
Use Cases
Best for: independent tests against endpoints that handle concurrent requests without rate limits, and large test suites where speed matters.
Considerations: may overwhelm an endpoint or hit rate limits, and concurrent failures are harder to debug.
Configuration
Parallel is the default mode. No configuration needed:
Or explicitly set:
Sequential Execution
Description
Tests are executed one after another in sequence. Each test must complete before the next one starts.
How It Works
- Tests execute in order
- One test at a time
- No concurrent load on endpoint
- Predictable execution pattern
Use Cases
Best for: rate-limited or stateful endpoints, tests with dependencies on each other, and debugging (one test at a time is easier to trace).
Considerations: slower overall, with longer waits for results.
Configuration
Set in test configuration attributes:
Or programmatically:
Implementation Details
Execution Flow
Both modes produce identical result structures:
Result Processing
Both modes use the same collect_results task for consistency:
- Status tracking:
status,final_status,task_state - Progress metrics:
completed_tests,failed_tests,total_tests - Timing information:
started_at,completed_at,execution_time - Email notifications triggered for both modes
Task Orchestration
Parallel Mode (batch/__init__.py)
Parallel mode now uses a single task with an internal async fan-out:
Inside run_batch, each test is executed as an asyncio task and guarded by:
batch_concurrency(default10)per_test_timeout(default1800seconds)- cooperative cancellation checks against Celery revoke state
- one recovery pass for transient failures
Sequential Mode (sequential.py)
Sequential mode runs each test one-by-one in process, then triggers the same results collection task used by parallel mode:
Choosing an Execution Mode
Decision Matrix
| Scenario | Recommended Mode | Reason |
|---|---|---|
| Production regression suite | Parallel | Fast feedback, independent tests |
| Rate-limited API | Sequential | Avoid hitting rate limits |
| Development/debugging | Sequential | Easier to trace issues |
| High-traffic endpoint | Parallel | Endpoint designed for load |
| Tests have dependencies | Sequential | Ensure proper order |
| Small test suite (< 5 tests) | Either | Minimal time difference |
| Large test suite (> 50 tests) | Parallel | Significant time savings |
| Stateful endpoint | Sequential | Maintain state consistency |
Performance Comparison
Example with 20 tests, 5s average test time:
| Mode | Execution Time | Resource Usage |
|---|---|---|
| Parallel (concurrency 5) | ~20-25 seconds | High |
| Sequential | ~100 seconds | Low |
Monitoring and Debugging
Parallel Mode
Sequential Mode
Common Issues
Parallel Mode:
- Endpoint returns 429 (rate limit) → Switch to Sequential
- Inconsistent test results → Check for race conditions
- Worker overload → Reduce concurrency or use Sequential
- Run stuck in
Progressafter worker issues → check task failure/revoked signals and run status transitions
Sequential Mode:
- Tests taking too long → Consider Parallel if endpoint can handle it
- Bottleneck in single test → Optimize that test first
Related Documentation
- Test Execution System - Overall architecture
- Test Types - Single-turn vs Multi-turn
- Background Tasks - Celery configuration
- Architecture - Worker system details