Add tunable parameters of mistral-engine

This change introduces support for some tunable parameters of
the mistral-engine service.

Change-Id: I9f67af2855b6b423c3d5cfbf69f2ff7747aef7d0
This commit is contained in:
Takashi Kajinami
2022-03-22 09:20:37 +09:00
parent d62e674d47
commit 0c6feacaf3
3 changed files with 119 additions and 31 deletions

View File

@@ -33,6 +33,25 @@
# of runtime execution objects. Use -1 for no limit.
# Defaults to $::os_service_default.
#
# [*execution_integrity_check_delay*]
# (Optional) A number of seconds since the last update of a task execution
# in RUNNING state after which Mistral will start checking its integrity.
# Defaults to $::os_service_default.
#
# [*execution_integrity_check_batch_size*]
# (Optional) A number of task executions in RUNNING state that the execution
# integurity checker can process in a single iteration.
# Defaults to $::os_service_default.
#
# [*action_definition_cache_time*]
# (Optional) A number of seconds that indicates how long action definitions
# should be stored in the local cache.
# Defaults to $::os_service_default.
#
# [*start_subworkflows_via_rpc*]
# (Optional) Enables startin subworkflows via RPC.
# Defaults to $::os_service_default.
#
# [*evaluation_interval*]
# (Optional) How often will the executions be evaluated
# (in minutes). For example for value 120 the interval
@@ -48,15 +67,19 @@
# Defaults to $::os_service_default.
#
class mistral::engine (
$package_ensure = present,
$manage_service = true,
$enabled = true,
$host = $::os_service_default,
$topic = $::os_service_default,
$version = $::os_service_default,
$execution_field_size_limit_kb = $::os_service_default,
$evaluation_interval = $::os_service_default,
$older_than = $::os_service_default,
$package_ensure = present,
$manage_service = true,
$enabled = true,
$host = $::os_service_default,
$topic = $::os_service_default,
$version = $::os_service_default,
$execution_field_size_limit_kb = $::os_service_default,
$execution_integrity_check_delay = $::os_service_default,
$execution_integrity_check_batch_size = $::os_service_default,
$action_definition_cache_time = $::os_service_default,
$start_subworkflows_via_rpc = $::os_service_default,
$evaluation_interval = $::os_service_default,
$older_than = $::os_service_default,
) {
include mistral::deps
@@ -86,10 +109,17 @@ class mistral::engine (
}
mistral_config {
'engine/host': value => $host;
'engine/topic': value => $topic;
'engine/version': value => $version;
'engine/execution_field_size_limit_kb': value => $execution_field_size_limit_kb;
'engine/host': value => $host;
'engine/topic': value => $topic;
'engine/version': value => $version;
'engine/execution_field_size_limit_kb': value => $execution_field_size_limit_kb;
'engine/execution_integrity_check_delay': value => $execution_integrity_check_delay;
'engine/execution_integrity_check_batch_size': value => $execution_integrity_check_batch_size;
'engine/action_definition_cache_time': value => $action_definition_cache_time;
'engine/start_subworkflows_via_rpc': value => $start_subworkflows_via_rpc;
}
mistral_config {
'execution_expiration_policy/evaluation_interval': value => $evaluation_interval;
'execution_expiration_policy/older_than': value => $older_than;
}

View File

@@ -0,0 +1,9 @@
---
features:
- |
The following parameters have been added to the ``mistral::engine`` class.
- ``execution_integrity_check_delay``
- ``execution_integrity_check_batch_size``
- ``action_definition_cache_time``
- ``start_subworkflows_via_rpc``

View File

@@ -2,28 +2,77 @@ require 'spec_helper'
describe 'mistral::engine' do
let :params do
{
:enabled => true,
:manage_service => true,
:host => 'foo_host',
:topic => 'foo_topic',
:version => '1.0',
:execution_field_size_limit_kb => '1234',
:evaluation_interval => 1234,
:older_than => 60
}
{}
end
shared_examples 'mistral::engine' do
context 'config params' do
context 'with defaults' do
it { is_expected.to contain_class('mistral::params') }
it { is_expected.to contain_mistral_config('engine/host').with_value( params[:host] ) }
it { is_expected.to contain_mistral_config('engine/topic').with_value( params[:topic] ) }
it { is_expected.to contain_mistral_config('engine/version').with_value( params[:version] ) }
it { is_expected.to contain_mistral_config('engine/execution_field_size_limit_kb').with_value( params[:execution_field_size_limit_kb] ) }
it { is_expected.to contain_mistral_config('execution_expiration_policy/evaluation_interval').with_value( params[:evaluation_interval] ) }
it { is_expected.to contain_mistral_config('execution_expiration_policy/older_than').with_value( params[:older_than] ) }
it 'configures mistral-engine parameters' do
is_expected.to contain_mistral_config('engine/host')\
.with_value('<SERVICE DEFAULT>')
is_expected.to contain_mistral_config('engine/topic')\
.with_value('<SERVICE DEFAULT>')
is_expected.to contain_mistral_config('engine/version')\
.with_value('<SERVICE DEFAULT>')
is_expected.to contain_mistral_config('engine/execution_field_size_limit_kb')
.with_value('<SERVICE DEFAULT>')
is_expected.to contain_mistral_config('engine/execution_integrity_check_delay')
.with_value('<SERVICE DEFAULT>')
is_expected.to contain_mistral_config('engine/execution_integrity_check_batch_size')
.with_value('<SERVICE DEFAULT>')
is_expected.to contain_mistral_config('engine/action_definition_cache_time')
.with_value('<SERVICE DEFAULT>')
is_expected.to contain_mistral_config('engine/start_subworkflows_via_rpc')
.with_value('<SERVICE DEFAULT>')
is_expected.to contain_mistral_config('execution_expiration_policy/evaluation_interval')\
.with_value('<SERVICE DEFAULT>')
is_expected.to contain_mistral_config('execution_expiration_policy/older_than')\
.with_value('<SERVICE DEFAULT>')
end
end
context 'config params' do
before do
params.merge!({
:host => 'foo_host',
:topic => 'foo_topic',
:version => '1.0',
:execution_field_size_limit_kb => 1024,
:execution_integrity_check_delay => 20,
:execution_integrity_check_batch_size => 5,
:action_definition_cache_time => 60,
:start_subworkflows_via_rpc => false,
:evaluation_interval => 1234,
:older_than => 60
})
end
it 'configures mistral-engine parameters' do
is_expected.to contain_mistral_config('engine/host')\
.with_value(params[:host])
is_expected.to contain_mistral_config('engine/topic')\
.with_value(params[:topic])
is_expected.to contain_mistral_config('engine/version')\
.with_value(params[:version])
is_expected.to contain_mistral_config('engine/execution_field_size_limit_kb')
.with_value(params[:execution_field_size_limit_kb])
is_expected.to contain_mistral_config('engine/execution_integrity_check_delay')
.with_value(params[:execution_integrity_check_delay])
is_expected.to contain_mistral_config('engine/execution_integrity_check_batch_size')
.with_value(params[:execution_integrity_check_batch_size])
is_expected.to contain_mistral_config('engine/action_definition_cache_time')
.with_value(params[:action_definition_cache_time])
is_expected.to contain_mistral_config('engine/start_subworkflows_via_rpc')
.with_value(params[:start_subworkflows_via_rpc])
is_expected.to contain_mistral_config('execution_expiration_policy/evaluation_interval')\
.with_value(params[:evaluation_interval])
is_expected.to contain_mistral_config('execution_expiration_policy/older_than')\
.with_value(params[:older_than])
end
end
[{:enabled => true}, {:enabled => false}].each do |param_hash|
@@ -40,7 +89,7 @@ describe 'mistral::engine' do
:hasstatus => true,
:hasrestart => true,
:tag => 'mistral-service',
)
)
is_expected.to contain_service('mistral-engine').that_subscribes_to(nil)
end
end