nmbrs-workload 0.3.0

Uniform workload specification parsing and processing for nmbrs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
---
source: nb-apis/adapters-api/src/main/java/workload_definition/02_workload_structure.md
---
# Workload Structure

## Keywords

The following words have special meaning in templated workloads:

- name - names things
- desc, description - describes the current element. First line is summary.
- scenarios - describes named command sequences for automated workflows
- bindings - defines procedural generation functions
- params - decorates operations with special configurations
- tags - describes elements for filtering and grouping
- op, ops, operations statement, statements - defines op templates
- blocks - groups any or all elements

---

## Description

**zero or one `description` fields:**

The first line of the description represents the summary of the description in summary views.
Otherwise, the whole value is used.

*yaml:*

```yaml
description: |
  summary of this workload
  and more details
```

*json:*

```json

{
  "description": "summary of this workload\nand more details\n"
}
```

*ops:*

```json

[]
```

---

## Scenarios

**zero or one `scenarios` fields, containing one of the following forms**

The way that you create macro-level workloads from individual stages is called *named scenarios* in
NB. These are basically command line templates which can be invoked automatically by calling their
name out on your command line. More details on their usage are in the workload construction guide.
We're focused merely on the structural rules here.

### single un-named step

*yaml:*

```yaml
scenarios:
  default: run driver=diag cycles=10
```

*json:*

```json

{
  "scenarios": {
    "default": "run driver=diag cycles=10"
  }
}
```

*ops:*

```json

[]
```

### multiple named steps

*yaml:*

```yaml
scenarios:
  default:
    step1: run alias=first driver=diag cycles=10
    step2: run alias=second driver=diag cycles=10
```

*json:*

```json

{
  "scenarios": {
    "default": {
      "step1": "run alias=first driver=diag cycles=10",
      "step2": "run alias=second driver=diag cycles=10"
    }
  }
}
```

*ops:*

```json

[]
```

### list of un-named steps

*yaml:*

```yaml
scenarios:
  default:
    - run alias=first driver=diag cycles=10
    - run alias=second driver=diag cycles=10
```

*json:*

```json

{
  "scenarios": {
    "default": [
      "run alias=first driver=diag cycles=10",
      "run alias=second driver=diag cycles=10"
    ]
  }
}
```

*ops:*

```json

[]
```

### silent locked step parameters

For scenario steps which should not be overridable by user parameters on the command line, a double
equals is used to lock the values for a given step without informing the user that their provided
value was ignored. This can be useful in cases where there are multiple steps and some parameters
should only be changeable for some steps.

*yaml:*

```yaml
# The user is not allowed to change the value for the alias parameter, and attempting to do so
# will cause an error to be thrown and the scenario halted.
scenarios:
  default: run alias==first driver=diag cycles=10
```

*json:*

```json

{
  "scenarios": {
    "default": "run alias==first driver=diag cycles=10"
  }
}
```

*ops:*

```json

[]
```

### verbose locked step parameters

For scenario steps which should not be overridable by user parameters on the command line, a triple
equals is used to indicate that changing these parameters is not allowed. If a user tries to
override a verbose locked parameter, an error is thrown and the scenario is not allowed to run. This
can be useful when you want to clearly indicate that a parameter must remain as it is.

*yaml:*

```yaml
# The user is not allowed to change the value for the alias parameter, and attempting to do so
# will cause an error to be thrown and the scenario halted.
scenarios:
  default: run alias===first driver=diag cycles=10
```

*json:*

```json

{
  "scenarios": {
    "default": "run alias===first driver=diag cycles=10"
  }
}
```

*ops:*

```json

[]
```

---

## Bindings

**zero or one `bindings` fields, containing a map of named bindings recipes**

Bindings are the functions which synthesize data for your operations. They are specified in recipes
which are just function chains from the provided libraries.

*yaml:*

```yaml
bindings:
  cycle: Identity();
  name: NumberNameToString();
```

*json:*

```json

{
  "bindings": {
    "cycle": "Identity();",
    "name": "NumberNameToString();"
  }
}
```

*ops:*

```json

[]
```

---

## Params

**zero of one `params` fields, containing a map of parameter names to values**

Params are modifiers to your operations. They specify important details which are not part of the
operation's command or payload, like consistency level, or timeout settings.

*yaml:*

