コード例 #1
0
ファイル: dopey.py プロジェクト: dizhaung/dopey
def close_indices(esclient, indices):
    if not indices:
        return
    indices = indices.keys()
    logger.debug("try to close %s" % ','.join(indices))
    if curator.close_indices(esclient, indices):
        logger.info('indices closed: %s' % ','.join(indices))
コード例 #2
0
    def close(self):
        """return number of indices closed
        """
        indices = select_indices(self.es, self.model.index_name_prefix,
                                 self.model.index_timestring,
                                 self.model.index_timestring_interval,
                                 self.model.close.exec_offset)

        indices_closed = len(indices)

        if indices_closed > 0:
            try:
                ret = curator.close_indices(self.es, indices)
            except elasticsearch.exceptions.ConnectionTimeout as e:
                raise CanNotCloseIndex(str(e))

        return indices_closed
コード例 #3
0
def close_indices(esclient, indices, settings):
    """
    :type esclient: elasticsearch.Elasticsearch
    :type indices: list of (indexname,index_settings)
    :type settings: dict, not used
    :rtype: None
    """
    if not indices:
        return
    indices = [e[0] for e in indices]
    _close.extend(indices)
    logger.debug("try to close %s" % ','.join(indices))
    for index in indices:
        if curator.close_indices(esclient, [index]):
            logger.info('%s closed' % index)
            dopey_summary.add(u'%s 已关闭' % index)
        else:
            logger.warn('%s closed failed' % index)
            dopey_summary.add(u'%s 关闭失败' % index)
コード例 #4
0
    def close(self):
        """return number of indices closed
        """
        indices = select_indices(
            self.es,
            self.model.index_name_prefix,
            self.model.index_timestring,
            self.model.index_timestring_interval,
            self.model.close.exec_offset
        )

        indices_closed = len(indices)

        if indices_closed > 0:
            try:
                ret = curator.close_indices(self.es, indices)
            except elasticsearch.exceptions.ConnectionTimeout as e:
                raise CanNotCloseIndex(str(e))

        return indices_closed
コード例 #5
0
ファイル: dopey.py プロジェクト: childe/dopey
def close_indices(esclient, indices, settings):
    """
    :type esclient: elasticsearch.Elasticsearch
    :type indices: list of (indexname,index_settings)
    :type settings: dict, not used
    :rtype: None
    """
    if not indices:
        return
    indices = [e[0] for e in indices]
    _close.extend(indices)
    logger.debug("try to close %s" % ",".join(indices))
    global lock
    with lock:
        for index in indices:
            if curator.close_indices(esclient, [index]):
                logger.info("%s closed" % index)
                dopey_summary.add(u"%s 已关闭" % index)
            else:
                logger.warn("%s closed failed" % index)
                dopey_summary.add(u"%s 关闭失败" % index)
コード例 #6
0
ファイル: es-ops.py プロジェクト: evanv/tlr
def indices_close(connection, indices):
    curator.close_indices(connection, indices)
    if isinstance(indices, (list, tuple)):
        return ' '.join([', '.join(indices), 'closed'])
    else:
        return ' '.join([indices, 'closed'])