Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE3
/
agentdriver
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
f79359f8
authored
Aug 29, 2024
by
Szeberényi Imre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migration to IK
parent
da8159bb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
7 deletions
+26
-7
agentcelery.py
+4
-1
agentdriver.py
+19
-2
protocol.py
+2
-3
utils.py
+1
-1
No files found.
agentcelery.py
View file @
f79359f8
...
...
@@ -7,8 +7,11 @@ from os import getenv
from
socket
import
gethostname
from
threading
import
Event
import
logging
from
celery.utils.log
import
get_task_logger
from
celery.signals
import
after_setup_task_logger
from
celery.app.log
import
TaskFormatter
logger
=
logging
.
getLogger
(
)
logger
=
get_task_logger
(
__name__
)
HOSTNAME
=
gethostname
()
.
split
(
'.'
)[
0
]
AMQP_URI
=
getenv
(
'AMQP_URI'
)
...
...
agentdriver.py
View file @
f79359f8
...
...
@@ -6,11 +6,27 @@ from protocol import inotify_handler
from
os
import
getenv
,
listdir
,
path
,
environ
,
kill
,
getpid
import
signal
import
logging
from
celery.utils.log
import
get_task_logger
logging
.
basicConfig
()
logger
=
logging
.
getLogger
()
from
celery.signals
import
after_setup_task_logger
from
celery.app.log
import
TaskFormatter
import
sys
from
multiprocessing
import
current_process
process
=
current_process
()
process
.
name
=
sys
.
argv
[
0
]
logger
=
get_task_logger
(
__name__
)
level
=
environ
.
get
(
'LOGLEVEL'
,
'INFO'
)
logger
.
setLevel
(
level
)
#logger = logging.getLogger(__name__)
@after_setup_task_logger.connect
def
setup_task_logger
(
logger
,
*
args
,
**
kwargs
):
for
handler
in
logger
.
handlers
:
handler
.
setFormatter
(
TaskFormatter
(
'
%(asctime)
s -
%(levelname)
s/agentdriver.
%(processName)
s -
%(module)
s -
%(message)
s'
))
SOCKET_DIR
=
getenv
(
'SOCKET_DIR'
,
'/var/lib/libvirt/serial'
)
...
...
@@ -26,6 +42,7 @@ Worker.install_platform_tweaks = install_platform_tweaks
def
reactor_started
():
# print(vars(logger.handlers[0].formatter))
logger
.
info
(
"reactor_started"
)
reactor
.
running_tasks
=
{}
reactor
.
ended_tasks
=
{}
...
...
protocol.py
View file @
f79359f8
...
...
@@ -7,12 +7,11 @@ import time
import
struct
from
os
import
getenv
import
gc
from
utils
import
SerialLineReceiverBase
from
agentcelery
import
agent_started
,
agent_stopped
,
renew
from
celery.utils.log
import
get_task_logger
logger
=
logging
.
getLogger
(
)
logger
=
get_task_logger
(
__name__
)
reactor
.
connections
=
{}
...
...
utils.py
View file @
f79359f8
...
...
@@ -8,7 +8,7 @@ try:
except
NameError
:
unicode
=
str
logger
=
logging
.
getLogger
()
logger
=
logging
.
getLogger
(
__name__
)
class
SerialLineReceiverBase
(
LineReceiver
,
object
):
delimiter
=
b
'
\r
'
...
...
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