|
| 1 | +# Multi-Loader |
| 2 | + |
| 3 | +A wrapper around loader to run multiple experiments in sequence with additional features like validation, dry-run, log collection |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | +As a wrapper around loader, multi-loader requires the initial cluster setup to be completed. See [vHive Loader to create a cluster](https://github.com/vhive-serverless/invitro/blob/main/docs/loader.md#create-a-cluster) |
| 7 | + |
| 8 | +## Configuration |
| 9 | +### Multi-Loader Configuration |
| 10 | +| Parameter name | Data type | Possible values | Default value | Description | |
| 11 | +|---------------------|--------------------|-----------------|---------------|------------------------------------------------------------| |
| 12 | +| Studies | []LoaderStudy | N/A | N/A | A list of loader studies with their respective configurations. See [LoaderStudy](#loaderstudy) | |
| 13 | +| BaseConfigPath | string | "tools/multi_loader/base_loader_config.json" | N/A | Path to the base configuration file | |
| 14 | +| IatGeneration | bool | true, false | false | (Optional) Whether to Generate iats only and skip invocations | |
| 15 | +| Generated | bool | true, false | false | (Optional) if iats were already generated | |
| 16 | +| PreScript | string | any bash command | "" | (Optional) A global script that runs once before all experiments | |
| 17 | +| PostScript | string | any bash command | "" | (Optional) A global script that runs once after all experiments | |
| 18 | + |
| 19 | +### LoaderStudy |
| 20 | +| Parameter name | Data type | Possible values | Default value | Description | |
| 21 | +|-----------------------|------------------------|-------------------------------|---------------|--------------------------------------------------------------------| |
| 22 | +| Config | map[string]interface{} | Any field in [LoaderConfiguration](https://github.com/vhive-serverless/invitro/blob/main/docs/configuration.md#loader-configuration-file-format) except `Platform`| N/A | The configuration for each loader experiment which overrides configurations in baseLoaderConfig | |
| 23 | +| Name | string | N/A | N/A | The name of the loader experiment | |
| 24 | +| TracesDir | string | N/A | N/A | Directory containing the traces for the experiment | |
| 25 | +| TracesFormat | string | "data/traces/example_{}" | N/A | Format of the trace files **The format string "{}" is required** | |
| 26 | +| TraceValues | []interface{} | ["any", 0, 1.1] | N/A | Values of the trace files Replaces the "{}" in TraceFormat | |
| 27 | +| OutputDir | string | any | data/out/{Name} | (Optional) Output directory for experiment results | |
| 28 | +| Verbosity | string | "info", "debug", "trace" | "info" | (Optional) Verbosity level for logging the experiment | |
| 29 | +| PreScript | string | any bash Command | "" | (Optional) Local script that runs this specific experiment | |
| 30 | +| PostScript | string | any bash Command | "" | (Optional) Local script that runs this specific experiment | |
| 31 | + |
| 32 | +> **_Important_**: |
| 33 | +> |
| 34 | +> Only one of the following is required: |
| 35 | +> 1. `TracesDir`, or |
| 36 | +> 2. `TracesFormat` and `TraceValues`, or |
| 37 | +> 3. `TracePath` within the `LoaderExperiment`'s `Config` field |
| 38 | +> |
| 39 | +> If more than one is defined, the order of precedence is as follows: |
| 40 | +> 1. `TracesDir`, |
| 41 | +> 2. `TracesFormat` and `TraceValues`, |
| 42 | +> 3. `TracePath` |
| 43 | +> |
| 44 | +> The `Platform` field must not be overridden and should only be defined in the base config. |
| 45 | +> |
| 46 | +> The `IatGeneration` and `Generated` fields may not function as expected when handling multiple experiments due to limitations in the loader implementation. |
| 47 | +
|
| 48 | +> **_Note_**: |
| 49 | +> |
| 50 | +> The `Config` field follows the same structure as the [LoaderConfiguration](https://github.com/vhive-serverless/invitro/blob/main/docs/configuration.md#loader-configuration-file-format). |
| 51 | +> Any field defined in `Config` will override the corresponding value from the configuration in `BaseConfigPath`, but only for that specific experiment. |
| 52 | +> For example, if `BaseConfigPath` has `ExperimentDuration` set to 5 minutes, and you define `ExperimentDuration` as 10 minutes in `Config`, that particular experiment will run for 10 minutes instead. |
| 53 | +
|
| 54 | +## Command Flags |
| 55 | + |
| 56 | +The multi-loader accepts the following command-line flags. |
| 57 | + |
| 58 | +> **_Note_**: These flags will subsequently be used during the execution of loader.go for **<u>every experiment</u>**. If you would like to define these flag for specific experiments only, define it in [LoaderStudy](#loaderstudy) |
| 59 | +
|
| 60 | +Available flags: |
| 61 | + |
| 62 | +- **`--multiLoaderConfig`** *(default: `tools/multi_loader/multi_loader_config.json`)*: |
| 63 | + Specifies the path to the multi-loader configuration file. This file contains settings and parameters that define how the multi-loader operates [see above](#multi-loader-configuration) |
| 64 | + |
| 65 | +- **`--verbosity`** *(default: `info`)*: |
| 66 | + Sets the logging verbosity level. You can choose from the following options: |
| 67 | + - `info`: Standard information messages. |
| 68 | + - `debug`: Detailed debugging messages. |
| 69 | + - `trace`: Extremely verbose logging, including detailed execution traces. |
| 70 | + |
| 71 | +- **`--failFast`** *(default: `false`)*: |
| 72 | + Determines whether the multi-loader should skip the study immediately after a failure. By default, the loader retries a failed experiment once with debug verbosity and skips the study only if the second attempt also fails. Setting this flag to `true` prevents the retry and skips the study after the first failure. |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +## Multi-loader Overall Flow |
| 77 | + |
| 78 | +1. **Initialization** |
| 79 | + - Flags for configuration file path, verbosity, IAT generation, and execution mode are parsed |
| 80 | + - Logger is initialized based on verbosity level |
| 81 | + |
| 82 | +3. **Experiment Execution Flow** |
| 83 | + - The multi-loader runner is instantiated with the provided configuration path. |
| 84 | + - A dry run is executed to validate the setup for all studies: |
| 85 | + - If any dry run fails, the execution terminates. |
| 86 | + - If all dry runs succeed, proceed to actual runs: |
| 87 | + - Global pre-scripts are executed. |
| 88 | + - Each experiment undergoes the following steps: |
| 89 | + 1. **Pre-Execution Setup** |
| 90 | + - Experiment-specific pre-scripts are executed. |
| 91 | + - Necessary directories and folders are created. |
| 92 | + - Each sub-experiment is unpacked and prepared |
| 93 | + 2. **Experiment Invocation** |
| 94 | + - The loader is executed with generated configurations and related flags |
| 95 | + 3. **Post-Execution Steps** |
| 96 | + - Experiment-specific post-scripts are executed |
| 97 | + - Cleanup tasks are performed |
| 98 | + |
| 99 | +4. **Completion** |
| 100 | + - Global post-scripts are executed. |
| 101 | + - Run Make Clean |
| 102 | + |
| 103 | +### How the Dry Run Works |
| 104 | + |
| 105 | +The dry run mode executes the loader with the `--dryRun` flag set to true after the unpacking of experiments defined in the multi-loader configurations. |
| 106 | + |
| 107 | +In this mode, the loader performs the following actions: |
| 108 | + |
| 109 | +- **Configuration Validation**: It verifies the experiment configurations without deploying any functions or generating invocations. |
| 110 | +- **Error Handling**: If a fatal error occurs at any point, the experiment will halt immediately. |
| 111 | + |
| 112 | +The purpose is to ensure that your configurations are correct and to identify any potential issues before actual execution. |
0 commit comments