Skip to content

Commit

Permalink
[8.17] [ML] Trained Models: fix NaN in a progress bar during the down…
Browse files Browse the repository at this point in the history
…load task initialization (#201221) (#201342)

# Backport

This will backport the following commits from `main` to `8.17`:
- [[ML] Trained Models: fix `NaN` in a progress bar during the
download task initialization
(#201221)](#201221)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Dima
Arnautov","email":"dmitrii.arnautov@elastic.co"},"sourceCommit":{"committedDate":"2024-11-22T10:26:56Z","message":"[ML]
Trained Models: fix `NaN` in a progress bar during the download task
initialization (#201221)\n\n## Summary\r\n\r\nWhen we request a status
of the download task right after initializing a\r\ndownload,
`total_parts` might be returned with a `0` value, hence\r\ndividing by 0
for the progress bar causing in `NaN%` value rendered.\r\nThis PR adds a
fallback to `-1` for that, to make sure we render 0%.\r\n\r\n###
Checklist\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"639c9b7505020baf5dc5d31122d8924b301a77fc","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","v9.0.0","Feature:3rd
Party
Models","Team:ML","backport:version","v8.17.0","v8.18.0","v8.16.2"],"title":"[ML]
Trained Models: fix `NaN` in a progress bar during the download task
initialization
","number":201221,"url":"https://github.com/elastic/kibana/pull/201221","mergeCommit":{"message":"[ML]
Trained Models: fix `NaN` in a progress bar during the download task
initialization (#201221)\n\n## Summary\r\n\r\nWhen we request a status
of the download task right after initializing a\r\ndownload,
`total_parts` might be returned with a `0` value, hence\r\ndividing by 0
for the progress bar causing in `NaN%` value rendered.\r\nThis PR adds a
fallback to `-1` for that, to make sure we render 0%.\r\n\r\n###
Checklist\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"639c9b7505020baf5dc5d31122d8924b301a77fc"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.x","8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201221","number":201221,"mergeCommit":{"message":"[ML]
Trained Models: fix `NaN` in a progress bar during the download task
initialization (#201221)\n\n## Summary\r\n\r\nWhen we request a status
of the download task right after initializing a\r\ndownload,
`total_parts` might be returned with a `0` value, hence\r\ndividing by 0
for the progress bar causing in `NaN%` value rendered.\r\nThis PR adds a
fallback to `-1` for that, to make sure we render 0%.\r\n\r\n###
Checklist\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"639c9b7505020baf5dc5d31122d8924b301a77fc"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Dima Arnautov <dmitrii.arnautov@elastic.co>
  • Loading branch information
kibanamachine and darnautov authored Nov 22, 2024
1 parent 6ed1da0 commit e3c75d1
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ export const ModelsList: FC<Props> = ({
<>
{downloadState
? (
(downloadState.downloaded_parts / downloadState.total_parts) *
(downloadState.downloaded_parts / (downloadState.total_parts || -1)) *
100
).toFixed(0) + '%'
: '100%'}
Expand Down

0 comments on commit e3c75d1

Please sign in to comment.