Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f8b6ab25
authored
Jan 23, 2020
by
Szeberényi Imre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Propagation of last valid node metrics instead of the [-2]nd value
parent
15d09f16
Pipeline
#961
passed with stage
in 0 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
circle/dashboard/static/local-logo.png
+0
-0
circle/vm/models/node.py
+8
-2
circle/vm/tasks/local_periodic_tasks.py
+7
-4
No files found.
circle/dashboard/static/local-logo.png
deleted
100644 → 0
View file @
15d09f16
5.65 KB
circle/vm/models/node.py
View file @
f8b6ab25
...
...
@@ -341,15 +341,21 @@ class Node(OperatedMixin, TimeStampedModel):
# Example:
# {"target": "circle.szianode.cpu.usage",
# "datapoints": [[0.6, 1403045700], [0.5, 1403045760]
logger
.
info
(
'MONITOR_TARGET:
%
s'
,
target
)
try
:
metric
=
target
[
'target'
]
if
metric
.
startswith
(
prefix
):
metric
=
metric
[
len
(
prefix
):]
else
:
logger
.
info
(
'MONITOR_MET:
%
s
%
s'
,
target
,
metric
)
continue
value
=
target
[
'datapoints'
][
-
2
][
0
]
value
=
target
[
'datapoints'
][
-
1
][
0
]
if
value
is
None
:
value
=
target
[
'datapoints'
][
-
2
][
0
]
retval
[
metric
]
=
float
(
value
)
logger
.
info
(
'MONITOR_RETVAL:
%
s
%
s,
%
s'
,
target
[
'target'
],
metric
,
retval
[
metric
])
except
(
KeyError
,
IndexError
,
ValueError
,
TypeError
):
logger
.
info
(
'MONITOR_ERR:
%
s
%
s'
,
metric
,
value
)
continue
return
retval
...
...
@@ -416,7 +422,7 @@ class Node(OperatedMixin, TimeStampedModel):
vm_state_changed hook.
"""
domains
=
{}
domain_list
=
self
.
remote_query
(
vm_tasks
.
list_domains_info
,
timeout
=
5
,
domain_list
=
self
.
remote_query
(
vm_tasks
.
list_domains_info
,
timeout
=
10
,
priority
=
"fast"
)
if
domain_list
is
None
:
logger
.
info
(
"Monitoring failed at:
%
s"
,
self
.
name
)
...
...
circle/vm/tasks/local_periodic_tasks.py
View file @
f8b6ab25
...
...
@@ -33,7 +33,7 @@ def update_domain_states():
@celery.task
(
ignore_result
=
True
)
def
garbage_collector
(
timeout
=
15
):
def
garbage_collector
(
offset
=
timezone
.
timedelta
(
seconds
=
20
)
):
"""Garbage collector for instances.
Suspends and destroys expired instances.
...
...
@@ -42,8 +42,10 @@ def garbage_collector(timeout=15):
:type timeout: int
"""
now
=
timezone
.
now
()
bw
=
0
for
i
in
Instance
.
objects
.
filter
(
destroyed_at
=
None
)
.
all
():
if
i
.
time_of_delete
and
now
>
i
.
time_of_delete
:
if
i
.
time_of_delete
and
now
>
i
.
time_of_delete
+
offset
and
bw
<
20
:
bw
=
bw
+
1
i
.
destroy
.
async
(
system
=
True
)
logger
.
info
(
"Expired instance
%
d destroyed."
,
i
.
pk
)
try
:
...
...
@@ -57,7 +59,8 @@ def garbage_collector(timeout=15):
logger
.
debug
(
'Could not notify owner of instance
%
d .
%
s'
,
i
.
pk
,
unicode
(
e
))
elif
(
i
.
time_of_suspend
and
now
>
i
.
time_of_suspend
and
i
.
state
==
'RUNNING'
):
i
.
state
==
'RUNNING'
and
bw
<
20
):
bw
=
bw
+
1
logger
.
info
(
"Expired instance
%
d suspended."
%
i
.
pk
)
try
:
i
.
sleep
.
async
(
system
=
True
)
...
...
@@ -77,4 +80,4 @@ def garbage_collector(timeout=15):
logger
.
debug
(
"Instance
%
d expires soon."
%
i
.
pk
)
i
.
notify_owners_about_expiration
()
else
:
logger
.
debug
(
"Instance
%
d didn't expire.
"
%
i
.
pk
)
logger
.
debug
(
"Instance
%
d didn't expire.
bw:
%
d"
,
i
.
pk
,
bw
)
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