question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prevent logging at the kedro project level

See original GitHub issue

I’m seeing a number of warnings of the type below but I can’t seem to figure out how to stop kedro from logging these to std console

/envs/kedro_test/lib/python3.7/site-packages/sklearn/linear_model/_least_angle.py:34: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.

I thought the snippet below might work if I add it to the cli.py but it didnt’ do the job… What do I seem to be missing here?

import warnings
# Added because the numpy and sklearn versions class for np.bool type of checks, see below
warnings.filterwarnings("ignore", category=DeprecationWarning,
                        # module="numpy|sklearn|mlflow",
                        message="is a deprecated alias for the builtin")

Warning control on a specific function, module is pretty straightforward. However, this deprecation warning is completely taking over the log file so that we can’t see anything else.

Do you have suggestions where to place these warning filters?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
marcosfeltcommented, Jul 11, 2022

I seem to be having this same problem now with versions 0.18 and above, and the above solutions do not work. Any ideas on changes that need to be made?

1reaction
lorenabalancommented, Apr 21, 2021

Hi @roumail that’s a good point the new hook might be of help here. The new version should be out today.

I thought the snippet below might work if I add it to the cli.py but it didnt’ do the job…

Could you clarify where you’ve added? I’d expect if it’s in the run() command, before creating the KedroSession, it would’ve still worked.

Alternatively you might also look at configuring logging.captureWarnings and having a separate handler for that, but it might be a bit overkill.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prevent logging at the kedro project level · Issue #737 - GitHub
I'm seeing a number of warnings of the type below but I can't seem to figure out how to stop kedro from logging...
Read more >
Logging — Kedro 0.18.4 documentation - Read the Docs
The simplest way to do this is to delete your conf/base/logging.yml file. The logs directory can then also be safely removed. With no...
Read more >
Silence Kedro Logs - Waylon Walker
Once we get the logger, we need to silence it by setting the log level. Typically it's not appropriate to completely turn off...
Read more >
Working with Kedro: Setup - neptune.ai documentation
Setup and logging example# · Create a Kedro project from the pandas-iris starter. · Initialize the Kedro-Neptune plugin. · Add Neptune logging to...
Read more >
Level Up Your MLOps Journey with Kedro | by Dylan Valerio
Starting a kedro project is easy. I've written several things in the code block below. Virtual environments are almost always necessary.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found