diff --git a/.zuul.yaml b/.zuul.yaml index 44a76f866..a2ee500a3 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -7,6 +7,11 @@ rally_task: rally-jobs/task-mistral.yaml devstack_localrc: USE_PYTHON3: true + devstack_local_conf: + post-config: + $MISTRAL_CONF_FILE: + engine: + execution_field_size_limit_kb: 8192 required-projects: - openstack/rally-openstack - openstack/mistral-lib diff --git a/rally-jobs/plugins/mistral_expressions_scenario.py b/rally-jobs/plugins/mistral_expressions_scenario.py new file mode 100644 index 000000000..ae7eb28b0 --- /dev/null +++ b/rally-jobs/plugins/mistral_expressions_scenario.py @@ -0,0 +1,142 @@ +# Copyright 2020 - Nokia Software. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import json +import math +import random +import string + +from rally.task import validation +from rally_openstack import consts +from rally_openstack import scenario +from rally_openstack.scenarios.mistral import utils + + +def random_string(length=10): + """Generate a random string of given length """ + + letters = string.ascii_lowercase + + return ''.join(random.choices(letters, k=length)) + + +class MistralExpressionScenario(utils.MistralScenario): + + def run(self, tasks_number=50, params_size_mb=5): + wf_text, wf_name = self.create_wf_string(tasks_number) + params = self.create_params(params_size_mb) + + self._create_workflow(wf_text) + self._create_execution(wf_name, **params) + + def create_params(self, size_mb): + block_size_mb = 0.2 + rand_string = random_string(105400) + number_of_fields = math.floor(size_mb / block_size_mb) + data_list = '' + # each one of these blocks is 200kb + data_template = """ + "data%s": + { + "dummy": 5470438, + "data_value": -796997888, + "sub_data": + { + "meta_data": + { + "value": "%s", + "text": "dummy text" + }, + "field1": "%s", + "field2": false, + "field3": + { + "value1": -1081872761.2081857, + "value2": -1081872761.2081857 + } + } + }, +""" + wf_params = """ + { + "field": "some Value", + "data": + { + {{{__DATA_LIST__}}} + } + } +""" + for i in range(1, int(number_of_fields + 1)): + data_list += data_template % (i, rand_string, rand_string) + + data_list = data_list[:-2] + + wf_params = wf_params.replace('{{{__DATA_LIST__}}}', data_list) + params = json.loads(wf_params) + + return params + + def get_query(self): + raise NotImplementedError + + def create_wf_string(self, tasks_number): + wf_tasks = '' + wf_name = 'wf_{}'.format(random_string(5)) + + query = self.get_query() + + wf_text = """ + version: '2.0' + {}: + tasks: + task0: + action: std.noop + {{{__TASK_LIST__}}} + """ + task_template = """ + task{}: + action: std.noop + publish: + output{}: {} + """ + + for i in range(1, tasks_number + 1): + wf_tasks += task_template.format(i, i, query) + + wf_text = wf_text.replace('{{{__TASK_LIST__}}}', wf_tasks) + + wf_text = wf_text.format(wf_name) + + return wf_text, wf_name + + +@validation.add("required_platform", platform="openstack", users=True) +@validation.add("required_services", services=[consts.Service.MISTRAL]) +@scenario.configure(name="MistralExecutions.YaqlExpression", + platform="openstack") +class YaqlExpressionScenario(MistralExpressionScenario): + + def get_query(self): + return '<% data %>' + + +@validation.add("required_platform", platform="openstack", users=True) +@validation.add("required_services", services=[consts.Service.MISTRAL]) +@scenario.configure(name="MistralExecutions.JinjaExpression", + platform="openstack") +class JinjaExpressionScenario(MistralExpressionScenario): + + def get_query(self): + return '{{ data }} ' diff --git a/rally-jobs/task-mistral.yaml b/rally-jobs/task-mistral.yaml index b9a48122e..bc003e65a 100644 --- a/rally-jobs/task-mistral.yaml +++ b/rally-jobs/task-mistral.yaml @@ -162,3 +162,37 @@ sla: failure_rate: max: 0 + + MistralExecutions.YaqlExpression: + - + args: + tasks_number: 30 + params_size_mb: 4 + runner: + type: "constant" + times: 50 + concurrency: 10 + context: + users: + tenants: 1 + users_per_tenant: 1 + sla: + failure_rate: + max: 0 + + MistralExecutions.JinjaExpression: + - + args: + tasks_number: 30 + params_size_mb: 4 + runner: + type: "constant" + times: 50 + concurrency: 10 + context: + users: + tenants: 1 + users_per_tenant: 1 + sla: + failure_rate: + max: 0