From 7fdfe48439f33abec8aa63fc4ab36fd687d59a43 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 5 May 2021 11:58:57 +0200 Subject: 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. --- .../kotlin/org/opendc/harness/runner/cli/ConsoleRunner.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'opendc-harness/opendc-harness-cli') 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 -- cgit v1.2.3