Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
agentdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
1
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5adddfa3
authored
Dec 23, 2019
by
Szeberényi Imre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Queue and Exchange names are generated from host name
parent
9635d802
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
agentcelery.py
+8
-5
No files found.
agentcelery.py
View file @
5adddfa3
...
@@ -3,23 +3,26 @@ from twisted.internet import reactor # threads
...
@@ -3,23 +3,26 @@ from twisted.internet import reactor # threads
from
celery.result
import
TimeoutError
from
celery.result
import
TimeoutError
from
celery
import
Celery
from
celery
import
Celery
from
kombu
import
Queue
,
Exchange
from
kombu
import
Queue
,
Exchange
from
os
import
getenv
from
os
import
getenv
,
environ
from
socket
import
gethostname
from
socket
import
gethostname
from
threading
import
Event
from
threading
import
Event
import
logging
import
logging
logging
.
basicConfig
()
logger
=
logging
.
getLogger
()
logger
=
logging
.
getLogger
()
level
=
environ
.
get
(
'LOGLEVEL'
,
'INFO'
)
logger
.
setLevel
(
'INFO'
)
HOSTNAME
=
gethostname
()
.
split
(
'.'
)[
0
]
HOSTNAME
=
gethostname
()
.
split
(
'.'
)[
0
]
AMQP_URI
=
getenv
(
'AMQP_URI'
)
AMQP_URI
=
getenv
(
'AMQP_URI'
)
celery
=
Celery
(
'agent'
,
broker
=
AMQP_URI
)
celery
=
Celery
(
'agent'
,
broker
=
AMQP_URI
)
celery
.
conf
.
update
(
CELERY_RESULT_BACKEND
=
'amqp'
,
ret
=
celery
.
conf
.
update
(
CELERY_RESULT_BACKEND
=
'amqp'
,
CELERY_TASK_RESULT_EXPIRES
=
300
,
CELERY_TASK_RESULT_EXPIRES
=
300
,
CELERY_QUEUES
=
(
Queue
(
HOSTNAME
+
'.agent'
,
CELERY_QUEUES
=
(
Queue
(
HOSTNAME
+
'.agent'
,
Exchange
(
'
agent'
,
type
=
'direct'
),
Exchange
(
HOSTNAME
+
'.
agent'
,
type
=
'direct'
),
routing_key
=
'
agent'
),
))
routing_key
=
HOSTNAME
+
'.
agent'
),
))
logger
.
info
(
'agentcelery: clelery.conf.update:
%
s'
,
ret
)
def
send_command
(
vm
,
command
,
*
args
,
**
kwargs
):
def
send_command
(
vm
,
command
,
*
args
,
**
kwargs
):
uuid
=
kwargs
.
get
(
'uuid'
,
None
)
uuid
=
kwargs
.
get
(
'uuid'
,
None
)
...
...
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