Announces a server to a host
Project description
Announce Server
A Python library that announces a server to a host.
Installation
pip install announce-server
Development
To install the developer dependencies required for testing and publishing:
pip install -e .[dev,pub]
Build
To build the package, run:
rm -rf dist/ build/ .eggs/ .pytest_cache/ src/announce_server.egg-info/
python -m build --sdist --wheel
To publish:
twine upload dist/*
Test
To run the tests, call:
pytest
Usage
from announce_server import register_service
@register_service(name="server_name", ip="server_ip", port=8000, host_ip="host_server_ip", host_port=5000, retry_interval=5)
def your_function():
pass
Registry
The announce_server
CLI provides a simple way to start a registry server. The registry server keeps track of available services and periodically sends heartbeat messages to ensure that registered services are still active.
Command
announce_server start_registry [--address ADDRESS] [--port PORT] [--heartbeat_interval INTERVAL] [--heartbeat_timeout TIMEOUT]
Arguments
--address ADDRESS
: The IP address of the server. Default:0.0.0.0
.--port PORT
: The port number of the server. Default:4999
.--heartbeat_interval INTERVAL
: The interval between heartbeat messages in seconds. Default:5
.--heartbeat_timeout TIMEOUT
: The timeout for waiting for a response in seconds. Default:3
.
Example
To start the registry server with the default configuration, run:
announce_server start_registry
To start the registry server with a custom IP address, port number, heartbeat interval, and timeout, run:
announce_server start_registry --address localhost --port 4998 --heartbeat_interval 10 --heartbeat_timeout 5
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for announce_server-0.0.2rc0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bc375463c37b4c450559161dbfd4571a89b11741825b0f9fb11945eb8367c6d |
|
MD5 | 0a1fd7a3e8867a0d7cbe246f6f91a2b7 |
|
BLAKE2b-256 | a85669d8f16189dde966d04533fc8235cf5b94b786d925c902dd4337240ccfbd |