Skip to content

Commit

Permalink
Add --max-requests and --max-requests jitter parameters for python wr…
Browse files Browse the repository at this point in the history
…apper #911
  • Loading branch information
kparaju committed Oct 8, 2019
1 parent 7ea2018 commit 7297489
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion python/seldon_core/microservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,19 @@ def main():
parser.add_argument("--log-level", type=str, default="INFO")
parser.add_argument("--tracing", nargs='?',
default=int(os.environ.get("TRACING", "0")), const=1, type=int)
parser.add_argument("--workers", type=int, default=int(os.environ.get("GUNICORN_WORKERS", "1")))
# gunicorn settings, defaults are from http://docs.gunicorn.org/en/stable/settings.html
parser.add_argument("--workers",
type=int,
default=int(os.environ.get("GUNICORN_WORKERS", "1")),
help="Number of gunicorn workers for handling requests.")
parser.add_argument("--max-requests",
type=int,
default=int(os.environ.get("GUNICORN_MAX_REQUESTS", "0")),
help="Maximum number of requests gunicorn worker will process before restarting.")
parser.add_argument("--max-requests-jitter",
type=int,
default=int(os.environ.get("GUNICORN_MAX_REQUESTS_JITTER", "0")),
help="Maximum random jitter to add to max-requests.")

args = parser.parse_args()

Expand Down Expand Up @@ -256,6 +268,8 @@ def rest_prediction_server():
'timeout': 5000,
'reload': 'true',
'workers': args.workers,
'max_requests': args.max_requests,
'max_requests_jitter': args.max_requests_jitter
}
app = seldon_microservice.get_rest_microservice(user_object)
StandaloneApplication(app,user_object,options=options).run()
Expand Down

0 comments on commit 7297489

Please sign in to comment.