def generate_traffic()

in source/notebooks/src/package/generate_endpoint_traffic.py [0:0]


def generate_traffic(X_test):
    """
    Using a feature array as input
    """
    while True:
        # NB: The shuffle will mutate the X_test array in-place, so ensure
        # you're working with a copy if you intend to use the calling argument
        # array elsewhere.
        np.random.shuffle(X_test)
        for example in X_test:
            data_payload = get_data_payload(example)
            invoke_endpoint(data_payload)
            # We invoke the function according to a shifted Poisson distribution
            # to simulate data arriving at random intervals
            time.sleep(poisson.rvs(1, size=1)[0] + np.random.rand() / 100)