def getCep4LocationTestEnvPrefix(self): if isProductionEnvironment(): return '' if isTestEnvironment(): return 'test-' return 'dev-'
def cep4DataPath(self): '''returns the path to the data dir on CEP4, depending on environment''' if isProductionEnvironment(): return "CEP4:/data/projects" if isTestEnvironment(): return "CEP4:/data/test-projects" return "CEP4:/data/dev-projects"
def adaptNameToEnvironment(name): if isProductionEnvironment(): return name #return original name only for PRODUCTION LOFARENV if isTestEnvironment(): return 'test.%s' % name #return 'test.' prefixed name only for TEST LOFARENV # in all other cases prefix queue/bus name with 'devel.' return 'devel.%s' % name
def config(): config = { 'mom_base_url': '', 'lta_base_url': '', 'inspection_plots_base_url': 'https://proxy.lofar.eu/inspect/HTML/', 'sky_view_base_url': 'http://dop344.astron.nl:5000/uvis/id' } if isProductionEnvironment(): config['mom_base_url'] = 'https://lofar.astron.nl/mom3' config['lta_base_url'] = 'http://lofar.target.rug.nl/' elif isTestEnvironment(): config['mom_base_url'] = 'http://lofartest.control.lofar:8080/mom3' config['lta_base_url'] = 'http://lofar-test.target.rug.nl/' return jsonify({'config': config})
from lofar.common import isProductionEnvironment, isTestEnvironment """ Config file for specification services. """ # Messaging VALIDATION_SERVICENAME = "specificationvalidationservice" SPECIFICATION_SERVICENAME = "specificationservice" SPECIFICATIONTRANSLATION_SERVICENAME = "specificationtranslationservice" # TODO: mom.importxml does not prepend "test." on the test system? MOMIMPORTXML_BUSNAME = "mom.importxml" MOMIMPORTXML_BROKER = "lcs023.control.lofar" if isProductionEnvironment() else \ "lcs028.control.lofar" if isTestEnvironment() else \ "localhost" # XSD paths (for validation service) TRIGGER_XSD = "$LOFARROOT/share/SAS/LofarTrigger.xsd" LOFARSPEC_XSD = "$LOFARROOT/share/SAS/LofarSpecification.xsd" MOMSPEC_XSD = "$LOFARROOT/share/MoM/LofarMoM2.xsd" # Telescope Model XML paths (for xml generators used by translation service) TELESCOPE_MODEL_TYPE1_XML = "$LOFARROOT/share/xml/telescope_model_type1_template.xml" TELESCOPE_MODEL_TYPE2_XML = "$LOFARROOT/share/xml/telescope_model_type2_template.xml"
import os import logging logger = logging.getLogger() import kombu # make default kombu/amqp logger less spammy logging.getLogger("amqp").setLevel(logging.INFO) from lofar.messaging import adaptNameToEnvironment from lofar.common import isProductionEnvironment, isTestEnvironment # the DEFAULT_BROKER that's used in lofar's messaging refers to the single # broker at either the production or test scu, depending on the runtime environment. # For a non-production/non-test env, just use localhost. DEFAULT_BROKER = "scu001.control.lofar" if isProductionEnvironment() else \ "scu199.control.lofar" if isTestEnvironment() else \ "localhost" if 'LOFAR_DEFAULT_BROKER' in os.environ.keys(): DEFAULT_BROKER = os.environ.get('LOFAR_DEFAULT_BROKER') DEFAULT_USER = os.environ.get('RABBITMQ_DEFAULT_USER', 'guest') DEFAULT_PASSWORD = os.environ.get('RABBITMQ_DEFAULT_PASS', 'guest') if isProductionEnvironment() or isTestEnvironment(): # import the user and password from RabbitMQ 'db'credentials try: from lofar.common.dbcredentials import DBCredentials _db_creds = DBCredentials().get("RabbitMQ") DEFAULT_USER = _db_creds.user DEFAULT_PASSWORD = _db_creds.password
from lofar.common import isProductionEnvironment from lofar.common import isTestEnvironment from socket import gethostname #server config is same as common config plus extra's from lofar.lta.ingest.common.config import * DEFAULT_INGEST_INCOMING_JOB_SUBJECT = DEFAULT_INGEST_PREFIX + ".incoming_job" DEFAULT_INGEST_JOB_FOR_TRANSFER_SUBJECT = DEFAULT_INGEST_PREFIX + ".job_for_transfer" DEFAULT_MOM_XMLRPC_HOST = hostnameToIp( 'lexar003.lexar.control.lofar' if isProductionEnvironment() and 'lexar' in gethostname() else 'lexar004.lexar.control.lofar' if isTestEnvironment( ) and 'lexar' in gethostname() else 'localhost') DEFAULT_MOM_XMLRPC_PORT = 2010 if isProductionEnvironment() else 2009 MOM_BASE_URL = 'https://lcs029.control.lofar:8443/' # if isProductionEnvironment() else 'http://lofartest.control.lofar:8080/' LTA_BASE_URL = 'https://%s:%[email protected]:9443/' if isProductionEnvironment( ) else 'https://%s:%[email protected]:19443/' JOBS_DIR = '/local/ingest/jobs' if isProductionEnvironment( ) else '/local/ingesttest/jobs' if isTestEnvironment() else '/tmp/ingest/jobs' MAX_NR_OF_RETRIES = 4 DEFAULT_JOB_PRIORITY = 4 MAX_NR_OF_JOBS = 40 MAX_USED_BANDWITH_TO_START_NEW_JOBS = 9.9e9 #Gbps NET_IF_TO_MONITOR = [ 'p2p1.2030', # outgoing traffic to Juelich 'p2p1.2033', # outgoing traffic to Poznan