Skip to content

CompoundMessage should not aggregate logs #95

Open
@Yancey0623

Description

@Yancey0623

pysqlflow/sqlflow/client.py

Lines 126 to 150 in da0fffd

if first.WhichOneof('response') == 'message':
# if the first line is html tag like,
# merge all return strings then render the html on notebook
if re.match(r'<[a-z][\s\S]*>.*', first.message.message):
resp_list = [first.message.message]
for res in stream_response:
if res.WhichOneof('response') == 'eoe':
_LOGGER.info("end execute %s, spent: %d" % (res.eoe.sql, res.eoe.spent_time_seconds))
compound_message.add_html('\n'.join(resp_list), res)
break
resp_list.append(res.message.message)
from IPython.core.display import display, HTML
display(HTML('\n'.join(resp_list)))
else:
all_messages = []
all_messages.append(first.message.message)
eoe = None
for res in stream_response:
if res.WhichOneof('response') == 'eoe':
_LOGGER.info("end execute %s, spent: %d" % (res.eoe.sql, res.eoe.spent_time_seconds))
eoe = res
break
_LOGGER.debug(res.message.message)
all_messages.append(res.message.message)
compound_message.add_message('\n'.join(all_messages), eoe)

From the above implementation, all the logs would be show in the Notebook at the end of sql program execution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions