summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-runner
diff options
context:
space:
mode:
authorvincent van beek <vincent@vlogic.nl>2026-03-27 16:49:40 +0100
committerGitHub <noreply@github.com>2026-03-27 15:49:40 +0000
commit048bf777997bdbf599240645fc66612c98abf3c2 (patch)
treec04e999cb981c98ae9dc0fd83ea70aec9eaa419c /opendc-web/opendc-web-runner
parent235057cd170f1583db14bf93ea7d2de39e492356 (diff)
Add import topology (#393)
* add a the posibility to import and export topogies in JSON format * fix web-runner integration, there were several bugs and mismatches between new implementations in OpenDC and the UI
Diffstat (limited to 'opendc-web/opendc-web-runner')
-rw-r--r--opendc-web/opendc-web-runner/build.gradle.kts9
-rw-r--r--opendc-web/opendc-web-runner/src/cli/kotlin/org/opendc/web/runner/Main.kt43
-rw-r--r--opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt2
3 files changed, 43 insertions, 11 deletions
diff --git a/opendc-web/opendc-web-runner/build.gradle.kts b/opendc-web/opendc-web-runner/build.gradle.kts
index 97328324..a02030d9 100644
--- a/opendc-web/opendc-web-runner/build.gradle.kts
+++ b/opendc-web/opendc-web-runner/build.gradle.kts
@@ -24,7 +24,7 @@ description = "Experiment runner for OpenDC"
// Build configuration
plugins {
- `kotlin-library-conventions`
+ `kotlin-conventions`
distribution
}
@@ -67,11 +67,11 @@ dependencies {
}
val createCli by tasks.creating(CreateStartScripts::class) {
- dependsOn(cliJar)
+ dependsOn(cliJar, tasks.jar)
applicationName = "opendc-runner"
- mainClass.set("org.opendc.web.runner.cli.MainKt")
- classpath = cliJar.outputs.files + cliRuntimeClasspath
+ mainClass.set("org.opendc.web.runner.MainKt")
+ classpath = tasks.jar.get().outputs.files + cliJar.outputs.files + cliRuntimeClasspath
outputDir = project.layout.buildDirectory.get().asFile.resolve("scripts")
}
@@ -83,6 +83,7 @@ distributions {
}
into("lib") {
+ from(tasks.jar)
from(cliJar)
from(cliRuntimeClasspath) // Also includes main classpath
}
diff --git a/opendc-web/opendc-web-runner/src/cli/kotlin/org/opendc/web/runner/Main.kt b/opendc-web/opendc-web-runner/src/cli/kotlin/org/opendc/web/runner/Main.kt
index 5d35fd98..6583810c 100644
--- a/opendc-web/opendc-web-runner/src/cli/kotlin/org/opendc/web/runner/Main.kt
+++ b/opendc-web/opendc-web-runner/src/cli/kotlin/org/opendc/web/runner/Main.kt
@@ -26,8 +26,8 @@ import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.convert
import com.github.ajalt.clikt.parameters.options.default
import com.github.ajalt.clikt.parameters.options.defaultLazy
+import com.github.ajalt.clikt.parameters.options.flag
import com.github.ajalt.clikt.parameters.options.option
-import com.github.ajalt.clikt.parameters.options.required
import com.github.ajalt.clikt.parameters.types.file
import com.github.ajalt.clikt.parameters.types.int
import mu.KotlinLogging
@@ -54,6 +54,15 @@ class RunnerCli : CliktCommand(name = "opendc-runner") {
.default(URI("https://api.opendc.org/v2"))
/**
+ * Flag to disable authentication (for local development).
+ */
+ private val noAuth by option(
+ "--no-auth",
+ help = "disable authentication (for local development)",
+ )
+ .flag()
+
+ /**
* The auth domain to use.
*/
private val authDomain by option(
@@ -61,17 +70,15 @@ class RunnerCli : CliktCommand(name = "opendc-runner") {
help = "auth domain of the OpenDC API",
envvar = "AUTH0_DOMAIN",
)
- .required()
/**
- * The auth domain to use.
+ * The auth audience to use.
*/
private val authAudience by option(
"--auth-audience",
help = "auth audience of the OpenDC API",
envvar = "AUTH0_AUDIENCE",
)
- .required()
/**
* The auth client ID to use.
@@ -81,7 +88,6 @@ class RunnerCli : CliktCommand(name = "opendc-runner") {
help = "auth client id of the OpenDC API",
envvar = "AUTH0_CLIENT_ID",
)
- .required()
/**
* The auth client secret to use.
@@ -91,7 +97,6 @@ class RunnerCli : CliktCommand(name = "opendc-runner") {
help = "auth client secret of the OpenDC API",
envvar = "AUTH0_CLIENT_SECRET",
)
- .required()
/**
* The path to the traces directory.
@@ -117,7 +122,31 @@ class RunnerCli : CliktCommand(name = "opendc-runner") {
override fun run() {
logger.info { "Starting OpenDC web runner" }
- val client = OpenDCRunnerClient(baseUrl = apiUrl, OpenIdAuthController(authDomain, authClientId, authClientSecret, authAudience))
+ // Validate auth parameters if authentication is enabled
+ if (!noAuth) {
+ require(
+ authDomain != null,
+ ) { "Auth domain is required when authentication is enabled. Use --no-auth to disable authentication." }
+ require(
+ authAudience != null,
+ ) { "Auth audience is required when authentication is enabled. Use --no-auth to disable authentication." }
+ require(
+ authClientId != null,
+ ) { "Auth client ID is required when authentication is enabled. Use --no-auth to disable authentication." }
+ require(authClientSecret != null) {
+ "Auth client secret is required when authentication is enabled. Use --no-auth to disable authentication."
+ }
+ }
+
+ val authController =
+ if (noAuth) {
+ logger.info { "Running without authentication" }
+ null
+ } else {
+ OpenIdAuthController(authDomain!!, authClientId!!, authClientSecret!!, authAudience!!)
+ }
+
+ val client = OpenDCRunnerClient(baseUrl = apiUrl, authController)
val manager = JobManager(client)
val runner = OpenDCRunner(manager, tracePath, parallelism = parallelism)
diff --git a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt
index 83583eab..d41400e3 100644
--- a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt
+++ b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/OpenDCRunner.kt
@@ -276,6 +276,8 @@ public class OpenDCRunner(
val vms = workloadLoader.sampleByLoad(scenario.workload.samplingFraction)
val startTime = vms.minOf { it.submittedAt }
+ logger.debug { "Using scheduler: '${scenario.schedulerName}' for scenario ${scenario.id}" }
+
provisioner.runSteps(
setupComputeService(
serviceDomain,