Change default for [kafka]num_processors to 1

Currently the default for [kafka]num_processors is 0. This can lead to
the situation where monasca-persister starts but nothing happens
because no processes are started.
This can happen very easy in the default configuration where the
"num_processors" value in the different
sections ([kafka_alarm_history], [kafka_events], [kafka_metrics]) is
set to:

num_processors = $kafka.num_processors

which means that in the default case, 0 processes are started.
This is fixed now because the default for [kafka]num_processors is now
1.

Change-Id: I2c8ed56bbe91648543044201d7b6320f88a724c7
This commit is contained in:
Thomas Bechtold 2019-01-29 10:31:36 +01:00
parent e6d49a20c2
commit 6508384060
2 changed files with 5 additions and 1 deletions

View File

@ -42,7 +42,7 @@ kafka_common_opts = [
default=32768),
cfg.IntOpt('num_processors',
help='Number of processes spawned by persister',
default=0)
default=1)
]
kafka_common_group = cfg.OptGroup(name='kafka',

View File

@ -102,6 +102,10 @@ def prepare_processes(conf, repo_driver):
for proc in range(0, conf.num_processors):
processors.append(multiprocessing.Process(
target=start_process, args=(repository, conf)))
else:
LOG.warning("Number of processors (num_processors) is {}".format(
conf.num_processors))
def main():
"""Start persister."""