DEEPaaS icon indicating copy to clipboard operation
DEEPaaS copied to clipboard

Debug level is not propagated to service threads

Open BorjaEst opened this issue 2 years ago • 1 comments

Description

Logger output on predict and train functions with lower level than WARN is not printed on stderr.

Steps to Reproduce

  1. Download demo_app (or any other use case).
  2. Create a logger in the api module and log in get_meatada and predict using debug, for example:
import logging
logger = logging.getLogger(__name__)

def get_metadata():
    logger.debug("Some debug information")
    return {"status": "All ok, debug was printed"}

def get_predict_args():
    return {}

def predict(**kwargs):
    logger.debug("Some debug information")
    return {"status": "Debug was not printed"}
  1. Create a configuration file which set debug level to "DEBUG" (./deepaas.conf):
[DEFAULT]
debug = true
log_date_format = %Y-%m-%d %H:%M:%S
  1. Run using the confg file: deepaas-run --config-file deepaas.conf

Expected behavior:

When calling predict / train method, debug information should be printed. (like in ´get_metadata`)

Actual behavior

Only logger print levels higher or equal than WARN are printed on predict / train method.

Versions

$ deepaas-run --version
2.1.0

Extra information

I see the functions predict and train are executed by workers. However, the logger level at those workers seems to not be inherited from the original logger level.

BorjaEst avatar May 30 '23 09:05 BorjaEst

@IgnacioHeredia, I think this issue is related to what we spoke today. I was testing with @vykozlov and there might be a race condition somewhere:

  • Starting with --debug and no config, prints debug info at the beginning but not from methods.
  • Starting without --debug but config, does not print debug at the beginning but does for methods.

Also, when I created this issue, I was testing with the config and not with --debug, it might happen that aiohttp does not propagate logger to workers if arg --debug is not set? Not sure how much is worth value to investigate if a new version is comming with different web framework.

BorjaEst avatar Nov 15 '23 16:11 BorjaEst