Skip to content

Commit

Permalink
[Internal][Executor] Print batch progress every 10 lines when there a…
Browse files Browse the repository at this point in the history
…re more than 100 lines (#1062)

# Description

Print batch progress every 10 lines when there are more than 100 lines.

# All Promptflow Contribution checklist:
- [x] **The pull request does not introduce [breaking changes].**
- [ ] **CHANGELOG is updated for new features, bug fixes or other
significant changes.**
- [x] **I have read the [contribution guidelines](../CONTRIBUTING.md).**
- [x] **Create an issue and link to the pull request to get dedicated
review from promptflow team. Learn more: [suggested
workflow](../CONTRIBUTING.md#suggested-workflow).**

## 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.
  • Loading branch information
PeiwenGaoMS authored Nov 9, 2023
1 parent 50fc61c commit 8153aa6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/promptflow/promptflow/_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ def log_progress(
total_count: int,
formatter="{count} / {total_count} finished.",
):
log_interval = max(int(total_count / 10), 1)
# Calculate log_interval to determine when to log progress.
# If total_count is less than 100, log every 10% of total_count; otherwise, log every 10 lines.
log_interval = min(10, max(int(total_count / 10), 1))
if count > 0 and (count % log_interval == 0 or count == total_count):
average_execution_time = round((datetime.now().timestamp() - run_start_time.timestamp()) / count, 2)
estimated_execution_time = round(average_execution_time * (total_count - count), 2)
Expand Down

0 comments on commit 8153aa6

Please sign in to comment.