Skip to content

Commit

Permalink
Better documentation - rely on Flask
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Meadows committed Aug 14, 2020
1 parent 8cbc6ed commit f164125
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
37 changes: 21 additions & 16 deletions doc/source/python/python_wrapping_docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,24 @@ The service type being created. Available options are:

Set either to 0 or 1. Default is 0. If set to 1 then your model will be saved periodically to redis and loaded from redis (if exists) or created fresh if not.

### FLASK_JSONIFY_PRETTYPRINT_REGULAR

Sets the flask application configuration `JSONIFY_PRETTYPRINT_REGULAR` (see [Configuration Handling - JSONIFY_PRETTYPRINT_REGULAR](https://flask.palletsprojects.com/config/#JSONIFY_PRETTYPRINT_REGULAR)) for the REST API. Available options are `True`
or `False`. If nothing is specified, flask's default value is used.

### FLASK_JSON_SORT_KEYS

Sets the flask application configuration `JSON_SORT_KEYS` (see [Configuration Handling - JSON_SORT_KEYS](https://flask.palletsprojects.com/config/#JSON_SORT_KEYS)) for the REST API. Available options are `True` or `False`.
If nothing is specified, flask's default value is used.

### FLASK_PROPAGATE_EXCEPTIONS

Sets the flask application configuration `PROPAGATE_EXCEPTIONS` (see [Configuration Handling - PROPAGATE_EXCEPTIONS](https://flask.palletsprojects.com/config/#PROPAGATE_EXCEPTIONS)) for the REST API. Available options are `True` or `False`.
If nothing is specified, flask's default value is used.
### Flask Settings

See [Flask - Builtin Configuration Values](https://flask.palletsprojects.com/config/#builtin-configuration-values) for possible configurations; the following are configurable when prefixed with the `FLASK_` string (e.g. `FLASK_JSON_SORT_KEYS` translates to `JSON_SORT_KEYS` in Flask):

- DEBUG
- EXPLAIN_TEMPLATE_LOADING
- JSONIFY_PRETTYPRINT_REGULAR
- JSON_SORT_KEYS
- PROPAGATE_EXCEPTIONS
- PRESERVE_CONTEXT_ON_EXCEPTION
- SESSION_COOKIE_HTTPONLY
- SESSION_COOKIE_SECURE
- SESSION_REFRESH_EACH_REQUEST
- TEMPLATES_AUTO_RELOAD
- TESTING
- TRAP_HTTP_EXCEPTIONS
- TRAP_BAD_REQUEST_ERRORS
- USE_X_SENDFILE

## Creating different service types

Expand Down Expand Up @@ -212,9 +216,10 @@ For more details on custom metrics and the format of the metric dict see [here](
There is an [example notebook illustrating a model with custom metrics in python](../examples/custom_metrics.html).

### Custom Request Tags
```from version 0.3```

To add custom request tags data you can add an optional method ```tags``` which can return a dict of custom meta tags as shown in the example below:
`from version 0.3`

To add custom request tags data you can add an optional method `tags` which can return a dict of custom meta tags as shown in the example below:

```python
class MyModel(object):
Expand Down
5 changes: 4 additions & 1 deletion python/seldon_core/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,20 +173,23 @@ def Metrics():
def _set_flask_app_configs(app):
"""
Set the configs for the flask app based on environment variables
See https://flask.palletsprojects.com/config/#builtin-configuration-values
:param app:
:return:
"""
FLASK_CONFIG_IDENTIFIER = "FLASK_"
FLASK_CONFIGS_BOOL = [
"DEBUG",
"EXPLAIN_TEMPLATE_LOADING",
"TESTING",
"JSONIFY_PRETTYPRINT_REGULAR",
"JSON_SORT_KEYS",
"PROPAGATE_EXCEPTIONS",
"PRESERVE_CONTEXT_ON_EXCEPTION",
"SESSION_COOKIE_HTTPONLY",
"SESSION_COOKIE_SECURE",
"SESSION_REFRESH_EACH_REQUEST",
"TEMPLATES_AUTO_RELOAD",
"TESTING",
"TRAP_HTTP_EXCEPTIONS",
"TRAP_BAD_REQUEST_ERRORS",
"USE_X_SENDFILE",
Expand Down

0 comments on commit f164125

Please sign in to comment.