Hierarchy and Inheritance

A context can include itself other contexts by the contexts key. Each of them allows the same properties as its parent context. The properties task_defaults and script_defaults pass on their values through the context hierarchy where items deeper in the hierarchy override values defined earlier if keys overlap. The precises mechanism is described on the composing data page.

We explore the inheritance mechanism by the following example on this page.

 1context:
 2  task_defaults:
 3    priority: 1
 4    max_trials: 2
 5  tasks:
 6    'task 1': {}
 7    'task 2':
 8      priority: 2
 9  contexts:
10    'sub context':
11      tasks_defaults:
12        priority: 3
13      tasks:
14        'task 3': {}
15        'task 4':
16          max_trials: 4
17          priority: 4

This results in the following values for the tasks.

Task name priority max_trials
task 1 1 2
task 2 2 2
task 3 3 2
task 4 4 4

"Contexts, Hierarchy and Inheritance"