Пример #1
0
        def rest_prediction_server():
            options = {
                "bind": "%s:%s" % ("0.0.0.0", http_port),
                "accesslog": accesslog(args.access_log),
                "loglevel": args.log_level.lower(),
                "timeout": 5000,
                "threads": threads(args.threads, args.single_threaded),
                "workers": args.workers,
                "max_requests": args.max_requests,
                "max_requests_jitter": args.max_requests_jitter,
                "post_worker_init": post_worker_init,
                "worker_exit": partial(worker_exit,
                                       seldon_metrics=seldon_metrics),
            }
            if args.pidfile is not None:
                options["pidfile"] = args.pidfile
            app = seldon_microservice.get_rest_microservice(
                user_object, seldon_metrics)

            UserModelApplication(
                app,
                user_object,
                jaeger_extra_tags,
                args.interface_name,
                options=options,
            ).run()
Пример #2
0
        def rest_prediction_server():
            rest_timeout = DEFAULT_ANNOTATION_REST_TIMEOUT
            if ANNOTATION_REST_TIMEOUT in annotations:
                # Gunicorn timeout is in seconds so convert as annotation is in miliseconds
                rest_timeout = int(annotations[ANNOTATION_REST_TIMEOUT]) / 1000
                # Converting timeout from float to int and set to 1 if is 0
                rest_timeout = int(rest_timeout) or 1

            options = {
                "bind": "%s:%s" % ("0.0.0.0", http_port),
                "accesslog": accesslog(args.access_log),
                "loglevel": args.log_level.lower(),
                "timeout": rest_timeout,
                "threads": threads(args.threads, args.single_threaded),
                "workers": args.workers,
                "max_requests": args.max_requests,
                "max_requests_jitter": args.max_requests_jitter,
                "post_worker_init": post_worker_init,
                "worker_exit": partial(worker_exit,
                                       seldon_metrics=seldon_metrics),
                "keepalive": args.keepalive,
            }
            logger.info(f"Gunicorn Config:  {options}")

            if args.pidfile is not None:
                options["pidfile"] = args.pidfile
            app = seldon_microservice.get_rest_microservice(
                user_object, seldon_metrics)

            UserModelApplication(
                app,
                user_object,
                args.tracing,
                jaeger_extra_tags,
                args.interface_name,
                options=options,
            ).run()