Support more [execution_expiration_policy] parameters
Change-Id: I3fb67451dea1a9834002a466e4bc206869527fbb
This commit is contained in:
parent
0c6feacaf3
commit
0b8ca269cb
@ -52,11 +52,13 @@
|
||||
# (Optional) Enables startin subworkflows via RPC.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# DEPRECATED PARAMETERS
|
||||
#
|
||||
# [*evaluation_interval*]
|
||||
# (Optional) How often will the executions be evaluated
|
||||
# (in minutes). For example for value 120 the interval
|
||||
# will be 2 hours (every 2 hours).
|
||||
# Defaults to $::os_service_default.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*older_than*]
|
||||
# (Optional) Evaluate from which time remove executions in minutes.
|
||||
@ -64,7 +66,7 @@
|
||||
# that finished a 60 minutes ago or more.
|
||||
# Minimum value is 1.
|
||||
# Note that only final state execution will remove (SUCCESS/ERROR).
|
||||
# Defaults to $::os_service_default.
|
||||
# Defaults to undef.
|
||||
#
|
||||
class mistral::engine (
|
||||
$package_ensure = present,
|
||||
@ -78,13 +80,24 @@ class mistral::engine (
|
||||
$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,
|
||||
# DEPRECATED PARAMETERS
|
||||
$evaluation_interval = undef,
|
||||
$older_than = undef,
|
||||
) {
|
||||
|
||||
include mistral::deps
|
||||
include mistral::params
|
||||
|
||||
if $evaluation_interval != undef {
|
||||
warning('The mistral::engine::evaluation_interval parameter is deprecated. \
|
||||
Use the mistral::execution_expiration_policy class instead.')
|
||||
}
|
||||
if $older_than != undef {
|
||||
warning('The mistral::engine::older_than parameter is deprecated. \
|
||||
Use the mistral::execution_expiration_policy class instead.')
|
||||
}
|
||||
include mistral::execution_expiration_policy
|
||||
|
||||
package { 'mistral-engine':
|
||||
ensure => $package_ensure,
|
||||
name => $::mistral::params::engine_package_name,
|
||||
@ -118,10 +131,4 @@ class mistral::engine (
|
||||
'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;
|
||||
}
|
||||
|
||||
}
|
||||
|
50
manifests/execution_expiration_policy.pp
Normal file
50
manifests/execution_expiration_policy.pp
Normal file
@ -0,0 +1,50 @@
|
||||
# == Class: mistral::execution_expiration_policy
|
||||
#
|
||||
# Configure the mistral execution_expiration_policy
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*evaluation_interval*]
|
||||
# (Optional) How often will the executions be evaluated (in minutes).
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*older_than*]
|
||||
# (Optional) Evaluate from which time remove executions in minutes.
|
||||
# Note that only final state execution will remove (SUCCESS/ERROR).
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*max_finished_executions*]
|
||||
# (Optional) THe maximum nuber of finised workflow executions to be stored.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*batch_size*]
|
||||
# (Optional) Size of batch of expired executions to be deleted.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*ignored_states*]
|
||||
# (Optional) THe states that the expiration policy will filter out and will
|
||||
# not delete.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
class mistral::execution_expiration_policy (
|
||||
$evaluation_interval = $::os_service_default,
|
||||
$older_than = $::os_service_default,
|
||||
$max_finished_executions = $::os_service_default,
|
||||
$batch_size = $::os_service_default,
|
||||
$ignored_states = $::os_service_default,
|
||||
) {
|
||||
|
||||
include mistral::deps
|
||||
include mistral::params
|
||||
|
||||
$evaluation_interval_real = pick($::mistral::engine::evaluation_interval, $evaluation_interval)
|
||||
$older_than_real = pick($::mistral::engine::older_than, $older_than)
|
||||
|
||||
mistral_config {
|
||||
'execution_expiration_policy/evaluation_interval': value => $evaluation_interval_real;
|
||||
'execution_expiration_policy/older_than': value => $older_than_real;
|
||||
'execution_expiration_policy/max_finished_executions': value => $max_finished_executions;
|
||||
'execution_expiration_policy/batch_size': value => $batch_size;
|
||||
'execution_expiration_policy/ignored_states': value => join(any2array($ignored_states), ',');
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The new ``mistral::execution_expiration_policy`` class has been added.
|
||||
|
||||
deprecations:
|
||||
- |
|
||||
The following parameters of the ``mistral::engine`` class have been
|
||||
deprecated in favor of the new ``mistral::execution_expiration_policy``
|
||||
class.
|
||||
|
||||
- ``evaluation_interval``
|
||||
- ``older_than``
|
58
spec/classes/mistral_execution_expiration_policy_spec.rb
Normal file
58
spec/classes/mistral_execution_expiration_policy_spec.rb
Normal file
@ -0,0 +1,58 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'mistral::execution_expiration_policy' do
|
||||
|
||||
shared_examples_for 'mistral::execution_expiration_policy' do
|
||||
context 'with defaults' do
|
||||
it 'configures execution_expiration_policy parameters' do
|
||||
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>')
|
||||
is_expected.to contain_mistral_config('execution_expiration_policy/max_finished_executions')\
|
||||
.with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_mistral_config('execution_expiration_policy/batch_size')\
|
||||
.with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_mistral_config('execution_expiration_policy/ignored_states')\
|
||||
.with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with specific parameters' do
|
||||
let :params do
|
||||
{
|
||||
:evaluation_interval => 120,
|
||||
:older_than => 1,
|
||||
:max_finished_executions => 0,
|
||||
:batch_size => 10,
|
||||
:ignored_states => ['SUCCESS', 'ERROR', 'CANCELLED']
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures execution_expiration_policy parameters' do
|
||||
is_expected.to contain_mistral_config('execution_expiration_policy/evaluation_interval')\
|
||||
.with_value(120)
|
||||
is_expected.to contain_mistral_config('execution_expiration_policy/older_than')\
|
||||
.with_value(1)
|
||||
is_expected.to contain_mistral_config('execution_expiration_policy/max_finished_executions')\
|
||||
.with_value(0)
|
||||
is_expected.to contain_mistral_config('execution_expiration_policy/batch_size')\
|
||||
.with_value(10)
|
||||
is_expected.to contain_mistral_config('execution_expiration_policy/ignored_states')\
|
||||
.with_value('SUCCESS,ERROR,CANCELLED')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_configures 'mistral::execution_expiration_policy'
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user