-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,28 @@ | ||
# Synapse Test Utils Library | ||
# Synapse Utils Library | ||
|
||
## heartbeat.py | ||
## Overview | ||
|
||
This is a utility library for Synapse development. You can import it at the top of your python script with | ||
``` | ||
import synapse_utils | ||
``` | ||
It contains a range of helper modules/functions for development purposes (eg. creating tests for Crossbar components). | ||
|
||
## How To Use | ||
|
||
To import this package with poetry as dependency package manager: | ||
``` | ||
poetry add git+https://github.com/SPHTech/synapse-utils.git | ||
``` | ||
|
||
## Documentation for package modules | ||
|
||
### heartbeat.py | ||
|
||
For Kubernetes(K8s) deployment, readiness and liveness probes are used to check if the container in the pod is ready and still functioning. | ||
|
||
Upon start-up, each crossbar component will register a Remote Procedure Call (RPC) on its own "heartbeat" topic. K8s readiness and liveness probes would trigger a [heartbeat component script](heartbeat.py), and this component would call that heartbeat RPC. The crossbar component is deemed to be working if the trigger completes successfully, else the probes would fail and the container in the pod would be restarted. | ||
|
||
## probe.py | ||
### probe.py | ||
|
||
Contains functions to start up a component and block until it is ready, as well as to make a crossbar component that subscribes to a crossbar topic and store the messages it receives. |