cosmic_ray.distribution package¶
Submodules¶
cosmic_ray.distribution.distributor module¶
Base distributor implementation details.
- class cosmic_ray.distribution.distributor.Distributor¶
Bases:
objectBase class for work distribution strategies.
cosmic_ray.distribution.http module¶
Cosmic Ray distributor that sends work requests over HTTP to workers.
This uses a list of URLs to workes, distributing work to them as they’re available.
Enabling the distributor¶
To use the http distributor, set cosmic-ray.distributor.name = "http" in your Cosmic Ray configuration, and
configure the list of worker URLs in cosmic-ray.distributor.http.worker-urls:
[cosmic-ray.distributor]
name = "http"
[cosmic-ray.distributor.http]
worker-urls = ['http://localhost:9876', 'http://localhost:9877']
- class cosmic_ray.distribution.http.HttpDistributor¶
Bases:
DistributorThe http distributor.
This forwards mutate-and-test requests to HTTP servers which do the actual work and return the results.
- async cosmic_ray.distribution.http.handle_mutate_and_test(request)¶
HTTP endpoint handler for requests to mutate-and-test.
- cosmic_ray.distribution.http.run_worker(port=None, path=None)¶
Run the worker HTTP server.
You must specify either port or path, but not both.
- Parameters:
port – The TCP port on which to listen.
path – Path to Unix domain socket on which to listen.
- async cosmic_ray.distribution.http.send_request(url, work_item: WorkItem, test_command, timeout)¶
Sends a mutate-and-test request to a worker.
- Parameters:
url – The URL of the worker.
work_item – The WorkItem representing the work to be done.
test_command – The command that the worker should use to run the tests.
timeout – The maximum number of seconds to spend running the test.
Returns: A WorkResult.
cosmic_ray.distribution.local module¶
Cosmic Ray distributor that runs tests sequentially and locally.
Enabling the distributor¶
To use the local distributor, set cosmic-ray.distributor.name = "local" in your Cosmic Ray configuration:
[cosmic-ray.distributor]
name = "local"
- class cosmic_ray.distribution.local.LocalDistributor¶
Bases:
DistributorThe local distributor.