```yaml
params:
  param1: pvalue1
  param2: pvalue2
```

*json:*

```json

{
  "params": {
    "param1": "pvalue1",
    "param2": "pvalue2"
  }
}
```

*ops:*

```json

[]
```

---

## Tags

**zero or one `tags` fields, containing a map of tag names and values**

Tags are how you mark your operations for special inclusion into tests. They are basically naming
metadata that lets you filter what type of operations you actually use. Further details on tags are
in the workload construction guide.

*yaml:*

```yaml
tags:
  block: main
```

*json:*

```json

{
  "tags": {
    "block": "main"
  }
}
```

*ops:*

```json

[]
```

---

## Blocks

Blocks are used to logically partition a workload for the purposes of grouping, configuring or
executing subsets and op sequences. Blocks can contain any of the defined elements above.
Every op template within a block automatically gets a tag with the name 'block' and the value of
the block name. This makes it easy to select a whole block at a time with a tag filter like
`tags=block:"schema.*"`.

Blocks are not recursive. You may not put a block inside another block.


### named blocks as a map of property maps

*yaml:*

```yaml
blocks:
  namedblock1:
    ops:
      op1: select * from bar.table;
      op2:
        type: batch
        stmt: insert into bar.table (a,b,c) values (1,2,3);
```

*json:*

```json

{
  "blocks": {
    "namedblock1": {
      "ops": {
        "op1": "select * from bar.table;",
        "op2": {
          "type": "batch",
          "stmt": "insert into bar.table (a,b,c) values (1,2,3);"
        }
      }
    }
  }
}
```

*ops:*

```json

[
  {
    "name": "op1",
    "op": {
      "stmt": "select * from bar.table;"
    },
    "tags": {
      "name": "op1",
      "block": "namedblock1",
      "op": "op1"
    }
  },
  {
    "name": "op2",
    "op": {
      "stmt": "insert into bar.table (a,b,c) values (1,2,3);",
      "type": "batch"
    },
    "tags": {
      "name": "op2",
      "block": "namedblock1",
      "op": "op2"
    }
  }
]
```

### lists of blocks as a list of property maps

When blocks are defined as a list of entries, each entry is a map.

*yaml:*

```yaml
blocks:
  - ops:
      op1: select * from bar.table;
      op2:
        type: batch
        stmt: insert into bar.table (a,b,c) values (1,2,3);
  - name: this_is_block_2
    ops:
      op3: select * from foo.table;

```

*json:*

```json

{
  "blocks": [
    {
      "ops": {
        "op1": "select * from bar.table;",
        "op2": {
          "type": "batch",
          "stmt": "insert into bar.table (a,b,c) values (1,2,3);"
        }
      }
    },
    {
      "name": "this_is_block_2",
      "ops": {
        "op3": "select * from foo.table;"
      }
    }
  ]
}
```

*ops:*

```json

[
  {
    "name": "op1",
    "op": {
      "stmt": "select * from bar.table;"
    },
    "tags": {
      "name": "op1",
      "block": "block1",
      "op": "op1"
    }
  },
  {
    "name": "op2",
    "op": {
      "stmt": "insert into bar.table (a,b,c) values (1,2,3);",
      "type": "batch"
    },
    "tags": {
      "name": "op2",
      "block": "block1",
      "op": "op2"
    }
  },
  {
    "name": "op3",
    "op": {
      "stmt": "select * from foo.table;"
    },
    "tags": {
      "name": "op3",
      "block": "this_is_block_2",
      "op": "op3"
    }
  }
]
```

---

## Names

All documents, blocks, and ops within a workload can have an assigned name. When map and list forms
are both supported for entries, the map form provides the name. When list forms are used, an
additional field named `name` can be used.

*yaml:*

```yaml
blocks:
  - name: myblock
    op: "test op"

```

*json:*

```json

{
  "blocks": [
    {
      "name": "myblock",
      "op": "test op"
    }
  ]
}
```

*ops:*

```json

[
  {
    "name": "stmt1",
    "op": {
      "stmt": "test op"
    },
    "tags": {
      "name": "stmt1",
      "block": "myblock",
      "op": "stmt1"
    }
  }
]
```

--

# Putting things together

This document is focused on the basic properties that can be added to a templated workload. To see
how they are combined together, see [Op Templates Basics](op_template_basics.md).