You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by "Rick Kellogg (JIRA)" <ji...@apache.org> on 2015/10/09 02:38:27 UTC

[jira] [Updated] (STORM-105) storm.py should turn off sysout to avoid python code interfering with data exchange

     [ https://issues.apache.org/jira/browse/STORM-105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Kellogg updated STORM-105:
-------------------------------
    Component/s: storm-multilang

> storm.py should turn off sysout to avoid python code interfering with data exchange
> -----------------------------------------------------------------------------------
>
>                 Key: STORM-105
>                 URL: https://issues.apache.org/jira/browse/STORM-105
>             Project: Apache Storm
>          Issue Type: Improvement
>          Components: storm-multilang
>            Reporter: James Xu
>            Priority: Minor
>
> https://github.com/nathanmarz/storm/issues/351
> I ran across this issue because I was trying to wrap an existing python script as a bolt and it had prints in it. This will mess up the tuple emits from the python bolt. I recommend that you add some code like this to the storm.py script to avoid the problem...
>     #turn off stdout to avoid messing with JSON payload sent back to JAVA layer
>     original_stdout = sys.stdout  # keep a reference to STDOUT
>     sys.stdout = NullDevice()
>     try:
>         //callout to bolt process method
>     finally:
>         sys.stdout = original_stdout; # turn back on to allow emit to work



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)