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 2020/06/12 11:25:24 UTC

[GitHub] [pulsar] kadz1993 opened a new issue #7262: Context get_output_topic throws attribute error

kadz1993 opened a new issue #7262:
URL: https://github.com/apache/pulsar/issues/7262


   **Describe the bug**
   A Python Pulsar Function I've created attempts to send multiple output per one input. When I tried to obtain the output topic within the function, I get an AttributeError stating that the `output` attribute does not exists. Tracing the code led me to [Function_pb2.py](`https://github.com/apache/pulsar/blob/master/pulsar-functions/instance/src/main/python/Function_pb2.py`) which does not have an `output` element, instead the output topic is stored in `sink`.
   
   ERROR logged on the function log
   ```
   Traceback (most recent call last):
     File "/opt/apache-pulsar-2.5.0/instances/python-instance/python_instance.py", line 242, in actual_execution
       output_object = self.function_class.process(input_object, self.contextimpl)
     File "/opt/apache-pulsar-2.5.0/download/pulsar_functions/random_tenant/events/AvroBinaryToJson/0/avro_binary_to_json/src/avro_binary_to_json.py", line 50, in process
       self._output_topic = context.get_output_topic()
     File "/opt/apache-pulsar-2.5.0/instances/python-instance/contextimpl.py", line 142, in get_output_topic
       return self.instance_config.function_details.output
   AttributeError: output
   ```
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. A basic function that uses the Context API to get the output topic (self._output_topic = context.get_output_topic())
   2. Registering the function with Pulsar Admin `pulsar-admin functions create --function-config-file config.yml`
   
   config.yml:
   ```
   name: AvroBinaryToJson
   tenant: random_tenant
   namespace: events
   py: /pulsar_functions/avro_binary_to_json/avro_binary_to_json.py
   className: avro_binary_to_json.AvroBinaryToJson
   inputs:
     - persistent://random_tenant/input/event.avro
   output: persistent://random_tenant/events/event_output
   log-topic: persistent://random_tenant/logging/AvroBinaryToJson
   
   ```
   
   **Expected behavior**
   The output topic defined in the config is assigned to the variable `self._output_topic` so it can be used to send out multiple messages.
   
   **Desktop (please complete the following information):**
    - OS: CentOS 7
   


----------------------------------------------------------------
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



[GitHub] [pulsar] baynes commented on issue #7262: Context get_output_topic throws attribute error

Posted by GitBox <gi...@apache.org>.
baynes commented on issue #7262:
URL: https://github.com/apache/pulsar/issues/7262#issuecomment-645238714


   @jiazhai - it fails same way on 2.5.2


----------------------------------------------------------------
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



[GitHub] [pulsar] jiazhai commented on issue #7262: Context get_output_topic throws attribute error

Posted by GitBox <gi...@apache.org>.
jiazhai commented on issue #7262:
URL: https://github.com/apache/pulsar/issues/7262#issuecomment-643862867


   @kadz1993  This looks like a protobuf issue. Would you please help try release 2.5.2 ?


----------------------------------------------------------------
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



[GitHub] [pulsar] thesquiff commented on issue #7262: Context get_output_topic throws attribute error

Posted by GitBox <gi...@apache.org>.
thesquiff commented on issue #7262:
URL: https://github.com/apache/pulsar/issues/7262#issuecomment-793841261


   This is still an issue in 2.7.0


----------------------------------------------------------------
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