Closed potiuk closed 2 years ago
The change https://github.com/yandex-cloud/python-sdk/pull/33 broke logging functionality.
Yandexloud 0.142, 0.143, 0.144 and 0.145 are broken.
For example it generates this error:
/usr/local/lib/python3.7/site-packages/yandexcloud/_wrappers/dataproc/__init__.py:466: in create_hive_job self.log.info("Running Hive job. Cluster ID: {cluster_id}", cluster_id=cluster_id) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <RootLogger root (INFO)>, msg = 'Running Hive job. Cluster ID: {cluster_id}', args = (), kwargs = {'cluster_id': 'my_cluster_id'} def info(self, msg, *args, **kwargs): """ Log 'msg % args' with severity 'INFO'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.info("Houston, we have a %s", "interesting problem", exc_info=1) """ if self.isEnabledFor(INFO): > self._log(INFO, msg, args, **kwargs) E TypeError: _log() got an unexpected keyword argument 'cluster_id' /usr/local/lib/python3.7/logging/__init__.py:1378: TypeError ---------------------------------------------------------------------------------
The problem is that Python logging does not support "brace" style logging by default and unless you configure your application, it only supports "%" style logging.
See https://docs.python.org/3/howto/logging-cookbook.html#using-particular-formatting-styles-throughout-your-application
Brace style parameters should not be used in libraries, because you never know how customers of your library will use it.
My bad, reverted change, should work in v0.146.0 https://github.com/yandex-cloud/python-sdk/blob/master/CHANGELOG.md#changelog
Merged an update for that today.
The change https://github.com/yandex-cloud/python-sdk/pull/33 broke logging functionality.
Yandexloud 0.142, 0.143, 0.144 and 0.145 are broken.
For example it generates this error:
The problem is that Python logging does not support "brace" style logging by default and unless you configure your application, it only supports "%" style logging.
See https://docs.python.org/3/howto/logging-cookbook.html#using-particular-formatting-styles-throughout-your-application
Brace style parameters should not be used in libraries, because you never know how customers of your library will use it.