提交 0c7e3bca 编写于 作者: N nicolargo

Add shortcut to run Glances in dev environment

上级 4e959116
......@@ -16,4 +16,28 @@ docs-server: docs
webui:
cd glances/outputs/static/ && npm install && npm audit fix && npm run build
venv:
virtualenv -p /usr/bin/python3 venv
./venv/bin/pip install -r requirements.txt
./venv/bin/pip install -r optional-requirements.txt
venv-upgrade:
./venv/bin/pip install --upgrade -r requirements.txt
./venv/bin/pip install --upgrade -r optional-requirements.txt
run: venv
./venv/bin/python -m glances -C ./conf/glances.conf
run-debug: venv
./venv/bin/python -m glances -C ./conf/glances.conf -d
run-webserver: venv
./venv/bin/python -m glances -C ./conf/glances.conf -w
run-server: venv
./venv/bin/python -m glances -C ./conf/glances.conf -s
run-client: venv
./venv/bin/python -m glances -C ./conf/glances.conf -c localhost
.PHONY: test docs docs-server
......@@ -44,7 +44,6 @@ except ImportError:
# Note: others Glances libs will be imported optionally
from glances.logger import logger
from glances.main import GlancesMain
from glances.globals import WINDOWS
from glances.timer import Counter
# Check locale
try:
......@@ -112,7 +111,7 @@ def start(config, args):
# Start the main loop
logger.debug("Glances started in {} seconds".format(start_duration.get()))
if args.stdout_issue:
# Serve once for issue/test mode
# Serve once for issue/test mode
mode.serve_issue()
else:
# Serve forever
......
......@@ -129,15 +129,14 @@ class GlancesStandalone(object):
return True if we should continue (no exit key has been pressed)
"""
# Start a counter used to compute the time needed for
# update and export the stats
counter = Counter()
# Update stats
# Start a counter used to compute the time needed
counter = Counter()
self.stats.update()
logger.debug('Stats updated duration: {} seconds'.format(counter.get()))
# Export stats
# Start a counter used to compute the time needed
counter_export = Counter()
self.stats.export(self.stats)
logger.debug('Stats exported duration: {} seconds'.format(counter_export.get()))
......@@ -162,9 +161,11 @@ class GlancesStandalone(object):
def serve_forever(self):
"""Wrapper to the serve_forever function."""
loop = True
while loop:
loop = self.__serve_once()
# loop = True
# while loop:
# loop = self.__serve_once()
while self.__serve_once():
pass
self.end()
def end(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册