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/11/28 07:25:13 UTC
[GitHub] [pulsar] labuladong opened a new issue, #18652: [Bug] `No module named 'pulsar.functions'` when start Pulsar function `localrun` mode
labuladong opened a new issue, #18652:
URL: https://github.com/apache/pulsar/issues/18652
### Search before asking
- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
### Version
Master branch of Pulsar.
macOS 13.
### Minimal reproduce step
I follow document https://pulsar.apache.org/docs/next/functions-deploy-localrun but cannot deploy function in `localrun` mode.
1. Create a function in python as `./pyfunc.py`:
```py
from pulsar import Function # import the Function module from Pulsar
class ExclamationFunction(Function):
def __init__(self):
pass
def process(self, input, context):
return input + '!'
```
2. Run below command:
```shell
./bin/pulsar-admin functions localrun \
--classname pyfunc.ExclamationFunction \
--py ./pyfunc.py \
--inputs py-input \
--output py-output \
--tenant public \
--namespace default \
--name PythonFunction
```
### What did you expect to see?
Pulsar function start successfully.
### What did you see instead?
```shell
2022-11-28T15:13:28,111+0800 [main] INFO org.apache.pulsar.functions.runtime.process.ProcessRuntime - ProcessBuilder starting the process with args python3 /Users/labuladong/IdeaProjects/pulsar/distribution/server/target/apache-pulsar-2.11.0-SNAPSHOT/instances/python-instance/python_instance_main.py --py ./pyfunc.py --logging_directory /Users/labuladong/IdeaProjects/pulsar/distribution/server/target/apache-pulsar-2.11.0-SNAPSHOT/logs/functions --logging_file PythonFunction --logging_config_file /Users/labuladong/IdeaProjects/pulsar/distribution/server/target/apache-pulsar-2.11.0-SNAPSHOT/conf/functions-logging/logging_config.ini --instance_id 0 --function_id 2d963982-da24-49b1-bee5-cf7ea97573bb --function_version bead76f7-328c-4629-b9f2-75ecf83c106f --function_details '{"tenant":"public","namespace":"default","name":"PythonFunction","className":"pyfunc.ExclamationFunction","runtime":"PYTHON","autoAck":true,"parallelism":1,"source":{"inputSpecs":{"py-input":{}},"cleanupSubscriptio
n":true},"sink":{"topic":"py-output","forwardSourceMessageProperty":true},"resources":{"cpu":1.0,"ram":"1073741824","disk":"10737418240"},"componentType":"FUNCTION"}' --pulsar_serviceurl pulsar://localhost:6650 --use_tls false --tls_allow_insecure false --hostname_verification_enabled false --max_buffered_tuples 1024 --port 52062 --metrics_port 52063 --expected_healthcheck_interval 30 --secrets_provider secretsprovider.ClearTextSecretsProvider --cluster_name local
2022-11-28T15:13:28,118+0800 [main] INFO org.apache.pulsar.functions.runtime.process.ProcessRuntime - Started process successfully
Traceback (most recent call last):
File "/Users/labuladong/IdeaProjects/pulsar/distribution/server/target/apache-pulsar-2.11.0-SNAPSHOT/instances/python-instance/python_instance_main.py", line 41, in <module>
import python_instance
File "/Users/labuladong/IdeaProjects/pulsar/distribution/server/target/apache-pulsar-2.11.0-SNAPSHOT/instances/python-instance/python_instance.py", line 36, in <module>
import contextimpl
File "/Users/labuladong/IdeaProjects/pulsar/distribution/server/target/apache-pulsar-2.11.0-SNAPSHOT/instances/python-instance/contextimpl.py", line 32, in <module>
import util
File "/Users/labuladong/IdeaProjects/pulsar/distribution/server/target/apache-pulsar-2.11.0-SNAPSHOT/instances/python-instance/util.py", line 29, in <module>
from pulsar.functions import serde
ModuleNotFoundError: No module named 'pulsar.functions'
2022-11-28T15:13:58,381+0800 [function-timer-thread-1-1] ERROR org.apache.pulsar.functions.runtime.process.ProcessRuntime - Health check failed for PythonFunction-0
java.util.concurrent.ExecutionException: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396) ~[?:?]
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073) ~[?:?]
at org.apache.pulsar.functions.runtime.process.ProcessRuntime.lambda$start$1(ProcessRuntime.java:187) ~[org.apache.pulsar-pulsar-functions-runtime-2.11.0-SNAPSHOT.jar:2.11.0-SNAPSHOT]
at org.apache.pulsar.common.util.Runnables$CatchingAndLoggingRunnable.run(Runnables.java:54) ~[org.apache.pulsar-pulsar-common-2.11.0-SNAPSHOT.jar:2.11.0-SNAPSHOT]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[io.netty-netty-common-4.1.77.Final.jar:4.1.77.Final]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
at io.grpc.Status.asRuntimeException(Status.java:535) ~[io.grpc-grpc-api-1.45.1.jar:1.45.1]
at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:533) ~[io.grpc-grpc-stub-1.45.1.jar:1.45.1]
at io.grpc.internal.DelayedClientCall$DelayedListener$3.run(DelayedClientCall.java:463) ~[io.grpc-grpc-core-1.45.1.jar:1.45.1]
at io.grpc.internal.DelayedClientCall$DelayedListener.delayOrExecute(DelayedClientCall.java:427) ~[io.grpc-grpc-core-1.45.1.jar:1.45.1]
at io.grpc.internal.DelayedClientCall$DelayedListener.onClose(DelayedClientCall.java:460) ~[io.grpc-grpc-core-1.45.1.jar:1.45.1]
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:562) ~[io.grpc-grpc-core-1.45.1.jar:1.45.1]
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70) ~[io.grpc-grpc-core-1.45.1.jar:1.45.1]
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:743) ~[io.grpc-grpc-core-1.45.1.jar:1.45.1]
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:722) ~[io.grpc-grpc-core-1.45.1.jar:1.45.1]
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) ~[io.grpc-grpc-core-1.45.1.jar:1.45.1]
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) ~[io.grpc-grpc-core-1.45.1.jar:1.45.1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
... 1 more
Caused by: io.grpc.netty.shaded.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: /127.0.0.1:52062
Caused by: java.net.ConnectException: Connection refused
at sun.nio.ch.Net.pollConnect(Native Method) ~[?:?]
at sun.nio.ch.Net.pollConnectNow(Net.java:672) ~[?:?]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:946) ~[?:?]
at io.grpc.netty.shaded.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:330) ~[io.grpc-grpc-netty-shaded-1.45.1.jar:1.45.1]
at io.grpc.netty.shaded.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334) ~[io.grpc-grpc-netty-shaded-1.45.1.jar:1.45.1]
at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:710) ~[io.grpc-grpc-netty-shaded-1.45.1.jar:1.45.1]
at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658) ~[io.grpc-grpc-netty-shaded-1.45.1.jar:1.45.1]
at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584) ~[io.grpc-grpc-netty-shaded-1.45.1.jar:1.45.1]
at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496) ~[io.grpc-grpc-netty-shaded-1.45.1.jar:1.45.1]
at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) ~[io.grpc-grpc-netty-shaded-1.45.1.jar:1.45.1]
at io.grpc.netty.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[io.grpc-grpc-netty-shaded-1.45.1.jar:1.45.1]
at io.grpc.netty.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[io.grpc-grpc-netty-shaded-1.45.1.jar:1.45.1]
... 1 more
2022-11-28T15:13:58,390+0800 [function-timer-thread-1-1] ERROR org.apache.pulsar.functions.runtime.process.ProcessRuntime - Extracted Process death exception
java.lang.RuntimeException:
at org.apache.pulsar.functions.runtime.process.ProcessRuntime.tryExtractingDeathException(ProcessRuntime.java:410) ~[org.apache.pulsar-pulsar-functions-runtime-2.11.0-SNAPSHOT.jar:2.11.0-SNAPSHOT]
at org.apache.pulsar.functions.runtime.process.ProcessRuntime.isAlive(ProcessRuntime.java:397) ~[org.apache.pulsar-pulsar-functions-runtime-2.11.0-SNAPSHOT.jar:2.11.0-SNAPSHOT]
at org.apache.pulsar.functions.runtime.RuntimeSpawner.lambda$start$0(RuntimeSpawner.java:89) ~[org.apache.pulsar-pulsar-functions-runtime-2.11.0-SNAPSHOT.jar:2.11.0-SNAPSHOT]
at org.apache.pulsar.common.util.Runnables$CatchingAndLoggingRunnable.run(Runnables.java:54) ~[org.apache.pulsar-pulsar-common-2.11.0-SNAPSHOT.jar:2.11.0-SNAPSHOT]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[io.netty-netty-common-4.1.77.Final.jar:4.1.77.Final]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
2022-11-28T15:13:58,391+0800 [function-timer-thread-1-1] ERROR org.apache.pulsar.functions.runtime.RuntimeSpawner - public/default/PythonFunction Function Container is dead with following exception. Restarting.
java.lang.RuntimeException:
at org.apache.pulsar.functions.runtime.process.ProcessRuntime.tryExtractingDeathException(ProcessRuntime.java:410) ~[org.apache.pulsar-pulsar-functions-runtime-2.11.0-SNAPSHOT.jar:2.11.0-SNAPSHOT]
at org.apache.pulsar.functions.runtime.process.ProcessRuntime.isAlive(ProcessRuntime.java:397) ~[org.apache.pulsar-pulsar-functions-runtime-2.11.0-SNAPSHOT.jar:2.11.0-SNAPSHOT]
at org.apache.pulsar.functions.runtime.RuntimeSpawner.lambda$start$0(RuntimeSpawner.java:89) ~[org.apache.pulsar-pulsar-functions-runtime-2.11.0-SNAPSHOT.jar:2.11.0-SNAPSHOT]
at org.apache.pulsar.common.util.Runnables$CatchingAndLoggingRunnable.run(Runnables.java:54) ~[org.apache.pulsar-pulsar-common-2.11.0-SNAPSHOT.jar:2.11.0-SNAPSHOT]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[io.netty-netty-common-4.1.77.Final.jar:4.1.77.Final]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
```
### Anything else?
I've already installed `pulsar-client` package.
### Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
--
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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] tisonkun commented on issue #18652: [Bug] `No module named 'pulsar.functions'` when start Pulsar function `localrun` mode
Posted by GitBox <gi...@apache.org>.
tisonkun commented on issue #18652:
URL: https://github.com/apache/pulsar/issues/18652#issuecomment-1339655672
Closed as self-answered.
> I try to install pulsar-client[all] on my mac but encounter errors when build grpcio, seems not compatible with m1 mac:
Yes. This is a limitation of pulsar python client on macos M1. You may open an issue (search first :)) on https://github.com/apache/pulsar-client-python.
--
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
[GitHub] [pulsar] labuladong commented on issue #18652: [Bug] `No module named 'pulsar.functions'` when start Pulsar function `localrun` mode
Posted by GitBox <gi...@apache.org>.
labuladong commented on issue #18652:
URL: https://github.com/apache/pulsar/issues/18652#issuecomment-1328662399
Update: I start Pulsar standalone on docker, then run `./bin/pulsar-admin functions localrun` on docker, the function can start successfully.
I notice that in docker image script, it installs `pulsar-client[all]` instead of `pulsar-client`:
https://github.com/apache/pulsar/blob/598ca5dacd073e00367e320a1c98f8648eadcb18/docker/pulsar/scripts/install-pulsar-client.sh#L29-L31
--
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
[GitHub] [pulsar] yaalsn commented on issue #18652: [Bug] `No module named 'pulsar.functions'` when start Pulsar function `localrun` mode
Posted by GitBox <gi...@apache.org>.
yaalsn commented on issue #18652:
URL: https://github.com/apache/pulsar/issues/18652#issuecomment-1330188687
Have you installed `pulsar-client ` in your python interpreter ?
--
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
[GitHub] [pulsar] tisonkun closed issue #18652: [Bug] `No module named 'pulsar.functions'` when start Pulsar function `localrun` mode
Posted by GitBox <gi...@apache.org>.
tisonkun closed issue #18652: [Bug] `No module named 'pulsar.functions'` when start Pulsar function `localrun` mode
URL: https://github.com/apache/pulsar/issues/18652
--
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