def display_config_info(): """ Prints useful configuration information to the console. """ print("Merlin Configuration") print("-" * 25) print("") conf = default_config_info() sconf = {} excpts = {} try: conf["broker server"] = broker.get_connection_string(include_password=False) sconf["broker server"] = broker.get_connection_string() conf["broker ssl"] = broker.get_ssl_config() except Exception as e: conf["broker server"] = "Broker server error." excpts["broker server"] = e try: conf["results server"] = results_backend.get_connection_string(include_password=False) sconf["results server"] = results_backend.get_connection_string() conf["results ssl"] = results_backend.get_ssl_config() except Exception as e: conf["results server"] = "No results server configured or error." excpts["results server"] = e print(tabulate(conf.items(), tablefmt="presto")) if excpts: print("\nExceptions:") for k, v in excpts.items(): print(f"{k}: {v}") check_server_access(sconf)
from merlin.config import broker, celeryconfig, results_backend from merlin.config.configfile import CONFIG from merlin.router import route_for_task from merlin.utils import nested_namespace_to_dicts LOG = logging.getLogger(__name__) merlin.common.security.encrypt_backend_traffic.set_backend_funcs() broker_ssl = True results_ssl = False try: BROKER_URI = broker.get_connection_string() LOG.debug(f"broker: {broker.get_connection_string(include_password=False)}") broker_ssl = broker.get_ssl_config() LOG.debug(f"broker_ssl = {broker_ssl}") RESULTS_BACKEND_URI = results_backend.get_connection_string() results_ssl = results_backend.get_ssl_config(celery_check=True) LOG.debug( f"results: {results_backend.get_connection_string(include_password=False)}" ) LOG.debug(f"results: redis_backed_use_ssl = {results_ssl}") except ValueError: # These variables won't be set if running with '--local'. BROKER_URI = None RESULTS_BACKEND_URI = None # initialize app with essential properties app = Celery( "merlin",
from merlin.utils import nested_namespace_to_dicts LOG: logging.Logger = logging.getLogger(__name__) merlin.common.security.encrypt_backend_traffic.set_backend_funcs() BROKER_SSL: bool = True RESULTS_SSL: bool = False BROKER_URI: Optional[str] = "" RESULTS_BACKEND_URI: Optional[str] = "" try: BROKER_URI = broker.get_connection_string() LOG.debug("broker: %s", broker.get_connection_string(include_password=False)) BROKER_SSL = broker.get_ssl_config() LOG.debug("broker_ssl = %s", BROKER_SSL) RESULTS_BACKEND_URI = results_backend.get_connection_string() RESULTS_SSL = results_backend.get_ssl_config(celery_check=True) LOG.debug("results: %s", results_backend.get_connection_string(include_password=False)) LOG.debug("results: redis_backed_use_ssl = %s", RESULTS_SSL) except ValueError: # These variables won't be set if running with '--local'. BROKER_URI = None RESULTS_BACKEND_URI = None # initialize app with essential properties app: Celery = Celery( "merlin", broker=BROKER_URI, backend=RESULTS_BACKEND_URI,