Browse Source

1) print workspace path on startup; 2) update gunicorn configuration

tags/v0.3.0-alpha
liangyongxiong 5 years ago
parent
commit
4417c5d027
3 changed files with 12 additions and 7 deletions
  1. +1
    -1
      mindinsight/backend/config/gunicorn_conf.py
  2. +9
    -6
      mindinsight/backend/run.py
  3. +2
    -0
      mindinsight/scripts/start.py

+ 1
- 1
mindinsight/backend/config/gunicorn_conf.py View File

@@ -30,7 +30,7 @@ worker_connections = 1000


timeout = 30 timeout = 30
graceful_timeout = 30 graceful_timeout = 30
daemon = True
daemon = False


captureoutput = True captureoutput = True




+ 9
- 6
mindinsight/backend/run.py View File

@@ -22,7 +22,6 @@ import shlex


from gunicorn.glogging import Logger from gunicorn.glogging import Logger


from mindinsight.backend.config import gunicorn_conf
from mindinsight.backend.config import WEB_CONFIG_DIR from mindinsight.backend.config import WEB_CONFIG_DIR
from mindinsight.conf import settings from mindinsight.conf import settings
from mindinsight.utils.log import setup_logger from mindinsight.utils.log import setup_logger
@@ -241,12 +240,16 @@ def start():
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE stderr=subprocess.PIPE
) )
_, stderr = process.communicate()
if stderr:
console.error(stderr.decode())


# wait command success to end when gunicorn running in daemon.
if gunicorn_conf.daemon and process.wait() == 0:
# sleep 1 second for gunicorn appplication to load modules
time.sleep(1)

# check if gunicorn application is running
if process.poll() is not None:
_, stderr = process.communicate()
for line in stderr.decode().split('\n'):
console.error(line)
else:
state_result = _check_server_start_stat(errorlog_abspath, log_size) state_result = _check_server_start_stat(errorlog_abspath, log_size)
# print gunicorn start state to stdout # print gunicorn start state to stdout
console.info('Web address: http://%s:%s', settings.HOST, settings.PORT) console.info('Web address: http://%s:%s', settings.HOST, settings.PORT)


+ 2
- 0
mindinsight/scripts/start.py View File

@@ -193,6 +193,8 @@ class Command(BaseCommand):
self.logfile.error(error.message) self.logfile.error(error.message)
sys.exit(1) sys.exit(1)


self.console.info('Workspace: %s', os.path.realpath(settings.WORKSPACE))

run_module = import_module('mindinsight.backend.run') run_module = import_module('mindinsight.backend.run')
run_module.start() run_module.start()




Loading…
Cancel
Save