Commit 89f8c0c4 authored by Daniele Venzano's avatar Daniele Venzano

Perform some sanity checks at startup

parent fcf6a456
......@@ -18,6 +18,7 @@
"""Zoe Master main entrypoint."""
import logging
import os
import zoe_lib.config as config
from zoe_lib.metrics.influxdb import InfluxDBMetricSender
......@@ -28,11 +29,19 @@ import zoe_master.scheduler
import zoe_master.backends.interface
from zoe_master.preprocessing import restart_resubmit_scheduler
from zoe_master.master_api import APIManager
from zoe_master.exceptions import ZoeException
log = logging.getLogger("main")
LOG_FORMAT = '%(asctime)-15s %(levelname)s %(threadName)s->%(name)s: %(message)s'
def _check_configuration_sanity():
if not os.path.exists(os.path.join(config.get_conf().workspace_base_path, config.get_conf().workspace_deployment_path)):
log.error('Workspace base directory does not exist: {}'.format(os.path.join(config.get_conf().workspace_base_path, config.get_conf().workspace_deployment_path)))
return 1
return 0
def main():
The entrypoint for the zoe-master script.
......@@ -42,10 +51,13 @@ def main():
args = config.get_conf()
if args.debug:
logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT)
logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)
ret = _check_configuration_sanity()
if ret != 0:
return ret
if config.get_conf().influxdb_enable:
metrics = InfluxDBMetricSender(config.get_conf().deployment_name, config.get_conf().influxdb_url, config.get_conf().influxdb_dbname)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment