Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a09521ca
authored
Jul 23, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
agent activity readable names
parent
9ec12e11
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
11 deletions
+20
-11
circle/vm/tasks/local_agent_tasks.py
+20
-11
No files found.
circle/vm/tasks/local_agent_tasks.py
View file @
a09521ca
...
@@ -25,22 +25,25 @@ from StringIO import StringIO
...
@@ -25,22 +25,25 @@ from StringIO import StringIO
from
tarfile
import
TarFile
,
TarInfo
from
tarfile
import
TarFile
,
TarInfo
from
django.conf
import
settings
from
django.conf
import
settings
from
django.utils
import
timezone
from
django.utils
import
timezone
from
django.utils.translation
import
ugettext_noop
from
celery.result
import
TimeoutError
from
celery.result
import
TimeoutError
from
monitor.client
import
Client
from
monitor.client
import
Client
def
send_init_commands
(
instance
,
act
,
vm
):
def
send_init_commands
(
instance
,
act
,
vm
):
queue
=
instance
.
get_remote_queue_name
(
"agent"
)
queue
=
instance
.
get_remote_queue_name
(
"agent"
)
with
act
.
sub_activity
(
'cleanup'
,
readable_name
=
ugettext_noop
(
'cleanup'
)):
with
act
.
sub_activity
(
'cleanup'
):
cleanup
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
))
cleanup
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
))
with
act
.
sub_activity
(
'restart_networking'
):
with
act
.
sub_activity
(
'restart_networking'
,
readable_name
=
ugettext_noop
(
'restart networking'
)):
restart_networking
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
))
restart_networking
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
))
with
act
.
sub_activity
(
'change_password'
):
with
act
.
sub_activity
(
'change_password'
,
readable_name
=
ugettext_noop
(
'change password'
)):
change_password
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
instance
.
pw
))
change_password
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
instance
.
pw
))
with
act
.
sub_activity
(
'set_time'
):
with
act
.
sub_activity
(
'set_time'
,
readable_name
=
ugettext_noop
(
'set time'
)
):
set_time
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
time
.
time
()))
set_time
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
time
.
time
()))
with
act
.
sub_activity
(
'set_hostname'
):
with
act
.
sub_activity
(
'set_hostname'
,
readable_name
=
ugettext_noop
(
'set hostname'
)):
set_hostname
.
apply_async
(
set_hostname
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
instance
.
primary_host
.
hostname
))
queue
=
queue
,
args
=
(
vm
,
instance
.
primary_host
.
hostname
))
...
@@ -73,13 +76,17 @@ def agent_started(vm, version=None):
...
@@ -73,13 +76,17 @@ def agent_started(vm, version=None):
initialized
=
InstanceActivity
.
objects
.
filter
(
initialized
=
InstanceActivity
.
objects
.
filter
(
instance
=
instance
,
activity_code
=
'vm.Instance.agent.cleanup'
)
.
exists
()
instance
=
instance
,
activity_code
=
'vm.Instance.agent.cleanup'
)
.
exists
()
with
instance_activity
(
code_suffix
=
'agent'
,
instance
=
instance
)
as
act
:
with
instance_activity
(
code_suffix
=
'agent'
,
with
act
.
sub_activity
(
'starting'
):
readable_name
=
ugettext_noop
(
'agent'
),
instance
=
instance
)
as
act
:
with
act
.
sub_activity
(
'starting'
,
readable_name
=
ugettext_noop
(
'starting'
)):
pass
pass
if
version
and
version
!=
settings
.
AGENT_VERSION
:
if
version
and
version
!=
settings
.
AGENT_VERSION
:
try
:
try
:
with
act
.
sub_activity
(
'update'
):
with
act
.
sub_activity
(
'update'
,
readable_name
=
ugettext_noop
(
'update'
)):
update
.
apply_async
(
update
.
apply_async
(
queue
=
queue
,
queue
=
queue
,
args
=
(
vm
,
create_agent_tar
()))
.
get
(
timeout
=
10
)
args
=
(
vm
,
create_agent_tar
()))
.
get
(
timeout
=
10
)
...
@@ -91,7 +98,9 @@ def agent_started(vm, version=None):
...
@@ -91,7 +98,9 @@ def agent_started(vm, version=None):
measure_boot_time
(
instance
)
measure_boot_time
(
instance
)
send_init_commands
(
instance
,
act
,
vm
)
send_init_commands
(
instance
,
act
,
vm
)
with
act
.
sub_activity
(
'start_access_server'
):
with
act
.
sub_activity
(
'start_access_server'
,
readable_name
=
ugettext_noop
(
'start acces server'
)
):
start_access_server
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
))
start_access_server
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
))
...
@@ -122,5 +131,5 @@ def agent_stopped(vm):
...
@@ -122,5 +131,5 @@ def agent_stopped(vm):
qs
=
InstanceActivity
.
objects
.
filter
(
instance
=
instance
,
qs
=
InstanceActivity
.
objects
.
filter
(
instance
=
instance
,
activity_code
=
'vm.Instance.agent'
)
activity_code
=
'vm.Instance.agent'
)
act
=
qs
.
latest
(
'id'
)
act
=
qs
.
latest
(
'id'
)
with
act
.
sub_activity
(
'stopping'
):
with
act
.
sub_activity
(
'stopping'
,
readable_name
=
ugettext_noop
(
'stopping'
)
):
pass
pass
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