You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/02/22 05:45:55 UTC
[GitHub] [pulsar] daiwei233 edited a comment on issue #14386: ImportError: No module named _pulsar
daiwei233 edited a comment on issue #14386:
URL: https://github.com/apache/pulsar/issues/14386#issuecomment-1047445999
I have the same promblem. I run `function worker` with broker, and I have installed `python3.6` and `pulsar-client==2.9.1` with my broker.
**pulsar version:** 2.9.1
**create command:** `pulsar-admin functions create --py myfunc.py --classname myfunc.WordCountFunction --inputs persistent://public/default/in --output persistent://public/default/out`
**myfunc.py:**
```python
class WordCountFunction(Function):
def __init__(self):
pass
def process(self, input, context):
words = input.split()
for word in words:
context.incr_counter(word, 1)
context.get_logger().info("The value is " + str(context.get_counter(word)))
return input + "!"
```
**broker log:**
```
Traceback (most recent call last):
File "/opt/work/apache-pulsar-2.9.1/instances/python-instance/python_instance_main.py", line 36, in <module>
import pulsar
File "/opt/work/apache-pulsar-2.9.1/instances/python-instance/pulsar/__init__.py", line 103, in <module>
import _pulsar
ImportError: No module named _pulsar
```
**function status:**
```
pulsar-admin functions status --name WordCountFunction
{
"numInstances" : 1,
"numRunning" : 0,
"instances" : [ {
"instanceId" : 0,
"status" : {
"running" : false,
"error" : "UNAVAILABLE: io exception",
"numRestarts" : 0,
"numReceived" : 0,
"numSuccessfullyProcessed" : 0,
"numUserExceptions" : 0,
"latestUserExceptions" : [ ],
"numSystemExceptions" : 0,
"latestSystemExceptions" : [ ],
"averageLatency" : 0.0,
"lastInvocationTime" : 0,
"workerId" : "work1-8080"
}
} ]
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org