Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.toolbox
Commits
73f073fe
Commit
73f073fe
authored
Feb 16, 2018
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check_computer_memory: no abbreviations
parent
ba4b3b4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
slapos/promise/check_computer_memory/__init__.py
slapos/promise/check_computer_memory/__init__.py
+5
-5
No files found.
slapos/promise/check_computer_memory/__init__.py
View file @
73f073fe
...
...
@@ -16,7 +16,7 @@ from slapos.collect.db import Database
def
getMemoryInfo
(
database
,
time
,
date
):
mem
=
{}
mem
ory_info
=
{}
database
=
Database
(
database
)
try
:
database
.
connect
()
...
...
@@ -24,7 +24,7 @@ def getMemoryInfo(database, time, date):
result
=
zip
(
*
query_result
)
if
not
result
or
not
result
[
0
][
0
]:
return
(
None
,
"couldn't fetch total memory, collectordb is empty?"
)
mem
[
'total'
]
=
result
[
0
][
0
]
mem
ory_info
[
'total'
]
=
result
[
0
][
0
]
# fetch free and used memory
where_query
=
"time between '%s:00' and '%s:30' "
%
(
time
,
time
)
...
...
@@ -32,14 +32,14 @@ def getMemoryInfo(database, time, date):
result
=
zip
(
*
query_result
)
if
not
result
or
not
result
[
0
][
0
]:
return
(
None
,
"couldn't fetch free memory"
)
mem
[
'free'
]
=
result
[
0
][
0
]
mem
ory_info
[
'free'
]
=
result
[
0
][
0
]
if
not
result
or
not
result
[
1
][
0
]:
return
(
None
,
"couldn't fetch used memory"
)
mem
[
'used'
]
=
result
[
1
][
0
]
mem
ory_info
[
'used'
]
=
result
[
1
][
0
]
finally
:
database
.
close
()
return
(
mem
,
""
)
return
(
mem
ory_info
,
""
)
def
main
():
parser
=
argparse
.
ArgumentParser
()
...
...
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