Coverage for curator/cli_singletons/forcemerge.py: 100%
14 statements
« prev ^ index » next coverage.py v7.3.0, created at 2023-08-16 15:27 -0600
« prev ^ index » next coverage.py v7.3.0, created at 2023-08-16 15:27 -0600
1"""ForceMerge Singleton"""
2import click
3from curator.cli_singletons.object_class import cli_action
4from curator.cli_singletons.utils import get_width, validate_filter_json
6@click.command(context_settings=get_width())
7@click.option(
8 '--max_num_segments',
9 type=int,
10 required=True,
11 help='Maximum number of segments per shard (minimum of 1)'
12)
13@click.option(
14 '--delay',
15 type=float,
16 help='Time in seconds to delay between operations. Default 0. Maximum 3600'
17)
18@click.option(
19 '--ignore_empty_list',
20 is_flag=True,
21 help='Do not raise exception if there are no actionable indices'
22)
23@click.option(
24 '--allow_ilm_indices/--no-allow_ilm_indices',
25 help='Allow Curator to operate on Index Lifecycle Management monitored indices.',
26 default=False,
27 show_default=True
28)
29@click.option(
30 '--filter_list',
31 callback=validate_filter_json,
32 help='JSON array of filters selecting indices to act on.',
33 required=True)
34@click.pass_context
35def forcemerge(ctx, max_num_segments, delay, ignore_empty_list, allow_ilm_indices, filter_list):
36 """
37 forceMerge Indices (reduce segment count)
38 """
39 manual_options = {
40 'max_num_segments': max_num_segments,
41 'delay': delay,
42 'allow_ilm_indices': allow_ilm_indices,
43 }
44 # ctx.info_name is the name of the function or name specified in @click.command decorator
45 action = cli_action(
46 ctx.info_name, ctx.obj['config']['client'], manual_options, filter_list, ignore_empty_list)
47 action.do_singleton_action(dry_run=ctx.obj['dry_run'])