diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-05-05 11:58:57 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-05-05 12:12:32 +0200 |
| commit | 7fdfe48439f33abec8aa63fc4ab36fd687d59a43 (patch) | |
| tree | 99742afbc3cd762ec527f5a6c7e31ee245ee0385 /opendc-harness/opendc-harness-cli | |
| parent | 54edc2d5e92d8c117e116a8c507442e49d17e24e (diff) | |
harness: Add ability to specify custom configuration from CLI
This change updates the command line interface of the OpenDC Experiment
Harness to include an option for specifying a custom configuration file.
Diffstat (limited to 'opendc-harness/opendc-harness-cli')
| -rw-r--r-- | opendc-harness/opendc-harness-cli/src/main/kotlin/org/opendc/harness/runner/cli/ConsoleRunner.kt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/opendc-harness/opendc-harness-cli/src/main/kotlin/org/opendc/harness/runner/cli/ConsoleRunner.kt b/opendc-harness/opendc-harness-cli/src/main/kotlin/org/opendc/harness/runner/cli/ConsoleRunner.kt index 82adb2fd..06800f0e 100644 --- a/opendc-harness/opendc-harness-cli/src/main/kotlin/org/opendc/harness/runner/cli/ConsoleRunner.kt +++ b/opendc-harness/opendc-harness-cli/src/main/kotlin/org/opendc/harness/runner/cli/ConsoleRunner.kt @@ -79,9 +79,20 @@ public class ConsoleRunner : CliktCommand(name = "opendc-harness") { .multiple() .unique() + /** + * Configuration file to load. + */ + private val config by option("-c", "--config", help = "Configuration file for the experiments") + .file(mustExist = true, canBeDir = false, mustBeReadable = true) + override fun run() { logger.info { "Starting OpenDC Console Experiment Runner" } + val config = config + if (config != null) { + System.setProperty("config.file", config.path) + } + val classLoader = createClassLoader() // TODO: Add way to specify class loader for scheduler Thread.currentThread().contextClassLoader = classLoader |
