Skip to content

Capture and add warnings separately in AnalyticResult from standard error in analytic results#110

Merged
vrane-tibco merged 4 commits into
mainfrom
feature/add_warnings
Jul 17, 2026
Merged

Capture and add warnings separately in AnalyticResult from standard error in analytic results#110
vrane-tibco merged 4 commits into
mainfrom
feature/add_warnings

Conversation

@vrane-tibco

Copy link
Copy Markdown
Collaborator

Previously, warnings were written to the standard error stream. A new warnings field has now been added to AnalyticResult so that warnings can be returned separately instead of being mixed with standard error output.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the data function execution pipeline so Python warnings are captured and surfaced separately from standard error in AnalyticResult, aligning with the goal of not mixing warning output into stderr.

Changes:

  • Added warning capture during script execution (warnings.catch_warnings(record=True)), plus AnalyticResult.has_warnings and AnalyticResult.warnings.
  • Updated summary formatting to emit a dedicated Warnings: section.
  • Expanded/updated tests and golden outputs to validate warnings vs. stderr separation.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

File Description
spotfire/data_function.py Captures warnings during script execution, stores them on AnalyticResult, and prints them under a new Warnings: section in the summary.
spotfire/test/test_data_function.py Extends test harness to assert has_warnings/has_stderr and adds new warnings-related test cases.
spotfire/test/files/data_function/warning_pysrv79.txt Updates golden output header from Standard error: to Warnings:.
spotfire/test/files/data_function/table_metadata.txt Updates golden output header from Standard error: to Warnings: for pandas metadata warning case.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread spotfire/test/test_data_function.py Outdated
Comment thread spotfire/test/test_data_function.py Outdated
Comment thread spotfire/test/test_data_function.py
Comment thread spotfire/test/test_data_function.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread spotfire/data_function.py
Comment thread spotfire/data_function.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread spotfire/data_function.py
Comment thread spotfire/data_function.py
buf.write("\nStandard error:\n")
buf.write(result.std_err_out)
if result.has_warnings:
buf.write("\nWarnings:\n")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need more stronger protocol identification ? If I print warnings in the log/print(Warnings:) will it create problem ?

@vrane-tibco vrane-tibco Jul 17, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is added to show warnings at client when enable debug logging for data function, along with other debug logs warning also get displayed. Python service or client glue code will retrieve warnings from AnalyticResult.warnings (field in AnalyticResult class)
We may remove this "Warnings:" from debug logging once client starts showing warnings for python data functions.

@vrane-tibco
vrane-tibco merged commit 2cf25ff into main Jul 17, 2026
54 checks passed
@vrane-tibco
vrane-tibco deleted the feature/add_warnings branch July 17, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants