# Preset step

A preset step performs a single experiment with a specific configuration. The purpose of this step is to help you quickly understand how good is a particular configuration.

A preset step offers two options when selecting the configuration of the experiment to be executed:

* Use a configuration taken from an experiment of a study (can be the same study)
* Use a custom configuration

The preset step has the following structure:

| Field                   | Type             | Value restrictions                                                                      | Is required | Default value | Description                                                                                                                                                                                                                                                                          |
| ----------------------- | ---------------- | --------------------------------------------------------------------------------------- | ----------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `type`                  | string           | `preset`                                                                                | yes         |               | The type of the step, in this case, `preset`                                                                                                                                                                                                                                         |
| `name`                  | string           |                                                                                         | yes         |               | The name of the step                                                                                                                                                                                                                                                                 |
| `runOnFailure`          | boolean          | <p><code>true</code><br><code>false</code></p>                                          | no          | `false`       | <p>The execution policy of the step:</p><ul><li><code>false</code> prevents the step from running in case the previous step failed</li><li><code>true</code> allows the step to run even if the previous step failed</li></ul>                                                       |
| `from`                  | array of objects | Each object should have the structure described below                                   | no          |               | <p>The study and the experiment from which to take the configuration of the experiment</p><p>The <code>from</code> and <code>experiments</code> fields are defined as an array, but it can only contain one element</p><p>This can be set only if <code>values</code> is not set</p> |
| `values`                | object           | The keys should match existing parameters                                               | no          |               | <p>The configuration with which execute the experiment</p><p>This can be set only if <code>from</code> is not set</p>                                                                                                                                                                |
| `doNotRenderParameters` | string           | this cannot be used when using a *from* option since no experiment is actually executed | no          |               | Parameters not to be rendered. - see [Parameter rending](https://docs.akamas.io/akamas-docs/3.6/reference/construct-templates/study-template/parameter-rendering)                                                                                                                    |
| `renderParameters`      | string           | this cannot be used when using a *from* option since no experiment is actually executed | no          |               | Parameters to be rendered. - see [Parameter rending](https://docs.akamas.io/akamas-docs/3.6/reference/construct-templates/study-template/parameter-rendering)                                                                                                                        |

where the `from` field should have the following structure:

```yaml
study: "study_preset_1"
experiments: [1]
```

with

* `study` contains the name or ID of the study from which to take the configuration. In the case this is omitted, the same study of the step is considered for experiments from which taking configurations
* `experiments` contains the number of the experiment from which to take the configuration

### Examples <a href="#custom-configuration" id="custom-configuration"></a>

#### Custom configuration <a href="#custom-configuration" id="custom-configuration"></a>

You can provide a custom configuration by setting `values`:

```yaml
name: "my_preset"   # name of the step
type: "preset"      # type of the step (preset)
values:
  jvm1.maxHeapSize: 1024 # parameter maxHeapSize of jvm1 is set to 1024
  jvm2.maxHeapSize: 2048 # parameter maxHeapSize of jvm2 is set to 2048
```

#### Configuration from another study <a href="#configuration-taken-from-another-study" id="configuration-taken-from-another-study"></a>

You can select a configuration taken from another study by setting `from`:

```yaml
name: "my_preset"  # name of the step
type: "preset"     # type of the step (preset)
from:
  - study: "preset_study_1" # name or ID of the study from which to take the configuration
    experiments: [1] # the number of the experiment from which to take the configuration
```

#### Configuration from the same study <a href="#configuration-taken-from-the-same-study" id="configuration-taken-from-the-same-study"></a>

You can select a configuration taken from the same study by setting `from` but by omitting the `study` field:

```yaml
name: "my_preset"    # name of the step
type: "preset"       # type of the step (preset)
from:
  - experiments: [1] # the step will take the configuration of the experiment #1 of the same study of the step
```

Notice: the `from` and `experiments` fields are defined as a list, but can only contain one element.
