Skip to content

Commit

Permalink
add the process status text for process_mngr of janus-sentinel
Browse files Browse the repository at this point in the history
  • Loading branch information
jiankai committed Nov 29, 2020
1 parent 6a4df38 commit 0a66eb0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions januscloud/sentinel/janus_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from januscloud.proxy.core.backend_server import JANUS_SERVER_STATUS_ABNORMAL, JANUS_SERVER_STATUS_NORMAL, \
JANUS_SERVER_STATUS_MAINTENANCE, JANUS_SERVER_STATUS_HWM
from januscloud.proxy.core.backend_session import BackendTransaction
from januscloud.sentinel.process_mngr import PROC_RUNNING
from januscloud.sentinel.process_mngr import PROC_RUNNING, PROC_STATUS_TEXT
from januscloud.transport.ws import WSClient

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -250,7 +250,8 @@ def _statistic_routine(self):
self.query_stat()

def on_process_status_change(self, watcher):
log.debug('on_process_status_change is called, new status: {}'.format(watcher.process_status))
log.debug('on_process_status_change is called, new status: {}({})'.format(
watcher.process_status, PROC_STATUS_TEXT[watcher.process_status]))
if watcher.process_status == PROC_RUNNING:
self.start_time = time.time()
else:
Expand Down
3 changes: 3 additions & 0 deletions januscloud/sentinel/process_mngr.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
PROC_STOP = 0
PROC_RUNNING = 1

PROC_STATUS_TEXT = ['STOP', 'RUNNING']

POLL_INTERVAL_SEC = 0.1
DEFAULT_STOP_WAIT_TIMEOUT = 3

Expand All @@ -39,6 +41,7 @@
_next_wid = 0



def _get_next_watcher_id():
global _next_wid
_next_wid += 1
Expand Down

0 comments on commit 0a66eb0

Please sign in to comment.