opensearch-project/opensearch-benchmark-workloads

Reduce code duplication on 'target_throughput' and 'search_clients' parameters definition

オープン

#64 opened on 2023/03/10

 (4 件のコメント) (0 件のリアクション) (0 人の担当者)Python (137 件のフォーク)auto 404
enhancementgood first issue

Repository metrics

Stars
 (33 個のスター)
PR merge metrics
 (平均マージ 5d 19h) (30d で 2 merged PRs)

説明

Is your feature request related to a problem?

Code duplication is introduced by the PR https://github.com/opensearch-project/opensearch-benchmark-workloads/pull/47

The below is the redundant code, which exists in the test procedure definition file for all datasets.

{%- if not target_throughput %}
,"target-throughput": 3
{%- elif target_throughput is string and target_throughput.lower() == 'none' %}
{%- else %}
,"target-throughput": {{ target_throughput | tojson }}
{%- endif %}
{%-if search_clients is defined and search_clients %}
,"clients": {{ search_clients | tojson}}
{%- endif %}

What solution would you like?

By using macros syntax, like commit https://github.com/opensearch-project/opensearch-benchmark-workloads/pull/58/commits/2a7138d050b645a0204334ad9f0a252d2b494889, to reuse the common codes in every file.

What alternatives have you considered?

Put the common codes in a separate file for reusing.

Do you have any additional context?

Coming from https://github.com/opensearch-project/opensearch-benchmark-workloads/pull/58#discussion_r1125144180

コントリビューターガイド