l.s.s.testservice : module documentation

Part of lp.services.sitesearch

This script runs a simple HTTP server. The server returns files when given certain user-configurable URLs.
Class RequestHandler Return a file depending on the requested URL.
Function url_to_file_map Return our URL-to-file mapping as a dictionary.
Function service_is_available Return True if the service is up and running.
Function wait_for_service Poll the service and BLOCK until we can connect to it.
Function wait_for_service_shutdown Poll the service until it shuts down.
Function hostpair Parse the host and port number out of a URL string.
Function start_as_process Run this file as a stand-alone Python script.
Function kill_running_process Find and kill any running web service processes.
def url_to_file_map(mapfile):
Return our URL-to-file mapping as a dictionary.
def service_is_available(host, port, timeout=2.0):
Return True if the service is up and running.
ParameterstimeoutBLOCK execution for at most 'timeout' seconds before returning False.
def wait_for_service(host, port, timeout=15.0):
Poll the service and BLOCK until we can connect to it.
ParameterstimeoutThe socket should timeout after this many seconds. Refer to the socket module documentation in the Standard Library for possible timeout values.
def wait_for_service_shutdown(host, port, seconds_to_wait=10.0):
Poll the service until it shuts down.

Raises a RuntimeError if the service doesn't shut down within the allotted time, under normal operation. It may also raise various socket errors if there are issues connecting to the service (host lookup, etc.)

Parametersseconds_to_waitThe number of seconds to wait for the socket to open up.
def hostpair(url):
Parse the host and port number out of a URL string.
def start_as_process(service_binary_name):
Run this file as a stand-alone Python script.

Returns a subprocess.Popen object. (See the subprocess module in the Python Standard Library for details.)

def kill_running_process(service_name, host, port):
Find and kill any running web service processes.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.