1 .. This work is licensed under a Creative Commons Attribution 4.0 International
3 .. http://creativecommons.org/licenses/by/4.0
4 .. (c) OPNFV, Huawei Technologies Co.,Ltd and others.
11 A nice feature of the input task format used in Yardstick is that it supports
12 the template syntax based on Jinja2.
13 This turns out to be extremely useful when, say, you have a fixed structure of
14 your task but you want to parameterize this task in some way.
15 For example, imagine your input task file (task.yaml) runs a set of Ping
20 # Sample benchmark task config file
21 # measure network latency using ping
22 schema: "yardstick:task:0.1"
44 Let's say you want to run the same set of scenarios with the same runner/
45 context/sla, but you want to try another packetsize to compare the performance.
46 The most elegant solution is then to turn the packetsize name into a template
51 # Sample benchmark task config file
52 # measure network latency using ping
54 schema: "yardstick:task:0.1"
59 packetsize: {{packetsize}}
75 and then pass the argument value for {{packetsize}} when starting a task with
76 this configuration file.
77 Yardstick provides you with different ways to do that:
79 1.Pass the argument values directly in the command-line interface (with either
80 a JSON or YAML dictionary):
84 yardstick task start samples/ping-template.yaml
85 --task-args'{"packetsize":"200"}'
87 2.Refer to a file that specifies the argument values (JSON/YAML):
91 yardstick task start samples/ping-template.yaml --task-args-file args.yaml
93 Using the default values
94 ------------------------
95 Note that the Jinja2 template syntax allows you to set the default values for
97 With default values set, your task file will work even if you don't
98 parameterize it explicitly while starting a task.
99 The default values should be set using the {% set ... %} clause (task.yaml).
104 # Sample benchmark task config file
105 # measure network latency using ping
106 schema: "yardstick:task:0.1"
107 {% set packetsize = packetsize or "100" %}
112 packetsize: {{packetsize}}
122 If you don't pass the value for {{packetsize}} while starting a task, the
123 default one will be used.
128 Yardstick makes it possible to use all the power of Jinja2 template syntax,
129 including the mechanism of built-in functions.
130 As an example, let us make up a task file that will do a block storage
132 The input task file (fio-template.yaml) below uses the Jinja2 for-endfor
133 construct to accomplish that:
137 #Test block sizes of 4KB, 8KB, 64KB, 1MB
138 #Test 5 workloads: read, write, randwrite, randread, rw
139 schema: "yardstick:task:0.1"
142 {% for bs in ['4k', '8k', '64k', '1024k' ] %}
143 {% for rw in ['read', 'write', 'randwrite', 'randread', 'rw' ] %}
147 filename: /home/ubuntu/data.raw