Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6a39ca6c
authored
Feb 22, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: make cached properties' getters reachable on Node
parent
36e51381
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
circle/vm/models/node.py
+9
-6
No files found.
circle/vm/models/node.py
View file @
6a39ca6c
...
@@ -54,20 +54,22 @@ class Node(TimeStampedModel):
...
@@ -54,20 +54,22 @@ class Node(TimeStampedModel):
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
name
return
self
.
name
@property
@method_cache
(
10
,
5
)
@method_cache
(
10
,
5
)
def
online
(
self
):
def
get_
online
(
self
):
return
self
.
remote_query
(
vm_tasks
.
ping
,
timeout
=
1
,
default
=
False
)
return
self
.
remote_query
(
vm_tasks
.
ping
,
timeout
=
1
,
default
=
False
)
@property
online
=
property
(
get_online
)
@method_cache
(
300
)
@method_cache
(
300
)
def
num_cores
(
self
):
def
get_
num_cores
(
self
):
"""Number of CPU threads available to the virtual machines.
"""Number of CPU threads available to the virtual machines.
"""
"""
return
self
.
remote_query
(
vm_tasks
.
get_core_num
)
return
self
.
remote_query
(
vm_tasks
.
get_core_num
)
num_cores
=
property
(
get_num_cores
)
@property
@property
def
state
(
self
):
def
state
(
self
):
"""Node state.
"""Node state.
...
@@ -94,14 +96,15 @@ class Node(TimeStampedModel):
...
@@ -94,14 +96,15 @@ class Node(TimeStampedModel):
self
.
enabled
=
True
self
.
enabled
=
True
self
.
save
()
self
.
save
()
@property
@method_cache
(
300
)
@method_cache
(
300
)
def
ram_size
(
self
):
def
get_
ram_size
(
self
):
"""Bytes of total memory in the node.
"""Bytes of total memory in the node.
"""
"""
return
self
.
remote_query
(
vm_tasks
.
get_ram_size
)
return
self
.
remote_query
(
vm_tasks
.
get_ram_size
)
ram_size
=
property
(
get_ram_size
)
@property
@property
def
ram_size_with_overcommit
(
self
):
def
ram_size_with_overcommit
(
self
):
"""Bytes of total memory including overcommit margin.
"""Bytes of total memory including overcommit margin.
...
...
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