Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Promptflow CLI] Write exception info to stderr when set env PROMPTFLOW_STRUCTURE_EXCEPTION_OUTPUT #331

Merged
merged 11 commits into from
Sep 8, 2023

Conversation

lalala123123
Copy link
Contributor

@lalala123123 lalala123123 commented Sep 7, 2023

Description

Write exception info and command to stderr when set environment variable PROMPTFLOW_STRUCTURE_EXCEPTION_OUTPUT=true
image

promptflow error in stderr:

{
    "message":"Connection 'invalid_name' is not found.",
    "messageFormat":"",
    "messageParameters":{

    },
    "referenceCode":"Unknown",
    "code":"ConnectionNotFoundError",
    "innerError":null,
    "debugInfo":{
        "type":"ConnectionNotFoundError",
        "message":"Connection 'invalid_name' is not found.",
        "stackTrace":"Traceback (most recent call last):\n  File \"D:\\Project\\github_promptflow\\promptflow\\src\\promptflow\\promptflow\\_cli\\_utils.py\", line 354, in wrapper\n    return func(*args, **kwargs)\n  File \"D:\\Project\\github_promptflow\\promptflow\\src\\promptflow\\promptflow\\_cli\\_pf\\_connection.py\", line 187, in show_connection\n    connection = _client.connections.get(name)\n  File \"D:\\Project\\github_promptflow\\promptflow\\src\\promptflow\\promptflow\\_sdk\\operations\\_connection_operations.py\", line 47, in get\n    orm_connection = ORMConnection.get(name, raise_error)\n  File \"D:\\Project\\github_promptflow\\promptflow\\src\\promptflow\\promptflow\\_sdk\\_orm\\retry.py\", line 43, in f_retry\n    return f(*args, **kwargs)\n  File \"D:\\Project\\github_promptflow\\promptflow\\src\\promptflow\\promptflow\\_sdk\\_orm\\connection.py\", line 52, in get\n    raise ConnectionNotFoundError(f\"Connection {name!r} is not found.\")\n",
        "innerException":null
    },
    "command":"pf connection show --name invalid_name --format_exception"
}

system error in stderr:

{
    "code":"SystemError",
    "message":"mock exception",
    "messageFormat":"",
    "messageParameters":{

    },
    "innerError":{
        "code":"Exception",
        "innerError":null
    },
    "debugInfo":{
        "type":"Exception",
        "message":"mock exception",
        "stackTrace":"Traceback (most recent call last):\n  File \"D:\\Project\\github_promptflow\\promptflow\\src\\promptflow\\promptflow\\_cli\\_utils.py\", line 354, in wrapper\n    return func(*args, **kwargs)\n  File \"D:\\Project\\github_promptflow\\promptflow\\src\\promptflow\\promptflow\\_cli\\_pf\\_connection.py\", line 187, in show_connection\n    connection = _client.connections.get(name)\n  File \"C:\\Users\\zhrua\\Miniconda3\\envs\\prompt_github\\lib\\unittest\\mock.py\", line 1093, in __call__\n    return self._mock_call(*args, **kwargs)\n  File \"C:\\Users\\zhrua\\Miniconda3\\envs\\prompt_github\\lib\\unittest\\mock.py\", line 1097, in _mock_call\n    return self._execute_mock_call(*args, **kwargs)\n  File \"C:\\Users\\zhrua\\Miniconda3\\envs\\prompt_github\\lib\\unittest\\mock.py\", line 1158, in _execute_mock_call\n    result = effect(*args, **kwargs)\n  File \"D:\\Project\\github_promptflow\\promptflow\\src\\promptflow\\tests\\sdk_cli_test\\e2etests\\test_cli.py\", line 1123, in mocked_connection_get\n    raise Exception(\"mock exception\")\n",
        "innerException":null
    },
    "command":"pf connection show --name invalid_connection_name --format_exception"
}

All Promptflow Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@github-actions github-actions bot added cli prompt flow CLI promptflow labels Sep 7, 2023
@lalala123123 lalala123123 changed the title [Promptflow CLI] Write exception info to stdout when set --format_exception [Promptflow CLI] Write exception info to stderr when set --format_exception Sep 7, 2023
@github-actions
Copy link

github-actions bot commented Sep 7, 2023

Executor Unit Test Result zhrua/print_error_msg

    2 files      2 suites   39s ⏱️
161 tests 161 ✔️ 0 💤 0
322 runs  321 ✔️ 1 💤 0

Results for commit 33dc5d5.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Sep 7, 2023

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
10941 8299 76% 40% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/promptflow/promptflow/_cli/_utils.py 70% 🟢
TOTAL 70% 🟢

updated for commit: 33dc5d5 by action🐍

@lalala123123 lalala123123 marked this pull request as ready for review September 7, 2023 07:41
@lalala123123 lalala123123 requested a review from a team as a code owner September 7, 2023 07:41
@github-actions
Copy link

github-actions bot commented Sep 7, 2023

Executor E2E Test Result zhrua/print_error_msg

    2 files      2 suites   5m 55s ⏱️
  91 tests   89 ✔️ 2 💤 0
182 runs  176 ✔️ 6 💤 0

Results for commit 33dc5d5.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Sep 7, 2023

SDK CLI Test Result zhrua/print_error_msg

    2 files      2 suites   17m 33s ⏱️
207 tests 194 ✔️ 13 💤 0
414 runs  388 ✔️ 26 💤 0

Results for commit 33dc5d5.

♻️ This comment has been updated with latest results.

@lalala123123 lalala123123 changed the title [Promptflow CLI] Write exception info to stderr when set --format_exception [Promptflow CLI] Write exception info to stderr when set env FORMAT_EXCEPTION Sep 7, 2023
@lalala123123 lalala123123 changed the title [Promptflow CLI] Write exception info to stderr when set env FORMAT_EXCEPTION [Promptflow CLI] Write exception info to stderr when set env PROMPTFLOW_STRUCTURE_EXECTPION_OUTPUT Sep 8, 2023
@lalala123123 lalala123123 changed the title [Promptflow CLI] Write exception info to stderr when set env PROMPTFLOW_STRUCTURE_EXECTPION_OUTPUT [Promptflow CLI] Write exception info to stderr when set env PROMPTFLOW_STRUCTURE_EXCEPTION_OUTPUT Sep 8, 2023
wangchao1230
wangchao1230 previously approved these changes Sep 8, 2023
@wangchao1230 wangchao1230 merged commit 31068c3 into main Sep 8, 2023
20 checks passed
@wangchao1230 wangchao1230 deleted the zhrua/print_error_msg branch September 8, 2023 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli prompt flow CLI promptflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants