Skip to content

Commit 9c8cf8b

Browse files
authored
[promptflow][BugFix] Check bulk result first before get metrics (#584)
# Description Executor might exit abnormally in some cases, then `bulk_result` will be `None` so we will run into error. This PR adds check first to avoid such error. # All Promptflow Contribution checklist: - [X] **The pull request does not introduce [breaking changes]** - [X] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [X] **I have read the [contribution guidelines](../CONTRIBUTING.md).** ## General Guidelines and Best Practices - [X] Title of the pull request is clear and informative. - [X] 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](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [ ] Pull request includes test coverage for the included changes.
1 parent 381b577 commit 9c8cf8b

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/promptflow/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- [Flow build] Fix flow build file name and environment variable name when connection name contains space.
1111
- Reserve `.promptflow` folder when dump run snapshot.
1212
- Read/write log file with encoding specified.
13+
- Avoid inconsistent error message when executor exits abnormally.
1314

1415
### Other Changes
1516
- [Executor][Internal] Improve error message with more details and actionable information.

src/promptflow/promptflow/_sdk/operations/_run_submitter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def _submit_bulk_run(self, flow: Flow, run: Run, local_storage: LocalStorageOper
316316
# exceptions
317317
local_storage.dump_exception(exception=exception, bulk_results=bulk_result)
318318
# system metrics: token related
319-
system_metrics = bulk_result.get_openai_metrics()
319+
system_metrics = {} if bulk_result is None else bulk_result.get_openai_metrics()
320320

321321
self.run_operations.update(
322322
name=run.name,

0 commit comments

Comments
 (0)