From dcf12762b34737d807758084756a516937652a6a Mon Sep 17 00:00:00 2001 From: Ville Brofeldt <33317356+villebro@users.noreply.github.com> Date: Thu, 22 Oct 2020 07:27:02 +0300 Subject: [PATCH] chore(prophet): ignore logged warning for missing plotly package (#11334) * chore(prophet): ignore logged warning for missing plotly package * reset log level after import --- superset/utils/pandas_postprocessing.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/superset/utils/pandas_postprocessing.py b/superset/utils/pandas_postprocessing.py index 47892e1c58..a0d7e71719 100644 --- a/superset/utils/pandas_postprocessing.py +++ b/superset/utils/pandas_postprocessing.py @@ -14,6 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +import logging from functools import partial from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Union @@ -590,7 +591,12 @@ def _prophet_fit_and_predict( # pylint: disable=too-many-arguments Fit a prophet model and return a DataFrame with predicted results. """ try: + prophet_logger = logging.getLogger("fbprophet.plot") + + prophet_logger.setLevel(logging.CRITICAL) from fbprophet import Prophet # pylint: disable=import-error + + prophet_logger.setLevel(logging.NOTSET) except ModuleNotFoundError: raise QueryObjectValidationError(_("`fbprophet` package not installed")) model = Prophet(