Curator - set timeout_override in python script

Good day. Prehistory - we have many indices on one sever Elasticsearch, we use curator for delete old indices. 50% of cases run this script end in error:

2019-02-14 11:00:41,104 - curator.actions.delete_indices - ERROR - The following indices failed to delete on try #1:
2019-02-14 11:00:41,105 - curator.actions.delete_indices - ERROR - ---filebeat-180d-2018.08.18
2019-02-14 11:00:41,105 - curator.actions.delete_indices - ERROR - ---filebeat-90d-2018.11.16
...
elasticsearch.exceptions.NotFoundError: NotFoundError(404, 'index_not_found_exception', 'no such index')

This take place because curator try delete index, wait 30 seconds, did not receive response from ES, then try delete indices with attempt two, but that indices already deleted. I found this in documentation -
https://www.elastic.co/guide/en/elasticsearch/client/curator/current/delete_indices.html
https://www.elastic.co/guide/en/elasticsearch/client/curator/current/configfile.html#timeout
I think parameter timeout_override can help me, but we using python script for delete indices and don't using any action file.
Is there any way use this parameter in python script? Our script has approximate structure:

#!/usr/bin/env python3
from datetime import datetime
from subprocess import call, DEVNULL
import argparse
import curator
import elasticsearch
import logging
import os
import re
import socket
import sys

MASTER_TIMEOUT = 60
.....
def main(es_host, es_port, execute=False):
client = elasticsearch.Elasticsearch([{
    'host': es_host,
    'port': es_port,
}], timeout=120)

logger.info('Starting with client %s', client)
indices = curator.IndexList(client)

if indices.indices:
    delete = curator.DeleteIndices(indices, MASTER_TIMEOUT)
    logger.info('Going to delete {}'.format(indices.indices))
    if execute:
        delete.do_action()
    else:
        delete.do_dry_run()
else:
    logger.info('No indices to delete'

I grep in python curator package and found this:

lib/python2.7/site-packages/curator/defaults/settings.py
def default_options():
     return {
         'allow_ilm_indices': False,
         'continue_if_exception': False,
         'disable_action': False,
         'ignore_empty_list': False,
         'timeout_override': None,
     }

I can try write timeout_override in this file, but I think this is very bad idea

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.