GitHub user cfmcgrady added a comment to the discussion: Can Kyuubi Spark 
Engine show the output of python print statement in stdout?

> We want the print statement can be shown in Spark driver log for easier 
> debugging. 

If you want to print logs on the driver side, you can try applying the 
following patch.

```diff

def execute_request(content):
    try:
        code = content["code"]
    except KeyError:
        return execute_reply_internal_error(
            'Malformed message: content object missing "code"', sys.exc_info()
        )

    try:
        nodes = parse_code_into_nodes(code)
    except SyntaxError:
        exc_type, exc_value, tb = sys.exc_info()
        return execute_reply_error(exc_type, exc_value, None)

    result = None

    try:
        for node in nodes:
            result = node.execute()
    except UnknownMagic:
        exc_type, exc_value, tb = sys.exc_info()
        return execute_reply_error(exc_type, exc_value, None)
    except ExecutionError as e:
        return execute_reply_error(*e.exc_info)

    if result is None:
        result = {}

-   stdout = sys.stdout.getvalue()
-   stderr = sys.stderr.getvalue()
-
-   clearOutputs()

    output = result.pop("text/plain", "")

-   if stdout:
-       output += stdout
-
-   if stderr:
-       output += stderr

    output = output.rstrip()

    # Only add the output if it exists, or if there are no other mimetypes in 
the result.
    if output or not result:
        result["text/plain"] = output.rstrip()

    return execute_reply_ok(result)
```


GitHub link: 
https://github.com/apache/kyuubi/discussions/7111#discussioncomment-13560805

----
This is an automatically sent email for notifications@kyuubi.apache.org.
To unsubscribe, please send an email to: 
notifications-unsubscr...@kyuubi.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org
For additional commands, e-mail: notifications-h...@kyuubi.apache.org

Reply via email to