Skip to content

Commit

Permalink
Add pidfile config for gunicorn
Browse files Browse the repository at this point in the history
  • Loading branch information
anggao committed Oct 14, 2020
1 parent e70d7ed commit 7d48c7f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions python/seldon_core/microservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,13 @@ def main():
help="Set metrics port of seldon service",
)

parser.add_argument(
"--pidfile",
type=str,
default=None,
help="A filepath to use for the PID file",
)

args = parser.parse_args()
parameters = parse_parameters(json.loads(args.parameters))

Expand Down Expand Up @@ -399,6 +406,8 @@ def rest_prediction_server():
"max_requests_jitter": args.max_requests_jitter,
"post_worker_init": post_worker_init,
}
if args.pidfile is not None:
options["pidfile"] = args.pidfile
app = seldon_microservice.get_rest_microservice(
user_object, seldon_metrics
)
Expand Down Expand Up @@ -461,6 +470,8 @@ def rest_metrics_server():
"max_requests_jitter": args.max_requests_jitter,
"post_worker_init": post_worker_init,
}
if args.pidfile is not None:
options["pidfile"] = args.pidfile
StandaloneApplication(app, options=options).run()

logger.info("REST metrics microservice running on port %i", metrics_port)
Expand Down

0 comments on commit 7d48c7f

Please sign in to comment.