Trivial (hello world) Flask app on OML
in Ask anything
Hi,
I am trying to run a trivial app, I added some logging too. Neither is successfull: I am getting error 503 from the app and logging does not show new entry. I am attaching the full notebook.
Any ideas?
Thanks!
P.S.: Somehow the upload of ipynb is blocked...
Comments
I am getting error 503 from the app
In general a 503 means the app did not start properly. Perhaps an exception is thrown right early in starting up the application.
and logging does not show new entry.
You can get log messages from the app by adding the following to your module's create_app function. Note setting the log level to DEBUG should be done for debugging only - change the log level to ERROR after it works.
Then in your Jupyter or other omega|ml console
Note it doesn't matter whether the app is running locally or on apphub as all log routing is done through om.datasets. The module that does the routing is
OmegaLoggingHandler
. All the other parts are standard Python logging, see https://docs.python.org/3.2/howto/logging.html#logging-advanced-tutorial.There are a few other interesting loggers that you could attach to as follows (this can provide a lot of irrelevant details, use with caution). For details on how Flask logging works, see https://flask.palletsprojects.com/en/1.1.x/logging/
It can help to test the application by running it locally. You can do this by adding the following snippet to your module's
__main__.py
:Then on your console:
Open
http://localhost:8050/apps/username/mymodule
to see the app's page. Note the URI is created by apphub as the default name.Thanks!
I am attaching the working app for reference.
It includes logging and the flask-restx usage.