Opencensus not working with MLFlow
Describe your environment.
- Python 3.7
- opencensus-ext-azure 1.0.7
- opencensus-ext-logging 0.1.0
- mlflow 1.15.0
Steps to reproduce.
import logging
from opencensus.ext.azure.log_exporter import AzureLogHandler
logger = logging.getLogger(__name__)
logger.addHandler(AzureLogHandler(connection_string='InstrumentationKey=<your-key>'))
logger.warning('Hello, World!')
import mlflow
What is the expected behavior? MLFlow should be imported.
What is the actual behavior? It's impossible to import mlflow. Its runs forever.
What is the error message you are getting? How do you know mlflow is not getting imported?
The scripts never ends. I have no error message.
@NastasiaSaby
If you remove either logger.addHandler or import mlflow, the script works?
@Izchen Thank you for your answers. Yes, it works if I remove either logger.addHandler or import mlflow.
I found a workaround, not the cleanest one though.
I import mlflow at the beginning even if it's not useful this way:
import mlflow
import logging
from opencensus.ext.azure.log_exporter import AzureLogHandler
logger = logging.getLogger(__name__)
logger.addHandler(AzureLogHandler(connection_string='InstrumentationKey=<your-key>'))
logger.warning('Hello, World!')
import mlflow
@NastasiaSaby You have two import lines now?
Yes. In reality, the two import lines in my project are in two different files. But you can reproduce the problem by putting all in the same file. @Izchen