@nathaniel
Hi, Nathaniel! Thank you all for incredible product of InfluxData!
I am a newbie of Influx Stacks.
I faced a similar problem to @HansKe .
My envs are similar to @theo that using docker-compose consists influxdb:latest, telegraf:latest, and own build kapacitor with python3.
I have put protobuf3.0.0 on Kapacitor-image.
[srv] 2018/06/06 09:48:14 D! opening service: *udf.Service
[udf] 2018/06/06 09:48:14 I!P 2018-06-06 09:48:14,921 INFO:root: Starting Agent
[udf] 2018/06/06 09:48:14 I!P Traceback (most recent call last):
[udf] 2018/06/06 09:48:14 I!P File “/usr/local/src/kapacitor/udf/agent/py/kapa
citor/udf/agent.py”, line 107, in _read_loop
[udf] 2018/06/06 09:48:14 I!P request.ParseFromString(data)
[udf] 2018/06/06 09:48:14 I!P TypeError: a bytes-like object is required, not ‘s
tr’
[udf] 2018/06/06 09:48:14 I!P 2018-06-06 09:48:14,922 ERROR:root: error processi
ng request of type unknown: a bytes-like object is required, not ‘str’
[udf] 2018/06/06 09:48:14 I!P Exception in thread Thread-1:
[udf] 2018/06/06 09:48:14 I!P Traceback (most recent call last):
[udf] 2018/06/06 09:48:14 I!P File “/usr/local/src/kapacitor/udf/agent/py/kapa
citor/udf/agent.py”, line 107, in _read_loop
[udf] 2018/06/06 09:48:14 I!P request.ParseFromString(data)
[udf] 2018/06/06 09:48:14 I!P TypeError: a bytes-like object is required, not ‘s
tr’
[udf] 2018/06/06 09:48:14 I!P
[udf] 2018/06/06 09:48:14 I!P During handling of the above exception, another ex
ception occurred:
[udf] 2018/06/06 09:48:14 I!P
[udf] 2018/06/06 09:48:14 I!P Traceback (most recent call last):
[udf] 2018/06/06 09:48:14 I!P File “/usr/local/lib/python3.6/threading.py”, li
ne 916, in _bootstrap_inner
[udf] 2018/06/06 09:48:14 I!P self.run()
[udf] 2018/06/06 09:48:14 I!P File “/usr/local/lib/python3.6/threading.py”, li
ne 864, in run
[udf] 2018/06/06 09:48:14 I!P self._target(*self._args, **self._kwargs)
[udf] 2018/06/06 09:48:14 I!P File “/usr/local/src/kapacitor/udf/agent/py/kapa
citor/udf/agent.py”, line 143, in _read_loop
[udf] 2018/06/06 09:48:14 I!P self.write_response(response)
[udf] 2018/06/06 09:48:14 I!P File “/usr/local/src/kapacitor/udf/agent/py/kapacitor/udf/agent.py”, line 92, in write_response
[udf] 2018/06/06 09:48:14 I!P self._out.write(data)
[udf] 2018/06/06 09:48:14 I!P TypeError: write() argument must be str, not bytes
[udf] 2018/06/06 09:48:14 I!P
[udf] 2018/06/06 09:48:14 I!P 2018-06-06 09:48:14,923 INFO:root: Agent finished
[httpd] 2018/06/06 09:48:14 I! Closed HTTP service
[edge:task_master:main|write_points->stream] 2018/06/06 09:48:14 D! closing c: 0 e: 0
[srv] 2018/06/06 09:48:14 D! closing service: *httpd.Service
And I finally worked around this error by modifing udf/agent.py as follows, and enabled to run up a kapacitor process.
udf/agent.py
class Agent(object):
- def init(self, _in=sys.stdin, out=sys.stdout,handler=None):
+ To like this: def init(self, _in=sys.stdin.buffer, out=sys.stdout,handler=None):
# Write message
- # self._out.write(data.decode(‘utf-8’))
+ self._out.write(data.decode(‘utf-8’))
- self._out.write(data)
+ # self._out.write(data)
However, after defining and enabling UDF task, there is an another error has occured.
[edge:UDF_sample_CPU_mvavg|movingAverage3->alert4] 2018/06/07 02:19:20 D! closing c: 0 e: 0
[edge:UDF_sample_CPU_mvavg|eval2->movingAverage3] 2018/06/07 02:19:20 I! aborting c: 18 e: 10
[UDF_sample_CPU_mvavg:movingAverage3] 2018/06/07 02:19:20 E! read error: bad wiretype for oneof field in *agent.Response
[edge:UDF_sample_CPU_mvavg|alert4->influxdb_out5] 2018/06/07 02:19:20 D! closing c: 0 e: 0
[task_store] 2018/06/07 02:19:20 D! task UDF_sample_CPU_mvavg finished
[edge:UDF_sample_CPU_mvavg|stream->stream0] 2018/06/07 02:19:20 D! closing c: 18 e: 18
[edge:UDF_sample_CPU_mvavg|stream0->from1] 2018/06/07 02:19:20 D! closing c: 18 e: 18
[edge:UDF_sample_CPU_mvavg|from1->eval2] 2018/06/07 02:19:20 D! closing c: 18 e: 18
[edge:UDF_sample_CPU_mvavg|eval2->movingAverage3] 2018/06/07 02:19:20 D! closing c: 18 e: 10
[task_master:main] 2018/06/07 02:19:20 E! Stopped task: UDF_sample_CPU_mvavg movingAverage3: read error: bad wiretype for oneof field in *agent.Response
[task_store] 2018/06/07 02:19:20 E! task UDF_sample_CPU_mvavg finished with error: movingAverage3: read error: bad wiretype for oneof field in *agent.Response
[httpd] 127.0.0.1 - - [07/Jun/2018:02:19:22 +0000] “GET /kapacitor/v1/tasks/UDF_sample_CPU_mvavg?dot-view=attributes&replay-id=&script-format=formatted HTTP/1.1” 200 672 “-” “KapacitorClient” 313668c3-69f9-11e8-8057-000000000000 3233
I have tried both version 1.3.0 and 1.5.0.
I think there is something wrong with udf_pb2.py, but I don’t know about Protocol Buffer very much.
We want to execute a ML-based anomary-detection by using Python3 with science/math packages only in python.
I would appreciate if you have any advice.