Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

announce-server-0.0.2rc1.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

announce_server-0.0.2rc1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file announce-server-0.0.2rc1.tar.gz.

File metadata

  • Download URL: announce-server-0.0.2rc1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for announce-server-0.0.2rc1.tar.gz
Algorithm Hash digest
SHA256 bd157e157e4700ab520421428c155dadde446ce94859d2cf466d58e4d0a66a1c
MD5 28556a943686dc5a8e51d88c47f0326b
BLAKE2b-256 b574d3ac52b8db944db9a5dfd62e5d96f8e726070cd737e81edb5b69b232d947

See more details on using hashes here.

File details

Details for the file announce_server-0.0.2rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for announce_server-0.0.2rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 6624512b6b2dcff48a96bdaa9256e4e0351e097672394c83086e0594af68a3f4
MD5 d4e2f0acf09029464b12e92bb4850b46
BLAKE2b-256 549b18f1bf3d57fac7a8630aa067eb9bc746e75b3bc3e5f500601dca6535214e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page