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 2019/12/30 03:20:11 UTC

[GitHub] [pulsar] tuteng edited a comment on issue #5912: "UNAVAILABLE: io exception" pulsar functions

tuteng edited a comment on issue #5912: "UNAVAILABLE: io exception" pulsar functions
URL: https://github.com/apache/pulsar/issues/5912#issuecomment-569571012
 
 
   I am so sorry for the late reply. I tested in cluster mode and did not reproduce your problem. My test environment, 3 brokers, 2 function_worker, uses Ubuntu 16.04.6 LTS and pulsar version 2.4.2. The command is as follows:
   
   Install the pulsar client on each function_worker:
   
   ```
   pip install pulsar-client
   ```
   
   Create and start function
   
   ```
   ./bin/pulsar-admin functions create --py /root/test-function/word_function.py --classname word_function.WordCountFunction --tenant public --namespace default --name excfunc --inputs test1 --output test2
   ```
   
   The content of word_function.py, 
   
   ```
   from pulsar import Function
   
   # The classic ExclamationFunction that appends an exclamation at the end
   # of the input
   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 + "!"
   ```
   
   If you have any questions, please ping me. @thlautenschlaeger Can you provide more context information if possible?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services