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
f2148cee
authored
Nov 20, 2013
by
Őry Máté
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: add periodic node updates
parent
45f1d0df
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletions
+19
-1
circle/manager/mancelery.py
+8
-1
circle/vm/models.py
+2
-0
circle/vm/tasks/local_periodic_tasks.py
+9
-0
No files found.
circle/manager/mancelery.py
View file @
f2148cee
...
@@ -7,7 +7,9 @@ HOSTNAME = "localhost"
...
@@ -7,7 +7,9 @@ HOSTNAME = "localhost"
celery
=
Celery
(
'manager'
,
backend
=
'amqp'
,
celery
=
Celery
(
'manager'
,
backend
=
'amqp'
,
broker
=
getenv
(
"AMQP_URI"
),
broker
=
getenv
(
"AMQP_URI"
),
include
=
[
'vm.tasks.local_tasks'
,
'storage.tasks.local_tasks'
,
include
=
[
'vm.tasks.local_tasks'
,
'vm.tasks.local_periodic_tasks'
,
'storage.tasks.local_tasks'
,
'firewall.tasks.local_tasks'
])
'firewall.tasks.local_tasks'
])
celery
.
conf
.
update
(
celery
.
conf
.
update
(
...
@@ -23,6 +25,11 @@ celery.conf.update(
...
@@ -23,6 +25,11 @@ celery.conf.update(
'schedule'
:
timedelta
(
seconds
=
5
),
'schedule'
:
timedelta
(
seconds
=
5
),
'options'
:
{
'queue'
:
'localhost.man'
}
'options'
:
{
'queue'
:
'localhost.man'
}
},
},
'vm.periodic_tasks'
:
{
'task'
:
'vm.tasks.local_periodic_tasks.update_domain_states'
,
'schedule'
:
timedelta
(
seconds
=
10
),
'options'
:
{
'queue'
:
'localhost.man'
}
},
}
}
)
)
circle/vm/models.py
View file @
f2148cee
...
@@ -850,6 +850,8 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -850,6 +850,8 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
logger
.
debug
(
'Instance
%
s state changed '
logger
.
debug
(
'Instance
%
s state changed '
'(db:
%
s, new:
%
s)'
,
'(db:
%
s, new:
%
s)'
,
self
,
self
.
state
,
new_state
)
self
,
self
.
state
,
new_state
)
self
.
state
=
new_state
self
.
save
()
class
InstanceActivity
(
ActivityModel
):
class
InstanceActivity
(
ActivityModel
):
...
...
circle/vm/tasks/local_periodic_tasks.py
0 → 100644
View file @
f2148cee
from
manager.mancelery
import
celery
from
vm.models
import
Node
@celery.task
def
update_domain_states
():
nodes
=
Node
.
objects
.
filter
(
enabled
=
True
)
.
all
()
for
node
in
nodes
:
node
.
update_vm_states
()
Bach Dániel
@bachdaniel
commented
Nov 20, 2013
Owner
👍
:+1:
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