ai4os / DEEPaaS

A REST API to serve machine learning and deep learning models
https://deepaas.readthedocs.io
Apache License 2.0
35 stars 15 forks source link

Some options for configuration files are not working #127

Open BorjaEst opened 1 year ago

BorjaEst commented 1 year ago

Some options from: configurations are not working. For example:

Config file:

[DEFAULT]
listen_ip = 0.0.0.0
listen_port = 5000
debug_endpoint = false
workers = 1
client_max_size = 0
warm = true
debug = true
#log_config_append = <None>
#log_date_format = %Y-%m-%d %H:%M:%S
#log_dir = <None>
#watch_log_file = false
use_syslog = false
#use_journal = false
#syslog_log_facility = LOG_USER
use_json = false
use_stderr = true
use_eventlog = false
#log_rotate_interval = 1
#log_rotate_interval_type = days
#max_logfile_count = 30
#max_logfile_size_mb = 200
#log_rotation_type = none
default_log_levels = websocket=DEBUG,requests=DEBUG
publish_errors = true
rate_limit_interval = 0
rate_limit_except_level = CRITICAL
fatal_deprecations = false

Error message:

$  cd /home/borja/projects/demo-advanced-api ; /usr/bin/env /home/borja/miniconda3/envs/DEEPaaS/bin/python /home/borja/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 57883 -- -m deepaas.cmd.run --config-file=deepaas.conf --debug 
Traceback (most recent call last):
  File "/home/borja/miniconda3/envs/DEEPaaS/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/borja/miniconda3/envs/DEEPaaS/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/borja/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
    cli.main()
  File "/home/borja/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
    run()
  File "/home/borja/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 317, in run_module
    run_module_as_main(options.target, alter_argv=True)
  File "/home/borja/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 238, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/borja/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
    exec(code, run_globals)
  File "/home/borja/miniconda3/envs/DEEPaaS/lib/python3.10/site-packages/deepaas/cmd/run.py", line 124, in <module>
    main()
  File "/home/borja/miniconda3/envs/DEEPaaS/lib/python3.10/site-packages/deepaas/cmd/run.py", line 96, in main
    config.config_and_logging(sys.argv)
  File "/home/borja/miniconda3/envs/DEEPaaS/lib/python3.10/site-packages/deepaas/config.py", line 81, in config_and_logging
    log.setup(cfg.CONF, "deepaas")
  File "/home/borja/miniconda3/envs/DEEPaaS/lib/python3.10/site-packages/oslo_log/log.py", line 273, in setup
    _setup_logging_from_conf(conf, product_name, version)
  File "/home/borja/miniconda3/envs/DEEPaaS/lib/python3.10/site-packages/oslo_log/log.py", line 412, in _setup_logging_from_conf
    handler = importutils.import_object(
  File "/home/borja/miniconda3/envs/DEEPaaS/lib/python3.10/site-packages/oslo_utils/importutils.py", line 44, in import_object
    return import_class(import_str)(*args, **kwargs)
  File "/home/borja/miniconda3/envs/DEEPaaS/lib/python3.10/site-packages/oslo_utils/importutils.py", line 30, in import_class
    __import__(mod_str)
ModuleNotFoundError: No module named 'oslo_messaging'

Additional info

Maybe missing oslo_messaging from requirements at deepaas?

alvarolopez commented 1 year ago

This is caused by the publish_errors option set to true. This option makes oslo_log to use a special handler to publish errors, and the handler is coming from oslo_messaging here https://github.com/openstack/oslo.log/blob/b5b8c30b0d925aa3d31b58932c94586631827b62/oslo_log/log.py#L429

To be honest I think this should be fixed upstream, not by us, either by setting oslo_messaging a required or an optional dependency.