def __init__(self, conn_config={}): """initializer""" BaseLoader.__init__(self) self.conn = ElasticsearchConnector(conn_config) self.conn.create(INDEX_NAME, mapping=SETTINGS)
def __init__(self, plugin_def): """initializer""" BaseLoader.__init__(self) self.ES = get_es(MSC_PYGEOAPI_ES_URL, MSC_PYGEOAPI_ES_AUTH) self.filepath = None self.region_name_code = None self.language = None self.root = None self.area = {} self.items = [] # create marine weather indices if it don't exist for item in MAPPINGS: if not self.ES.indices.exists(INDEX_NAME.format(item)): SETTINGS['mappings']['properties']['properties'][ 'properties' ] = MAPPINGS[ item ] # noqa self.ES.indices.create( index=INDEX_NAME.format(item), body=SETTINGS, request_timeout=MSC_PYGEOAPI_ES_TIMEOUT, )
def __init__(self, db_string=None, conn_config={}): """initializer""" BaseLoader.__init__(self) self.conn = ElasticsearchConnector(conn_config) self.db_conn = None # setup DB connection if db_string is not None: try: self.db_conn = cx_Oracle.connect(db_string) self.cur = self.db_conn.cursor() except Exception as err: msg = 'Could not connect to Oracle: {}'.format(err) LOGGER.critical(msg) raise click.ClickException(msg) else: LOGGER.debug("No DB connection string passed. Indexing disabled.") self.db_conn = self.cur = None for item in MAPPINGS: SETTINGS['mappings']['properties']['properties'][ 'properties' ] = MAPPINGS[item] self.conn.create(INDEX_NAME.format(item), SETTINGS)
def __init__(self, filepath, conn_config={}): """initializer""" BaseLoader.__init__(self) self.DD_URL = 'https://dd.weather.gc.ca/bulletins/alphanumeric' self.conn = ElasticsearchConnector(conn_config) self.conn.create_template(INDEX_BASENAME, SETTINGS)
def __init__(self, conn_config={}): """initializer""" BaseLoader.__init__(self) self.conn = ElasticsearchConnector(conn_config, verify_certs=False) self.items = [] self.conn.create_template(INDEX_BASENAME, SETTINGS)
def __init__(self, conn_config={}): """initializer""" BaseLoader.__init__(self) self.conn = ElasticsearchConnector(conn_config) self.conn.create_template(INDEX_BASENAME, SETTINGS) self.stations = {} self.read_stations_list()
def __init__(self, plugin_def): """initializer""" BaseLoader.__init__(self) self.ES = get_es(MSC_PYGEOAPI_ES_URL, MSC_PYGEOAPI_ES_AUTH) if not self.ES.indices.exists(INDEX_NAME): self.ES.indices.create(index=INDEX_NAME, body=SETTINGS, request_timeout=MSC_PYGEOAPI_ES_TIMEOUT)
def __init__(self, filepath): """initializer""" BaseLoader.__init__(self) self.DD_URL = 'https://dd.weather.gc.ca/bulletins/alphanumeric' self.ES = get_es(MSC_PYGEOAPI_ES_URL, MSC_PYGEOAPI_ES_AUTH) if not self.ES.indices.exists(INDEX_NAME): self.ES.indices.create(index=INDEX_NAME, body=SETTINGS, request_timeout=MSC_PYGEOAPI_ES_TIMEOUT)
def __init__(self, conn_config={}): """initializer""" BaseLoader.__init__(self) self.conn = ElasticsearchConnector(conn_config) self.filepath = None self.version = None self.zone = None self.items = [] # create forecast polygon indices if they don't exist for index in INDICES: zone = index.split('_')[2] SETTINGS['mappings']['properties']['properties'][ 'properties'] = FILE_PROPERTIES[zone] self.conn.create(index, SETTINGS)
def __init__(self, conn_config={}): """initializer""" BaseLoader.__init__(self) self.conn = ElasticsearchConnector(conn_config) self.filepath = None self.region_name_code = None self.language = None self.root = None self.area = {} self.items = [] # create marine weather indices if it don't exist for item in MAPPINGS: SETTINGS['mappings']['properties']['properties'][ 'properties'] = MAPPINGS[item] self.conn.create(INDEX_NAME.format(item), SETTINGS)
def __init__(self, conn_config={}): """initializer""" BaseLoader.__init__(self) self.conn = ElasticsearchConnector(conn_config) self.filepath = None self.date_ = None self.fh = None self.storm_name = None self.storm_variable = None self.items = [] # create storm variable indices if it don't exist for item in FILE_PROPERTIES: SETTINGS['mappings']['properties']['properties'][ 'properties'] = FILE_PROPERTIES[item] self.conn.create(INDEX_NAME.format(item), SETTINGS)
def __init__(self, plugin_def): """initializer""" BaseLoader.__init__(self) self.ES = get_es(MSC_PYGEOAPI_ES_URL, MSC_PYGEOAPI_ES_AUTH) self.filepath = None self.version = None self.zone = None self.items = [] # create storm variable indices if it don't exist for item in FILE_PROPERTIES: if not self.ES.indices.exists(INDEX_NAME.format(item)): SETTINGS['mappings']['properties']['properties'][ 'properties'] = FILE_PROPERTIES[item] self.ES.indices.create(index=INDEX_NAME.format(item), body=SETTINGS, request_timeout=MSC_PYGEOAPI_ES_TIMEOUT)
def __init__(self, plugin_def): """initializer""" BaseLoader.__init__(self) self.ES = get_es(MSC_PYGEOAPI_ES_URL, MSC_PYGEOAPI_ES_AUTH) self.filepath = None self.version = None self.zone = None self.items = [] # create forecast polygon indices if they don't exist for index in INDICES: zone = index.split('_')[2] if not self.ES.indices.exists(index): SETTINGS['mappings']['properties']['properties'][ 'properties'] = FILE_PROPERTIES[zone] self.ES.indices.create(index=index, body=SETTINGS, request_timeout=MSC_PYGEOAPI_ES_TIMEOUT)
def __init__(self, conn_config={}): """initializer""" BaseLoader.__init__(self) self.conn = ElasticsearchConnector(conn_config) self.filepath = None self.type = None self.region = None self.date_ = None self.items = [] # only create index templates with forecasts and observations mappings template_mappings = { k: MAPPINGS[k] for k in ('forecasts', 'observations') } for aqhi_type in template_mappings: template_name = INDEX_BASENAME.format(aqhi_type) SETTINGS['index_patterns'] = ['{}*'.format(template_name)] SETTINGS['mappings'] = MAPPINGS[aqhi_type] self.conn.create_template(template_name, SETTINGS)