[protobuf] Error in UDF using google protobuf

2018-06-07 Thread Arghya Basu
I am getting the following error when executing UDF function. Please help 
to resolve the issue.


ts=2018-06-07T19:37:37.864Z lvl=info msg="UDF log" service=udf 
text="2018-06-07 19:37:37,864 INFO:root: Starting Agent"
ts=2018-06-07T19:37:37.864Z lvl=info msg="UDF log" service=udf 
text="Traceback (most recent call last):"
ts=2018-06-07T19:37:37.864Z lvl=info msg="UDF log" service=udf text="  File 
\"/home/ubuntu/kapacitor/udf/agent/py/kapacitor/udf/agent.py\", line 104, 
in _read_loop"
ts=2018-06-07T19:37:37.864Z lvl=info msg="UDF log" service=udf text="
response = self.handler.info()"
ts=2018-06-07T19:37:37.864Z lvl=info msg="UDF log" service=udf text="  File 
\"/home/ubuntu/kapacitor/udf/agent/examples/outliers/outliers.py\", line 
77, in info"
ts=2018-06-07T19:37:37.865Z lvl=info msg="UDF log" service=udf text="
response.info.options['field'].valueTypes.append(udf_pb2.STRING)"
ts=2018-06-07T19:37:37.865Z lvl=info msg="UDF log" service=udf text="  File 
\"/usr/lib/python2.7/dist-packages/google/protobuf/internal/containers.py\", 
line 64, in __getitem__"
ts=2018-06-07T19:37:37.865Z lvl=info msg="UDF log" service=udf text="
return self._values[key]"
ts=2018-06-07T19:37:37.865Z lvl=info msg="UDF log" service=udf 
text="TypeError: list indices must be integers, not str"
ts=2018-06-07T19:37:37.865Z lvl=info msg="UDF log" service=udf 
text="2018-06-07 19:37:37,865 ERROR:root: error processing request of type 
info: list indices must be integers, not str"
ts=2018-06-07T19:37:37.865Z lvl=error msg="received error message" 
service=udf err="error processing request of type info: list indices must 
be integers, not str"
ts=2018-06-07T19:37:37.865Z lvl=info msg="UDF log" service=udf 
text="2018-06-07 19:37:37,865 INFO:root: Agent finished"

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Unable to parse using google Protobuf in Python3.5

2018-06-04 Thread Arghya Basu

Error log trace
===

ts=2018-06-04T10:08:06.672Z lvl=info msg="UDF log" service=udf text="
request.ParseFromString(body)"
ts=2018-06-04T10:08:06.672Z lvl=info msg="UDF log" service=udf 
text="google.protobuf.message.DecodeError: Error parsing message"
ts=2018-06-04T10:08:06.672Z lvl=info msg="UDF log" service=udf 
text="2018-06-04 10:08:06,672 ERROR:root: error processing request of type 
unknown: Error parsing message"


Python code
==

request = udf_pb2.Request()

self._in = self._in.detach()
data = self._in.read()
data = data.decode("ascii","replace")

if type(data) == str:
data = bytearray(data, "utf-8")
body = bytes(data)

request.ParseFromString(body)



-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.