def satellites():
    with SatelliteGroup('typical') as satellites:
        yield satellites
        # setup restart column
        ax[3].set_title("Satellite Reconnect")
        ax[3].set_xlabel("Seconds")
        ax[3].axvline(x=DISCONNECT_TIME, alpha=.2, color='red')
        ax[3].axvline(x=RECONNECT_TIME, alpha=.2, color='green')

        for i in range(TRIALS):
            for index, trace, action in [
                    (0, False, None),
                    (1, True, None),
                    (2, True, 'disconnect'),
                    (3, True, 'reconnect')]:

                # Don't initialize using a with statement because we are going
                # to shut this down manually.
                satellites = SatelliteGroup('typical')
                print("trial {} traced {} type {}".format(
                    index, trace, action))

                def satellite_action():
                    if action == 'disconnect':
                        print("shutting down")
                        satellites.shutdown()
                    if action == 'reconnect':
                        print("shutting down")
                        satellites.shutdown()
                        time.sleep(RECONNECT_TIME - DISCONNECT_TIME)
                        satellites.start('typical')
                        print("reconnected")

                # satellites shutdown in the middle of the test
if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('client',
                        help='Name of the client to use in these tests.')
    args = parser.parse_args()

    # two charts stacked on top of eachother, sharing the x axis
    fig, (cpu_ax, dropped_ax) = plt.subplots(2, 1, sharex='col')

    makedirs(path.join(PROJECT_DIR, "graphs"), exist_ok=True)

    sps_list = []
    cpu_list = []
    dropped_list = []

    with SatelliteGroup('typical') as satellites:
        with Controller(args.client) as controller:
            for sps in [500, 1000, 5000, 20000, 50000, 100000]:
                result = controller.benchmark(trace=True,
                                              satellites=satellites,
                                              spans_per_second=sps,
                                              runtime=10,
                                              no_timeout=True)

                print(result)

                dropped_list.append(result.dropped_spans / result.spans_sent)
                cpu_list.append(result.cpu_usage * 100)
                sps_list.append(result.spans_per_second)

    dropped_ax.plot(sps_list, dropped_list)