Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
argo
nrm
Commits
15437f00
Commit
15437f00
authored
Dec 08, 2017
by
Swann Perarnau
Browse files
[refactor] code cleanup for daemon
Remove unneeded module, clean up calls to the logger.
parent
6087e7fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
nrm/daemon.py
View file @
15437f00
from
__future__
import
print_function
from
__future__
import
print_function
import
logging
import
logging
import
random
import
re
import
re
import
signal
import
signal
import
zmq
import
zmq
...
@@ -74,7 +73,7 @@ class Daemon(object):
...
@@ -74,7 +73,7 @@ class Daemon(object):
self
.
target
=
1.0
self
.
target
=
1.0
def
do_application_receive
(
self
,
parts
):
def
do_application_receive
(
self
,
parts
):
self
.
logger
.
info
(
"receiving application stream:
"
+
repr
(
parts
)
)
self
.
logger
.
info
(
"receiving application stream:
%r"
,
parts
)
identity
=
parts
[
0
]
identity
=
parts
[
0
]
if
len
(
parts
[
1
])
==
0
:
if
len
(
parts
[
1
])
==
0
:
...
@@ -93,7 +92,7 @@ class Daemon(object):
...
@@ -93,7 +92,7 @@ class Daemon(object):
application
.
append_buffer
(
parts
[
1
])
application
.
append_buffer
(
parts
[
1
])
for
m
in
application
.
get_messages
():
for
m
in
application
.
get_messages
():
application
.
do_transition
(
m
)
application
.
do_transition
(
m
)
self
.
logger
.
info
(
"application now in state:
"
+
self
.
logger
.
info
(
"application now in state:
%s"
,
application
.
state
)
application
.
state
)
def
do_upstream_receive
(
self
,
msg
):
def
do_upstream_receive
(
self
,
msg
):
...
@@ -123,7 +122,7 @@ class Daemon(object):
...
@@ -123,7 +122,7 @@ class Daemon(object):
application
.
do_transition
(
'd'
)
application
.
do_transition
(
'd'
)
else
:
else
:
pass
pass
self
.
logger
.
info
(
"application now in state:
"
+
application
.
state
)
self
.
logger
.
info
(
"application now in state:
%s"
,
application
.
state
)
def
do_signal
(
self
,
signum
,
frame
):
def
do_signal
(
self
,
signum
,
frame
):
ioloop
.
IOLoop
.
current
().
add_callback_from_signal
(
self
.
do_shutdown
)
ioloop
.
IOLoop
.
current
().
add_callback_from_signal
(
self
.
do_shutdown
)
...
...
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