def main()

in modules/influxdb-subscriber/src/main.py [0:0]


def main():
    parser = argparse.ArgumentParser(description='Parsing arguments')
    parser.add_argument('-t', '--topic',
                       type=str,
                       help='the path to model', default="from/MLoutput/client")
    parser.add_argument('-token', '--token_string',
                       type=str,
                       help='token authentification', default="tCGBk3phIJGWZ2ovMVDuYfN2LCVu8KatBXGLoI9cpwMXZMr--RcWCn4s8LafAF6BjtAWYTp71Bo4F0UvZ-amSA==")
    parser.add_argument('-u', '--url',
                       type=str,
                       help='url', default='http://localhost:8086')
    parser.add_argument('-b', '--bucket_name',
                       type=str,
                       help='InfluxDB bucket name', default='mloutput')
    parser.add_argument('-o', '--org',
                       type=str,
                       help='InfluxDB organization name', default='ggv2demo')
    parser.add_argument('-m', '--measurement_name',
                       type=str,
                   help='InfluxDB measurement name', default='MLoutput_integration')
    args = parser.parse_args()
    print(args.bucket_name)
    ipc_client = awsiot.greengrasscoreipc.connect()
    request = SubscribeToTopicRequest()
    request.topic = args.topic
    handler = StreamHandler(args.token_string, args.url, args.bucket_name, args.org, args.measurement_name)
    operation = ipc_client.new_subscribe_to_topic(handler)
    future = operation.activate(request)
    future.result(TIMEOUT)
    # Keep the main thread alive, or the process will exit.
    while True:
        try:
            selection = input()
        except:
            time.sleep(1)