Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Quarkus Quinoa for serving web UI #165

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ dependencies {
implementation(libs.jmh.gradle)
implementation(libs.dokka.gradle)

implementation(libs.jandex.gradle)
implementation(libs.quarkus.gradle.application)
implementation(libs.quarkus.gradle.extension)

implementation(libs.gradle.node)
}
5 changes: 0 additions & 5 deletions buildSrc/src/main/kotlin/quarkus-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
import org.gradle.api.artifacts.type.ArtifactTypeDefinition
import org.gradle.api.attributes.Category
import org.gradle.api.attributes.VerificationType
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.kotlin
import org.gradle.kotlin.dsl.withType

plugins {
id("java-conventions")
Expand All @@ -48,15 +45,13 @@ configurations.create("coverageDataElementsForQuarkus") {

extendsFrom(configurations["implementation"], configurations["runtimeOnly"])

@Suppress("UnstableApiUsage")
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category::class.java, Category.VERIFICATION))
attribute(VerificationType.VERIFICATION_TYPE_ATTRIBUTE, objects.named(VerificationType::class.java, VerificationType.JACOCO_RESULTS))
}

artifacts {
add("coverageDataElementsForQuarkus", layout.buildDirectory.file("jacoco-quarkus.exec")) {
@Suppress("UnstableApiUsage")
type = ArtifactTypeDefinition.BINARY_DATA_TYPE
builtBy(tasks.test)
}
Expand Down
1 change: 0 additions & 1 deletion buildSrc/src/main/kotlin/spotless-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ spotless {
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
kotlin {
ktlint()
.setUseExperimental(false)
trimTrailingWhitespace()
endWithNewline()

Expand Down
54 changes: 28 additions & 26 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
[versions]
calcite = "1.34.0"
clikt = "3.5.2"
calcite = "1.35.0"
clikt = "4.2.1"
commons-math3 = "3.6.1"
dokka = "1.8.10"
gradle-node = "3.5.1"
hadoop = "3.3.5"
hypersistence-utils = "3.2.0"
jackson = "2.14.2"
jandex-gradle = "1.1.0"
dokka = "1.9.10"
hadoop = "3.3.6"
hypersistence-utils = "3.6.0"
jackson = "2.15.3"
java = "17"
jline = "3.23.0"
jmh-gradle = "0.7.0"
jakarta-validation = "2.0.2"
junit-jupiter = "5.9.1"
kotlin = "1.8.10"
jmh-gradle = "0.7.1"
jakarta-validation = "3.0.2"
jakarta-ws-rs = "3.1.0"
junit-jupiter = "5.10.0"
kotlin = "1.9.10"
kotlin-logging = "3.0.5"
kotlinx-coroutines = "1.6.4"
log4j = "2.20.0"
microprofile-openapi = "3.0"
microprofile-config = "3.0.1"
mockk = "1.13.4"
node = "18.15.0"
parquet = "1.12.3"
progressbar = "0.9.5"
quarkus = "2.16.5.Final"
sentry = "6.16.0"
slf4j = "2.0.7"
kotlinx-coroutines = "1.7.3"
log4j = "2.21.0"
microprofile-rest-client = "3.0.1"
microprofile-openapi = "3.1.1"
microprofile-config = "3.1"
mockk = "1.13.8"
parquet = "1.13.1"
progressbar = "0.10.0"
quarkus = "3.2.7.Final"
quarkus-quinoa = "2.2.1"
sentry = "6.32.0"
slf4j = "2.0.9"
spotless = "6.12.0"

[libraries]
Expand Down Expand Up @@ -84,7 +84,9 @@ quarkus-hibernate-validator = { module = "io.quarkus:quarkus-hibernate-validator
quarkus-jdbc-h2 = { module = "io.quarkus:quarkus-jdbc-h2" }
quarkus-jdbc-postgresql = { module = "io.quarkus:quarkus-jdbc-postgresql" }
quarkus-flyway = { module = "io.quarkus:quarkus-flyway" }
hypersistence-utils-hibernate = { module = "io.hypersistence:hypersistence-utils-hibernate-55", version.ref = "hypersistence-utils" }
hypersistence-utils-hibernate = { module = "io.hypersistence:hypersistence-utils-hibernate-62", version.ref = "hypersistence-utils" }
quarkus-quinoa-runtime = { module = "io.quarkiverse.quinoa:quarkus-quinoa", version.ref = "quarkus-quinoa" }
quarkus-quinoa-deployment = { module = "io.quarkiverse.quinoa:quarkus-quinoa-deployment", version.ref = "quarkus-quinoa" }

# Quarkus (Testing)
quarkus-junit5-core = { module = "io.quarkus:quarkus-junit5" }
Expand All @@ -99,15 +101,15 @@ jline = { module = "org.jline:jline", version.ref = "jline" }

# Other
jakarta-validation = { module = "jakarta.validation:jakarta.validation-api", version.ref = "jakarta-validation" }
jakarta-ws-rs-api = { module = "jakarta.ws.rs:jakarta.ws.rs-api", version.ref = "jakarta-ws-rs" }
hadoop-common = { module = "org.apache.hadoop:hadoop-common", version.ref = "hadoop" }
hadoop-mapreduce-client-core = { module = "org.apache.hadoop:hadoop-mapreduce-client-core", version.ref = "hadoop" }
commons-math3 = { module = "org.apache.commons:commons-math3", version.ref = "commons-math3" }
microprofile-rest-client-api = { module = "org.eclipse.microprofile.rest.client:microprofile-rest-client-api", version.ref = "microprofile-rest-client" }
microprofile-openapi-api = { module = "org.eclipse.microprofile.openapi:microprofile-openapi-api", version.ref = "microprofile-openapi" }
microprofile-config = { module = "org.eclipse.microprofile.config:microprofile-config-api", version.ref = "microprofile-config" }

# Other (Build)
dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
gradle-node = { module = "com.github.node-gradle:gradle-node-plugin", version.ref = "gradle-node" }
jandex-gradle = { module = "org.kordamp.gradle:jandex-gradle-plugin", version.ref = "jandex-gradle" }
jmh-gradle = { module = "me.champeau.jmh:jmh-gradle-plugin", version.ref = "jmh-gradle" }
spotless-gradle = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "spotless" }
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ val createCapelinApp by tasks.creating(CreateStartScripts::class) {
applicationName = "capelin"
mainClass.set("org.opendc.experiments.capelin.CapelinCli")
classpath = tasks.jar.get().outputs.files + configurations["runtimeClasspath"]
outputDir = project.buildDir.resolve("scripts")
outputDir = project.layout.buildDirectory.dir("scripts").get().asFile
}

/* Create custom Capelin distribution */
Expand Down
9 changes: 3 additions & 6 deletions opendc-web/opendc-web-proto/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@ description = "Web communication protocol for OpenDC"

/* Build configuration */
plugins {
`kotlin-library-conventions`
id("org.kordamp.gradle.jandex") // Necessary for Quarkus to process annotations
`java-library-conventions`
}

dependencies {
implementation(libs.jackson.annotations)
implementation(libs.jakarta.validation)
implementation(libs.jakarta.ws.rs.api)
implementation(libs.microprofile.rest.client.api)
implementation(libs.microprofile.openapi.api)
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.javaParameters = true
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 AtLarge Research
* Copyright (c) 2023 AtLarge Research
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -20,12 +20,12 @@
* SOFTWARE.
*/

package org.opendc.web.proto
package org.opendc.web.proto;

/**
* State of a scenario for the simulator runner.
*/
public enum class JobState {
public enum JobState {
/**
* The job is pending to be claimed by a runner.
*/
Expand All @@ -49,5 +49,5 @@ public enum class JobState {
/**
* The job has failed.
*/
FAILED;
FAILED
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 AtLarge Research
* Copyright (c) 2023 AtLarge Research
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -20,12 +20,9 @@
* SOFTWARE.
*/

package org.opendc.web.proto
package org.opendc.web.proto;

/**
* Object describing the enabled operational phenomena for a scenario.
*/
public data class OperationalPhenomena(
val failures: Boolean,
val interference: Boolean
)
public record OperationalPhenomena(boolean failures, boolean interference) {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 AtLarge Research
* Copyright (c) 2023 AtLarge Research
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -20,9 +20,9 @@
* SOFTWARE.
*/

package org.opendc.web.proto
package org.opendc.web.proto;

/**
* Container for reporting errors.
*/
public data class ProtocolError(val code: Int, val message: String)
public record ProtocolError(int code, String message) {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 AtLarge Research
* Copyright (c) 2023 AtLarge Research
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -20,18 +20,15 @@
* SOFTWARE.
*/

package org.opendc.web.proto
package org.opendc.web.proto;

import javax.validation.constraints.Min
import jakarta.validation.constraints.Min;
import java.util.Set;

/**
* The targets of a portfolio.
*
* @param metrics The selected metrics to track during simulation.
* @param repeats The number of repetitions per scenario.
*/
public data class Targets(
val metrics: Set<String>,
@field:Min(1)
val repeats: Int = 1
)
public record Targets(Set<String> metrics, @Min(1) int repeats) {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 AtLarge Research
* Copyright (c) 2023 AtLarge Research
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -20,7 +20,7 @@
* SOFTWARE.
*/

package org.opendc.web.proto
package org.opendc.web.proto;

/**
* A workload trace available for simulation.
Expand All @@ -29,8 +29,4 @@
* @param name The name of the trace.
* @param type The type of trace.
*/
public data class Trace(
val id: String,
val name: String,
val type: String
)
public record Trace(String id, String name, String type) {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 AtLarge Research
* Copyright (c) 2023 AtLarge Research
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -20,25 +20,24 @@
* SOFTWARE.
*/

package org.opendc.web.proto
package org.opendc.web.proto;

import javax.validation.constraints.DecimalMax
import javax.validation.constraints.DecimalMin
import jakarta.validation.constraints.DecimalMax;
import jakarta.validation.constraints.DecimalMin;

/**
* The workload to simulate for a scenario.
*/
public data class Workload(val trace: Trace, val samplingFraction: Double) {
public record Workload(Trace trace, double samplingFraction) {
/**
* Specification for a workload.
*
* @param trace The unique identifier of the trace.
* @param samplingFraction The fraction of the workload to sample.
*/
public data class Spec(
val trace: String,
@DecimalMin(value = "0.001", message = "Sampling fraction must be non-zero")
@DecimalMax(value = "1", message = "Sampling fraction cannot exceed one")
val samplingFraction: Double
)
public record Spec(
String trace,
@DecimalMin(value = "0.001", message = "Sampling fraction must be non-zero")
@DecimalMax(value = "1", message = "Sampling fraction cannot exceed one")
double samplingFraction) {}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 AtLarge Research
* Copyright (c) 2023 AtLarge Research
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -20,32 +20,32 @@
* SOFTWARE.
*/

package org.opendc.web.proto.runner
package org.opendc.web.proto.runner;

import org.eclipse.microprofile.openapi.annotations.media.Schema
import org.opendc.web.proto.JobState
import java.time.Instant
import java.time.Instant;
import java.util.Map;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.opendc.web.proto.JobState;

/**
* A simulation job to be simulated by a runner.
*/
@Schema(name = "Runner.Job")
public data class Job(
val id: Long,
val scenario: Scenario,
val state: JobState,
val createdAt: Instant,
val updatedAt: Instant,
val runtime: Int,
val results: Map<String, Any>? = null
) {
public record Job(
long id,
Scenario scenario,
JobState state,
Instant createdAt,
Instant updatedAt,
int runtime,
Map<String, ?> results) {
/**
* A request to update the state of a job.
*
* @property state The next state of the job.
* @property runtime The runtime of the job (in seconds).
* @property results The results of the job.
* @param state The next state of the job.
* @param runtime The runtime of the job (in seconds).
* @param results The results of the job.
*/
@Schema(name = "Runner.Job.Update")
public data class Update(val state: JobState, val runtime: Int, val results: Map<String, Any>? = null)
public record Update(JobState state, int runtime, Map<String, ?> results) {}
}
Loading
Loading