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

The full syntax is equivalent to:

announce_server start_registry --address 0.0.0.0 --port 4999 --heartbeat_interval 5 --heartbeat_timeout 3

To test connections, run:

announce_server start_client --host-ip 0.0.0.0 --host-port 4999

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.3rc0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

announce_server-0.0.3rc0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file announce-server-0.0.3rc0.tar.gz.

File metadata

  • Download URL: announce-server-0.0.3rc0.tar.gz
  • Upload date:
  • Size: 9.3 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.3rc0.tar.gz
Algorithm Hash digest
SHA256 ab783272105e7de13feb34fc2af184823a87337372542a68159ea265a34fd6c2
MD5 bee931baf081985327d1ce389745ec89
BLAKE2b-256 e8157f64c3b4dd6ce661405970135db565cc51fa5f5640ec2fc87fed4f1c2957

See more details on using hashes here.

File details

Details for the file announce_server-0.0.3rc0-py3-none-any.whl.

File metadata

File hashes

Hashes for announce_server-0.0.3rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f77313a46c3aadaa8508fa92081b67a9eb17475d14383be61abdbacb3111dce
MD5 107e08d602f55a180f54971a812f507b
BLAKE2b-256 b9a818b992d6499eadaaf65a58bf63f177fd9d32081f55fe18c8a83d0520415f

See more details on using hashes here.

Supported by

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