Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
b3c79c5e
Commit
b3c79c5e
authored
7 years ago
by
Michael Lange
Committed by
GitHub
7 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #3425 from hashicorp/b-ui-correct-cpu-usage
Don't rely on CpuStats.Percent
parents
46c3b91a
20b8e398
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ui/app/models/allocation.js
+7
-2
ui/app/models/allocation.js
ui/tests/acceptance/client-detail-test.js
+1
-1
ui/tests/acceptance/client-detail-test.js
ui/tests/acceptance/task-group-detail-test.js
+1
-1
ui/tests/acceptance/task-group-detail-test.js
with
9 additions
and
4 deletions
+9
-4
ui/app/models/allocation.js
+
7
-
2
View file @
b3c79c5e
...
...
@@ -57,8 +57,13 @@ export default Model.extend({
return
used
/
total
;
}),
percentCPU
:
computed
(
'
stats.ResourceUsage.CpuStats.Percent
'
,
function
()
{
return
this
.
get
(
'
stats.ResourceUsage.CpuStats.Percent
'
)
||
0
;
percentCPU
:
computed
(
'
cpuUsed
'
,
'
taskGroup.reservedCPU
'
,
function
()
{
const
used
=
this
.
get
(
'
cpuUsed
'
);
const
total
=
this
.
get
(
'
taskGroup.reservedCPU
'
);
if
(
!
total
||
!
used
)
{
return
0
;
}
return
used
/
total
;
}),
stats
:
computed
(
'
node.{isPartial,httpAddr}
'
,
function
()
{
...
...
This diff is collapsed.
Click to expand it.
ui/tests/acceptance/client-detail-test.js
+
1
-
1
View file @
b3c79c5e
...
...
@@ -172,7 +172,7 @@ test('each allocation should have high-level details for the allocation', functi
.
find
(
'
td:eq(6)
'
)
.
text
()
.
trim
(),
allocStats
.
resourceUsage
.
CpuStats
.
Percent
,
Math
.
floor
(
allocStats
.
resourceUsage
.
CpuStats
.
TotalTicks
)
/
cpuUsed
,
'
CPU %
'
);
assert
.
equal
(
...
...
This diff is collapsed.
Click to expand it.
ui/tests/acceptance/task-group-detail-test.js
+
1
-
1
View file @
b3c79c5e
...
...
@@ -217,7 +217,7 @@ test('each allocation should show stats about the allocation, retrieved directly
.
find
(
'
td:eq(6)
'
)
.
text
()
.
trim
(),
allocStats
.
resourceUsage
.
CpuStats
.
Percent
,
Math
.
floor
(
allocStats
.
resourceUsage
.
CpuStats
.
TotalTicks
)
/
cpuUsed
,
'
CPU %
'
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help