Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
16
Merge Requests
16
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
3eddb0a4
Commit
3eddb0a4
authored
Oct 28, 2019
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
collect: remove dead code
parent
b29a79a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
11 deletions
+0
-11
slapos/collect/reporter.py
slapos/collect/reporter.py
+0
-5
slapos/tests/test_collect.py
slapos/tests/test_collect.py
+0
-6
No files found.
slapos/collect/reporter.py
View file @
3eddb0a4
...
@@ -475,11 +475,6 @@ class ConsumptionReport(ConsumptionReportBase):
...
@@ -475,11 +475,6 @@ class ConsumptionReport(ConsumptionReportBase):
return
xml_report_path
return
xml_report_path
def
_getAverageFromList
(
self
,
data_list
):
if
not
data_list
:
return
0
return
sum
(
data_list
)
/
len
(
data_list
)
@
withDB
@
withDB
def
_getCpuLoadAverageConsumption
(
self
,
date_scope
):
def
_getCpuLoadAverageConsumption
(
self
,
date_scope
):
(
cpu_load_percent_list
,),
=
self
.
db
.
select
(
"system"
,
date_scope
,
(
cpu_load_percent_list
,),
=
self
.
db
.
select
(
"system"
,
date_scope
,
...
...
slapos/tests/test_collect.py
View file @
3eddb0a4
...
@@ -742,7 +742,6 @@ class TestConsumptionReportBase(unittest.TestCase):
...
@@ -742,7 +742,6 @@ class TestConsumptionReportBase(unittest.TestCase):
def
_get_file_content
(
self
,
f_path
):
def
_get_file_content
(
self
,
f_path
):
with
open
(
f_path
,
"r"
)
as
f
:
with
open
(
f_path
,
"r"
)
as
f
:
return
f
.
readlines
()
return
f
.
readlines
()
return
[]
def
loadPredefinedDB
(
self
):
def
loadPredefinedDB
(
self
):
# populate db
# populate db
...
@@ -825,11 +824,6 @@ class TestConsumptionReport(TestConsumptionReportBase):
...
@@ -825,11 +824,6 @@ class TestConsumptionReport(TestConsumptionReportBase):
location
=
self
.
temp_dir
,
location
=
self
.
temp_dir
,
user_list
=
self
.
get_fake_user_list
(
15
))
user_list
=
self
.
get_fake_user_list
(
15
))
def
test_get_average_from_list
(
self
):
self
.
assertEqual
(
2
,
self
.
report
.
_getAverageFromList
([
2
,
2
]))
self
.
assertEqual
(
0
,
self
.
report
.
_getAverageFromList
([]))
self
.
assertEqual
(
10
,
self
.
report
.
_getAverageFromList
(
range
(
1
,
20
)))
def
test_getCpuLoadAverageConsumption
(
self
):
def
test_getCpuLoadAverageConsumption
(
self
):
self
.
assertEqual
(
self
.
report
.
_getCpuLoadAverageConsumption
(
'2019-10-05'
),
74.44468085106385
)
self
.
assertEqual
(
self
.
report
.
_getCpuLoadAverageConsumption
(
'2019-10-05'
),
74.44468085106385
)
self
.
assertEqual
(
self
.
report
.
_getCpuLoadAverageConsumption
(
'2019-10-06'
),
74.99183673469388
)
self
.
assertEqual
(
self
.
report
.
_getCpuLoadAverageConsumption
(
'2019-10-06'
),
74.99183673469388
)
...
...
Write
Preview
Markdown
is supported
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