6 A nice feature of the input task format used in Yardstick is that it supports the template syntax based on Jinja2.
7 This turns out to be extremely useful when, say, you have a fixed structure of your task but you want to
8 parameterize this task in some way.
9 For example, imagine your input task file (task.yaml) runs a set of Ping scenarios:
13 # Sample benchmark task config file
14 # measure network latency using ping
15 schema: "yardstick:task:0.1"
37 Let's say you want to run the same set of scenarios with the same runner/context/sla,
38 but you want to try another packetsize to compare the performance.
39 The most elegant solution is then to turn the packetsize name into a template variable:
43 # Sample benchmark task config file
44 # measure network latency using ping
46 schema: "yardstick:task:0.1"
51 packetsize: {{packetsize}}
67 and then pass the argument value for {{packetsize}} when starting a task with this configuration file.
68 Yardstick provides you with different ways to do that:
70 1.Pass the argument values directly in the command-line interface (with either a JSON or YAML dictionary):
74 yardstick task start samples/ping-template.yaml --task-args '{"packetsize": "200"}'
76 2.Refer to a file that specifies the argument values (JSON/YAML):
80 yardstick task start samples/ping-template.yaml --task-args-file args.yaml
82 Using the default values
83 ------------------------
84 Note that the Jinja2 template syntax allows you to set the default values for your parameters.
85 With default values set, your task file will work even if you don't parameterize it explicitly while starting a task.
86 The default values should be set using the {% set ... %} clause (task.yaml).For example:
90 # Sample benchmark task config file
91 # measure network latency using ping
92 schema: "yardstick:task:0.1"
93 {% set packetsize = packetsize or "100" %}
98 packetsize: {{packetsize}}
108 If you don't pass the value for {{packetsize}} while starting a task, the default one will be used.
112 Yardstick makes it possible to use all the power of Jinja2 template syntax, including the mechanism of built-in functions.
113 As an example, let us make up a task file that will do a block storage performance test.
114 The input task file (fio-template.yaml) below uses the Jinja2 for-endfor construct to accomplish that:
118 #Test block sizes of 4KB, 8KB, 64KB, 1MB
119 #Test 5 workloads: read, write, randwrite, randread, rw
120 schema: "yardstick:task:0.1"
123 {% for bs in ['4k', '8k', '64k', '1024k' ] %}
124 {% for rw in ['read', 'write', 'randwrite', 'randread', 'rw' ] %}
128 filename: /home/ec2-user/data.raw