summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-05-18 15:51:13 +0200
committerGitHub <noreply@github.com>2021-05-18 15:51:13 +0200
commit02776c958a3254735b2be7d9fb1627f75e7f80cd (patch)
tree155d96b0f1a5173e4ac884ac6c9cbccea011918f
parent1ce710ebaa8b071a3b30447d431f4af422f25156 (diff)
parent7cbb401a0939cc58daae8b481a97f4b05140ec3b (diff)
build: Add support for Java 16
This pull request adds support for building OpenDC using Java 16. To make this possible, we have upgraded the following dependencies: - Kotlin from 1.4.3 to 1.5.0 - Jacoco from 0.8.6 to 0.8.7 - Gradle from 7.0 to 7.0.2
-rw-r--r--.github/workflows/build.yml2
-rw-r--r--buildSrc/build.gradle.kts8
-rw-r--r--buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts7
-rw-r--r--buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts38
-rw-r--r--buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts1
-rw-r--r--gradle/libs.versions.toml14
-rw-r--r--gradle/wrapper/gradle-wrapper.properties2
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/FilterScheduler.kt2
-rw-r--r--opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/telemetry/parquet/ParquetEventWriter.kt1
-rw-r--r--opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/trace/Sc20RawParquetTraceReader.kt2
-rw-r--r--opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/trace/Sc20TraceConverter.kt2
-rw-r--r--opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/trace/WorkloadSampler.kt4
-rw-r--r--opendc-experiments/opendc-experiments-serverless20/build.gradle.kts3
-rw-r--r--opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/keras/Sequential.kt4
-rw-r--r--opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/network/NetworkController.kt2
-rw-r--r--opendc-format/build.gradle.kts5
-rw-r--r--opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt4
-rw-r--r--opendc-serverless/opendc-serverless-simulator/src/main/kotlin/org/opendc/serverless/simulator/SimFunctionDeployer.kt2
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt2
-rw-r--r--opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceAggregator.kt4
-rw-r--r--opendc-utils/src/main/kotlin/org/opendc/utils/TimerScheduler.kt7
-rw-r--r--opendc-web/opendc-web-runner/build.gradle.kts5
-rw-r--r--opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt2
-rw-r--r--opendc-workflow/opendc-workflow-service/build.gradle.kts5
24 files changed, 54 insertions, 74 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index cbf2f80d..8690cf5b 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
- java: [8, 15]
+ java: [8, 16]
steps:
- name: Checkout repository
uses: actions/checkout@v2
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index 3b793a61..56b85608 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -33,16 +33,10 @@ repositories {
}
dependencies {
- implementation(kotlin("gradle-plugin", version = "1.4.31"))
+ implementation(kotlin("gradle-plugin", version = "1.5.0"))
implementation("org.jlleitschuh.gradle:ktlint-gradle:10.0.0")
implementation("org.jetbrains.kotlin:kotlin-allopen:1.4.31")
implementation("org.jetbrains.kotlinx:kotlinx-benchmark-plugin:0.3.0")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.32")
implementation("gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0")
}
-
-tasks.withType<KotlinCompile>().configureEach {
- kotlinOptions {
- allWarningsAsErrors = true
- }
-}
diff --git a/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts b/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts
index 3e8aa741..1ea5de4c 100644
--- a/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts
+++ b/buildSrc/src/main/kotlin/jacoco-aggregation.gradle.kts
@@ -1,3 +1,5 @@
+import gradle.kotlin.dsl.accessors._a850a9ab866951e91ee43960bbc39582.jacoco
+
/*
* MIT License
*
@@ -32,6 +34,11 @@ repositories {
mavenCentral()
}
+jacoco {
+ // Necessary for Kotlin 1.5.0. See https://github.com/jacoco/jacoco/issues/1155
+ toolVersion = "0.8.7"
+}
+
tasks.register<JacocoReport>("codeCoverageReport") {
group = "Coverage reports"
description = "Generates an aggregate report based on all subprojects"
diff --git a/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts b/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts
index d0534d4f..5c7aea83 100644
--- a/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts
+++ b/buildSrc/src/main/kotlin/jacoco-conventions.gradle.kts
@@ -25,41 +25,13 @@ plugins {
jacoco
}
+jacoco {
+ // Necessary for Kotlin 1.5.0. See https://github.com/jacoco/jacoco/issues/1155
+ toolVersion = "0.8.7"
+}
+
tasks.jacocoTestReport {
reports {
html.isEnabled = true
}
}
-
-/* Share sources folder with other projects for aggregated JaCoCo reports */
-configurations.create("transitiveSourcesElements") {
- isVisible = false
- isCanBeResolved = false
- isCanBeConsumed = true
- extendsFrom(configurations.implementation.get())
- attributes {
- attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
- attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
- attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named("source-folders"))
- }
- sourceSets.main.get().java.srcDirs.forEach {
- outgoing.artifact(it)
- }
-}
-
-/* Share the coverage data to be aggregated for the whole product */
-configurations.create("coverageDataElements") {
- isVisible = false
- isCanBeResolved = false
- isCanBeConsumed = true
- extendsFrom(configurations.implementation.get())
- attributes {
- attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
- attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
- attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named("jacoco-coverage-data"))
- }
- // This will cause the test task to run if the coverage data is requested by the aggregation task
- outgoing.artifact(tasks.test.map { task ->
- task.extensions.getByType<JacocoTaskExtension>().destinationFile!!
- })
-}
diff --git a/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts b/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts
index 703e9938..7fda64a2 100644
--- a/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts
+++ b/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts
@@ -39,6 +39,5 @@ java {
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = Libs.jvmTarget.toString()
- kotlinOptions.useIR = true
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 12cbfb4e..1d7fdd3e 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,13 +1,13 @@
[versions]
-junit-jupiter = "5.7.1"
-junit-platform = "1.7.1"
+junit-jupiter = "5.7.2"
+junit-platform = "1.7.2"
slf4j = "1.7.30"
log4j = "2.14.1"
-opentelemetry-main = "1.1.0"
-opentelemetry-metrics = "1.1.0-alpha"
+opentelemetry-main = "1.2.0"
+opentelemetry-metrics = "1.2.0-alpha"
[libraries]
-kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.4.3" }
+kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.5.0" }
# Logging
kotlin-logging = { module = "io.github.microutils:kotlin-logging", version = "2.0.6" }
@@ -30,7 +30,7 @@ junit-platform-engine = { module = "org.junit.platform:junit-platform-engine", v
mockk = { module = "io.mockk:mockk", version = "1.11.0" }
# CLI
-clikt = { module = "com.github.ajalt.clikt:clikt", version = "3.1.0" }
+clikt = { module = "com.github.ajalt.clikt:clikt", version = "3.2.0" }
progressbar = { module = "me.tongfei:progressbar", version = "0.9.0" }
# Format
@@ -45,4 +45,4 @@ kotlinx-benchmark-runtime-jvm = { module = "org.jetbrains.kotlinx:kotlinx-benchm
# Other
mongodb = { module = "org.mongodb:mongodb-driver-sync", version = "4.2.3" }
classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.105" }
-hadoop-client = { module = "org.apache.hadoop:hadoop-client", version = "3.2.1" }
+hadoop-client = { module = "org.apache.hadoop:hadoop-client", version = "3.3.0" }
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index f371643e..0f80bbf5 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/FilterScheduler.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/FilterScheduler.kt
index 0fd5b2a4..1fe90454 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/FilterScheduler.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/FilterScheduler.kt
@@ -59,7 +59,7 @@ public class FilterScheduler(private val filters: List<HostFilter>, private val
true
}
.sortedByDescending { host ->
- weighers.sumByDouble { (weigher, factor) -> weigher.getWeight(host, server) * factor }
+ weighers.sumOf { (weigher, factor) -> weigher.getWeight(host, server) * factor }
}
.firstOrNull()
}
diff --git a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/telemetry/parquet/ParquetEventWriter.kt b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/telemetry/parquet/ParquetEventWriter.kt
index 38930ee5..4fa6ae66 100644
--- a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/telemetry/parquet/ParquetEventWriter.kt
+++ b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/telemetry/parquet/ParquetEventWriter.kt
@@ -52,6 +52,7 @@ public open class ParquetEventWriter<in T : Event>(
/**
* The writer to write the Parquet file.
*/
+ @Suppress("DEPRECATION")
private val writer = AvroParquetWriter.builder<GenericData.Record>(Path(path.absolutePath))
.withSchema(schema)
.withCompressionCodec(CompressionCodecName.SNAPPY)
diff --git a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/trace/Sc20RawParquetTraceReader.kt b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/trace/Sc20RawParquetTraceReader.kt
index ffbf46d4..bd27cf02 100644
--- a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/trace/Sc20RawParquetTraceReader.kt
+++ b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/trace/Sc20RawParquetTraceReader.kt
@@ -105,7 +105,7 @@ public class Sc20RawParquetTraceReader(private val path: File) {
val uid = UUID.nameUUIDFromBytes("$id-${counter++}".toByteArray())
val vmFragments = fragments.getValue(id).asSequence()
- val totalLoad = vmFragments.sumByDouble { it.usage } * 5 * 60 // avg MHz * duration = MFLOPs
+ val totalLoad = vmFragments.sumOf { it.usage } * 5 * 60 // avg MHz * duration = MFLOPs
val workload = SimTraceWorkload(vmFragments)
entries.add(
TraceEntry(
diff --git a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/trace/Sc20TraceConverter.kt b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/trace/Sc20TraceConverter.kt
index 7713c06f..1f9e289c 100644
--- a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/trace/Sc20TraceConverter.kt
+++ b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/trace/Sc20TraceConverter.kt
@@ -109,6 +109,7 @@ public class TraceConverterCli : CliktCommand(name = "trace-converter") {
traceParquet.delete()
}
+ @Suppress("DEPRECATION")
val metaWriter = AvroParquetWriter.builder<GenericData.Record>(Path(metaParquet.toURI()))
.withSchema(metaSchema)
.withCompressionCodec(CompressionCodecName.SNAPPY)
@@ -116,6 +117,7 @@ public class TraceConverterCli : CliktCommand(name = "trace-converter") {
.withRowGroupSize(16 * 1024 * 1024) // For write buffering (Page size)
.build()
+ @Suppress("DEPRECATION")
val writer = AvroParquetWriter.builder<GenericData.Record>(Path(traceParquet.toURI()))
.withSchema(schema)
.withCompressionCodec(CompressionCodecName.SNAPPY)
diff --git a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/trace/WorkloadSampler.kt b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/trace/WorkloadSampler.kt
index 5c8727ea..6de3f265 100644
--- a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/trace/WorkloadSampler.kt
+++ b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/trace/WorkloadSampler.kt
@@ -69,7 +69,7 @@ public fun sampleRegularWorkload(
val totalLoad = if (workload is CompositeWorkload) {
workload.totalLoad
} else {
- shuffled.sumByDouble { it.meta.getValue("total-load") as Double }
+ shuffled.sumOf { it.meta.getValue("total-load") as Double }
}
var currentLoad = 0.0
@@ -129,7 +129,7 @@ public fun sampleHpcWorkload(
val totalLoad = if (workload is CompositeWorkload) {
workload.totalLoad
} else {
- trace.sumByDouble { it.meta.getValue("total-load") as Double }
+ trace.sumOf { it.meta.getValue("total-load") as Double }
}
logger.debug { "Total trace load: $totalLoad" }
diff --git a/opendc-experiments/opendc-experiments-serverless20/build.gradle.kts b/opendc-experiments/opendc-experiments-serverless20/build.gradle.kts
index bdb0d098..88479765 100644
--- a/opendc-experiments/opendc-experiments-serverless20/build.gradle.kts
+++ b/opendc-experiments/opendc-experiments-serverless20/build.gradle.kts
@@ -38,7 +38,8 @@ dependencies {
implementation(libs.kotlin.logging)
implementation(libs.config)
- implementation(libs.parquet) {
+ implementation(libs.parquet)
+ implementation(libs.hadoop.client) {
exclude(group = "org.slf4j", module = "slf4j-log4j12")
exclude(group = "log4j")
}
diff --git a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/keras/Sequential.kt b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/keras/Sequential.kt
index 411ddb59..83995fa1 100644
--- a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/keras/Sequential.kt
+++ b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/keras/Sequential.kt
@@ -49,10 +49,10 @@ public class Sequential(vararg layers: Layer) : TrainableModel(*layers) {
}
override fun forward(): Double {
- return layers.sumByDouble { it.forward() }
+ return layers.sumOf { it.forward() }
}
override fun backward(): Double {
- return layers.sumByDouble { it.backward() }
+ return layers.sumOf { it.backward() }
}
}
diff --git a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/network/NetworkController.kt b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/network/NetworkController.kt
index 75b11423..9771cc20 100644
--- a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/network/NetworkController.kt
+++ b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/network/NetworkController.kt
@@ -82,7 +82,7 @@ public class NetworkController(context: CoroutineContext, clock: Clock) : AutoCl
val target = channels[to] ?: return // Drop if destination not found
- scheduler.startSingleTimer(message, delayTime) { target.offer(message) }
+ scheduler.startSingleTimer(message, delayTime) { target.trySend(message) }
}
/**
diff --git a/opendc-format/build.gradle.kts b/opendc-format/build.gradle.kts
index 2647c834..e95cb666 100644
--- a/opendc-format/build.gradle.kts
+++ b/opendc-format/build.gradle.kts
@@ -35,7 +35,10 @@ dependencies {
api(projects.opendcWorkflow.opendcWorkflowApi)
implementation(projects.opendcSimulator.opendcSimulatorCompute)
implementation(projects.opendcCompute.opendcComputeSimulator)
- api(libs.jackson.module.kotlin)
+ api(libs.jackson.module.kotlin) {
+ exclude(group = "org.jetbrains.kotlin", module = "kotlin-reflect")
+ }
+ implementation(kotlin("reflect"))
implementation(libs.parquet)
implementation(libs.hadoop.client) {
diff --git a/opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt b/opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt
index 0d1f3cea..50ab652e 100644
--- a/opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt
+++ b/opendc-format/src/main/kotlin/org/opendc/format/trace/swf/SwfTraceReader.kt
@@ -69,8 +69,6 @@ public class SwfTraceReader(
var cores: Int
var memory: Long
var slicedWaitTime: Long
- var flopsPerSecond: Long
- var flopsPartialSlice: Long
var runtimePartialSliceRemainder: Long
BufferedReader(FileReader(file)).use { reader ->
@@ -121,9 +119,7 @@ public class SwfTraceReader(
// Insert run time slices
- flopsPerSecond = 4_000L * cores
runtimePartialSliceRemainder = runTime % sliceDuration
- flopsPartialSlice = flopsPerSecond * runtimePartialSliceRemainder
for (
tick in (submitTime + slicedWaitTime)
diff --git a/opendc-serverless/opendc-serverless-simulator/src/main/kotlin/org/opendc/serverless/simulator/SimFunctionDeployer.kt b/opendc-serverless/opendc-serverless-simulator/src/main/kotlin/org/opendc/serverless/simulator/SimFunctionDeployer.kt
index 0605eaac..b5516b4d 100644
--- a/opendc-serverless/opendc-serverless-simulator/src/main/kotlin/org/opendc/serverless/simulator/SimFunctionDeployer.kt
+++ b/opendc-serverless/opendc-serverless-simulator/src/main/kotlin/org/opendc/serverless/simulator/SimFunctionDeployer.kt
@@ -102,7 +102,7 @@ public class SimFunctionDeployer(
check(state != FunctionInstanceState.Deleted) { "Function instance has been released" }
return suspendCancellableCoroutine { cont ->
queue.add(InvocationRequest(cont))
- chan.offer(Unit)
+ chan.trySend(Unit)
}
}
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt
index f6324e13..e501033a 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt
@@ -80,7 +80,7 @@ public abstract class SimAbstractMachine(private val clock: Clock) : SimMachine
override suspend fun run(workload: SimWorkload, meta: Map<String, Any>): Unit = withContext(context) {
require(!isTerminated) { "Machine is terminated" }
val ctx = Context(meta)
- val totalCapacity = model.cpus.sumByDouble { it.frequency }
+ val totalCapacity = model.cpus.sumOf { it.frequency }
_speed = DoubleArray(model.cpus.size) { 0.0 }
var totalSpeed = 0.0
diff --git a/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceAggregator.kt b/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceAggregator.kt
index 6ae04f27..653b53e0 100644
--- a/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceAggregator.kt
+++ b/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimAbstractResourceAggregator.kt
@@ -82,7 +82,7 @@ public abstract class SimAbstractResourceAggregator(private val scheduler: SimRe
return if (_remainingWorkFlush < now) {
_remainingWorkFlush = now
- _inputConsumers.sumByDouble { it._ctx?.remainingWork ?: 0.0 }.also { _remainingWork = it }
+ _inputConsumers.sumOf { it._ctx?.remainingWork ?: 0.0 }.also { _remainingWork = it }
} else {
_remainingWork
}
@@ -132,7 +132,7 @@ public abstract class SimAbstractResourceAggregator(private val scheduler: SimRe
private fun updateCapacity() {
// Adjust capacity of output resource
- context.capacity = _inputConsumers.sumByDouble { it._ctx?.capacity ?: 0.0 }
+ context.capacity = _inputConsumers.sumOf { it._ctx?.capacity ?: 0.0 }
}
/* Input */
diff --git a/opendc-utils/src/main/kotlin/org/opendc/utils/TimerScheduler.kt b/opendc-utils/src/main/kotlin/org/opendc/utils/TimerScheduler.kt
index aa2f3367..d7da7f99 100644
--- a/opendc-utils/src/main/kotlin/org/opendc/utils/TimerScheduler.kt
+++ b/opendc-utils/src/main/kotlin/org/opendc/utils/TimerScheduler.kt
@@ -24,7 +24,6 @@ package org.opendc.utils
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
-import kotlinx.coroutines.channels.sendBlocking
import kotlinx.coroutines.selects.select
import java.time.Clock
import java.util.*
@@ -145,9 +144,9 @@ public class TimerScheduler<T>(context: CoroutineContext, private val clock: Clo
queue.poll()
if (queue.isNotEmpty()) {
- channel.sendBlocking(peek.timestamp)
+ channel.trySend(peek.timestamp)
} else {
- channel.sendBlocking(null)
+ channel.trySend(null)
}
}
}
@@ -212,7 +211,7 @@ public class TimerScheduler<T>(context: CoroutineContext, private val clock: Clo
// Check if we need to push the interruption forward
// Note that we check by timer reference
if (queue.peek() === timer) {
- channel.offer(timer.timestamp)
+ channel.trySend(timer.timestamp)
}
timer
diff --git a/opendc-web/opendc-web-runner/build.gradle.kts b/opendc-web/opendc-web-runner/build.gradle.kts
index b7eb223c..f2b2ba23 100644
--- a/opendc-web/opendc-web-runner/build.gradle.kts
+++ b/opendc-web/opendc-web-runner/build.gradle.kts
@@ -42,7 +42,10 @@ dependencies {
implementation(libs.kotlin.logging)
implementation(libs.clikt)
- implementation(libs.jackson.module.kotlin)
+ implementation(libs.jackson.module.kotlin) {
+ exclude(group = "org.jetbrains.kotlin", module = "kotlin-reflect")
+ }
+ implementation(kotlin("reflect"))
implementation(libs.sentry.log4j2)
implementation(libs.mongodb)
diff --git a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt
index 2dd63340..e96a681d 100644
--- a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt
+++ b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/runner/web/TopologyParser.kt
@@ -73,7 +73,7 @@ public class TopologyParser(private val collection: MongoCollection<Document>) {
)
}
- val energyConsumptionW = machine.getList("cpus", Document::class.java).sumBy { it.getInteger("energyConsumptionW") }.toDouble()
+ val energyConsumptionW = machine.getList("cpus", Document::class.java).sumOf { it.getInteger("energyConsumptionW") }.toDouble()
nodes.add(
MachineDef(
diff --git a/opendc-workflow/opendc-workflow-service/build.gradle.kts b/opendc-workflow/opendc-workflow-service/build.gradle.kts
index 5e73222c..bc082dbc 100644
--- a/opendc-workflow/opendc-workflow-service/build.gradle.kts
+++ b/opendc-workflow/opendc-workflow-service/build.gradle.kts
@@ -41,6 +41,9 @@ dependencies {
testImplementation(projects.opendcCompute.opendcComputeSimulator)
testImplementation(projects.opendcFormat)
testImplementation(projects.opendcTelemetry.opendcTelemetrySdk)
- testImplementation(libs.jackson.module.kotlin)
+ testImplementation(libs.jackson.module.kotlin) {
+ exclude(group = "org.jetbrains.kotlin", module = "kotlin-reflect")
+ }
+ testImplementation(kotlin("reflect"))
testRuntimeOnly(libs.log4j.slf4j)
}