function exception works if parameter is an Exception objet
e.g.
self.exception(e) with 'e'
will log the exception .
Metwork build 2019-02-07
function exception fails if parameter is an Exception objet :
e.g.
self.exception(e) with 'e' = Exception object
error is ... is not a JSON serializable :
Traceback (most recent call last):
File "/opt/metwork-mfdata-master/opt/python3/lib/python3.5/site-packages/acquisition-0.0.0-py3.5.egg/acquisition/step.py", line 119, in
_exception_safe_call
return func(*args, **kwargs)
File "/home/adminprod/metgate/mfdata/wcsingestion/time_it.py", line 25, in wrapper_timer
result = method(*args, **kw)
File "/home/mfdata/var/plugins/wcsingestion/main.py", line 595, in process
self.exception(e)
File "/opt/metwork-mfdata-master/opt/python3/lib/python3.5/site-packages/acquisition-0.0.0-py3.5.egg/acquisition/step.py", line 565, in
exception
logger.exception(msg, *args, **kwargs)
File "/opt/metwork-mfext-master/opt/python3/lib/python3.5/site-packages/mflog/__init__.py", line 76, in exception
return self.error(event, *args, **kw)
File "/opt/metwork-mfext-master/opt/python3/lib/python3.5/site-packages/mflog/__init__.py", line 72, in error
return self._proxy_to_logger("error", event, *args, **kw)
File "/opt/metwork-mfext-master/opt/python3/lib/python3.5/site-packages/mflog/__init__.py", line 90, in _proxy_to_logger
**event_kw)
File "/opt/metwork-mfext-master/opt/python3/lib/python3.5/site-packages/structlog/_base.py", line 192, in _proxy_to_logger
return getattr(self._logger, method_name)(*args, **kw)
File "/opt/metwork-mfext-master/opt/python3/lib/python3.5/site-packages/mflog/__init__.py", line 128, in _msg_stderr
self._json(**event_dict)
File "/opt/metwork-mfext-master/opt/python3/lib/python3.5/site-packages/mflog/__init__.py", line 137, in _json
self._json_logger.msg(json.dumps(event_dict))
File "/opt/metwork-mfext-master/opt/python3_core/lib/python3.5/json/__init__.py", line 230, in dumps
return _default_encoder.encode(obj)
File "/opt/metwork-mfext-master/opt/python3_core/lib/python3.5/json/encoder.py", line 198, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/opt/metwork-mfext-master/opt/python3_core/lib/python3.5/json/encoder.py", line 256, in iterencode
return _iterencode(o, 0)
File "/opt/metwork-mfext-master/opt/python3_core/lib/python3.5/json/encoder.py", line 179, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: WcsException("Product check failed : Product with id = 'AROME_0.025_SP1_00H06H' does not exist.",) is not JSON serializable
The workaround : convert e as string: e.g.:
self.exception(str(e))
Hi,
There is a regression in AcquisitionStep.
Metwork Build 2019-01-28
function exception works if parameter is an Exception objet e.g. self.exception(e) with 'e' will log the exception .
Metwork build 2019-02-07
function exception fails if parameter is an Exception objet : e.g. self.exception(e) with 'e' = Exception object error is ... is not a JSON serializable :
The workaround : convert e as string: e.g.: self.exception(str(e))