Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
WesleyEe authored Nov 24, 2022
1 parent 9b7964d commit ff13ff6
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions README.md
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.

0 comments on commit ff13ff6

Please sign in to comment.