synnax
synnax copied to clipboard
Client - py - Fake Data Generation
Motivation
There are many a occasion where we want to load in a test data set, such as demoing the server/UI, running manual tests, and general purpose development.
I'd like to add another cli entrypoint to the python client CLI that generates some relevant, fake data and populates the cluster with it.
Details
We use click as our CLI library of choice. It's probably a good idea to try to set up a simple click application outside of Synnax before integrating a command into the Python client.
Step 1 - Add a new file and command
- Add a new file in the
py/client/synnax/cli
folder calledpopulate.py
and create a new function calledpopulate
that registers a new click command. Make sure to add the command as an entrypoint to thepyproject.toml
file in theclient/py
directory.
Step 2 - Create a populate function with arugments
As arguments to the populate function, take the following arguments:
-
num_channels
- an integer representing the number of channels to create. Should default to50
. -
num_ranges
- an integer representing the number of ranges to create. Should default to20
. -
num_samples
- an integer representing the number of samples to generate for each range in each channel.
Step 3 - Create Channels
Using the num_channels
parameter and an instantiated client, create fake channels with relevant, generated names (think pressure tranducers, thermocouples, etc.)