From 14c6a67b384ea11fd5b06a0189bac56cfae9f106 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 6 Oct 2022 11:02:37 +0200 Subject: build: Update simulator dependencies This change updates the simulator dependencies to the latest available version where possible. --- .../src/main/kotlin/kotlin-conventions.gradle.kts | 6 +++++ gradle/libs.versions.toml | 30 +++++++++++----------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts b/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts index 6b9109f7..8fb46f5d 100644 --- a/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts @@ -34,3 +34,9 @@ tasks.withType().configureEach { kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn" kotlinOptions.freeCompilerArgs += "-Xjvm-default=all" } + +configure { + // Higher versions currently have issues with formatting where wildcard imports are automatically removed, + // even when in use. + version.set("0.42.1") +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f78ab816..c53c16c6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,30 +1,30 @@ [versions] -calcite = "1.31.0" +calcite = "1.32.0" clikt = "3.5.0" commons-math3 = "3.6.1" -dokka = "1.6.21" +dokka = "1.7.10" gradle-node = "3.4.0" -hadoop = "3.3.3" -jackson = "2.13.3" +hadoop = "3.3.4" +jackson = "2.13.4" jandex-gradle = "0.13.2" jline = "3.21.0" -jmh-gradle = "0.6.6" +jmh-gradle = "0.6.8" jakarta-validation = "2.0.2" -junit-jupiter = "5.8.2" -kotlin = "1.6.21" -kotlin-logging = "2.1.23" +junit-jupiter = "5.9.1" +kotlin = "1.7.20" +kotlin-logging = "3.0.0" kotlinx-coroutines = "1.6.4" -ktlint-gradle = "10.3.0" -log4j = "2.18.0" +ktlint-gradle = "11.0.0" +log4j = "2.19.0" microprofile-openapi = "3.0" microprofile-config = "3.0.1" -mockk = "1.12.5" +mockk = "1.13.2" parquet = "1.12.3" progressbar = "0.9.3" -quarkus = "2.11.1.Final" +quarkus = "2.13.1.Final" quarkus-junit5-mockk = "1.1.1" -sentry = "6.3.0" -slf4j = "1.7.36" +sentry = "6.4.3" +slf4j = "2.0.3" [libraries] # Kotlin @@ -36,7 +36,7 @@ kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", # Logging kotlin-logging = { module = "io.github.microutils:kotlin-logging", version.ref = "kotlin-logging" } slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" } -log4j-slf4j = { module = "org.apache.logging.log4j:log4j-slf4j-impl", version.ref = "log4j" } +log4j-slf4j = { module = "org.apache.logging.log4j:log4j-slf4j2-impl", version.ref = "log4j" } sentry-log4j2 = { module = "io.sentry:sentry-log4j2", version.ref = "sentry" } # Testing -- cgit v1.2.3 From d447295f535c3587c82d809397cb1a5f23ab1b4b Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 6 Oct 2022 11:08:03 +0200 Subject: build: Remove unused distribution conventions This change removes the distribution conventions used by the root project of OpenDC. Previously, we used this to build a single distribution for OpenDC containing the experiment uberjars and scripts to start OpenDC. However, with the introduction of the Quarkus-based web server, we have decided to split releases into (potentially) multiple distributions (e.g., one for the web server, one for just the web runner, etc.). Furthermore, the implementation of this convention caused issues with several other Gradle plugins. --- .github/workflows/release.yml | 2 +- build.gradle.kts | 1 - .../kotlin/distribution-conventions.gradle.kts | 51 ---------------------- 3 files changed, 1 insertion(+), 53 deletions(-) delete mode 100644 buildSrc/src/main/kotlin/distribution-conventions.gradle.kts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d0b985c0..2d893edf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,6 +36,6 @@ jobs: with: draft: true prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-m') }} - files: build/distributions/* + files: "**/build/distributions/*" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.gradle.kts b/build.gradle.kts index 87a338b9..bda23ae8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,7 +23,6 @@ plugins { `dokka-conventions` `jacoco-aggregation` - `distribution-conventions` } allprojects { diff --git a/buildSrc/src/main/kotlin/distribution-conventions.gradle.kts b/buildSrc/src/main/kotlin/distribution-conventions.gradle.kts deleted file mode 100644 index ebbe46ee..00000000 --- a/buildSrc/src/main/kotlin/distribution-conventions.gradle.kts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2021 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 - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import org.gradle.api.distribution.DistributionContainer - - -plugins { - distribution -} - -tasks.named("assembleDist") { - val tasks = getTasksByName("assembleDist", true).filter { it.project != project } - dependsOn(tasks) -} - -distributions { - main { - contents { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - - from("README.md") - from("LICENSE.txt") - from("docs") { into("docs") } - - // Include distributions of the subprojects - getTasksByName("assembleDist", true) - .filter { it.project != project } - .map { it.project.the() } - .forEach { dist -> dist.findByName("main")?.let { with(it.contents) } } - } - } -} -- cgit v1.2.3 From 00a28ee84606754d186c39e9aa39d2ad2c277c91 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 6 Oct 2022 11:11:32 +0200 Subject: build: Update next version to 3.0 This change updates the build script in preparation for the OpenDC v3.0 release changing the version numbers to the appropriate values. --- build.gradle.kts | 2 +- opendc-web/opendc-web-ui/package-lock.json | 4 ++-- opendc-web/opendc-web-ui/package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index bda23ae8..73f002b1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -26,5 +26,5 @@ plugins { } allprojects { - version = "2.1-rc1" + version = "3.0-rc1" } diff --git a/opendc-web/opendc-web-ui/package-lock.json b/opendc-web/opendc-web-ui/package-lock.json index a38802de..4790dcb9 100644 --- a/opendc-web/opendc-web-ui/package-lock.json +++ b/opendc-web/opendc-web-ui/package-lock.json @@ -1,12 +1,12 @@ { "name": "opendc-frontend", - "version": "2.1.0", + "version": "3.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "opendc-frontend", - "version": "2.1.0", + "version": "3.0.0", "license": "MIT", "dependencies": { "@auth0/auth0-react": "^1.11.0", diff --git a/opendc-web/opendc-web-ui/package.json b/opendc-web/opendc-web-ui/package.json index a4cac1be..f2175e35 100644 --- a/opendc-web/opendc-web-ui/package.json +++ b/opendc-web/opendc-web-ui/package.json @@ -1,6 +1,6 @@ { "name": "opendc-frontend", - "version": "2.1.0", + "version": "3.0.0", "description": "The user-facing component of the OpenDC stack, allowing users to build and interact with their own (virtual) datacenters.", "keywords": [ "opendc", -- cgit v1.2.3 From 402a8f55342c4565431c2a2e7287a70592f3fe33 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 6 Oct 2022 12:51:27 +0200 Subject: style: Eliminate use of wildcard imports This change updates the repository to remove the use of wildcard imports everywhere. Wildcard imports are not allowed by default by Ktlint as well as Google's Java style guide. --- .editorconfig | 7 +++++- .../main/kotlin/org/opendc/common/util/Pacer.kt | 4 ++- .../org/opendc/common/util/TimerScheduler.kt | 8 +++--- .../kotlin/org/opendc/common/util/PacerTest.kt | 5 +++- .../org/opendc/common/util/TimerSchedulerTest.kt | 7 +++--- .../org/opendc/compute/service/driver/Host.kt | 2 +- .../opendc/compute/service/internal/ClientImage.kt | 2 +- .../compute/service/internal/ClientServer.kt | 2 +- .../compute/service/internal/ComputeServiceImpl.kt | 17 ++++++++++--- .../compute/service/internal/InternalFlavor.kt | 2 +- .../compute/service/internal/InternalImage.kt | 2 +- .../compute/service/internal/InternalServer.kt | 4 ++- .../compute/service/scheduler/FilterScheduler.kt | 2 +- .../scheduler/filters/DifferentHostFilter.kt | 2 +- .../service/scheduler/filters/SameHostFilter.kt | 2 +- .../opendc/compute/service/ComputeServiceTest.kt | 15 ++++++++--- .../opendc/compute/service/InternalFlavorTest.kt | 5 ++-- .../opendc/compute/service/InternalImageTest.kt | 5 ++-- .../opendc/compute/service/InternalServerTest.kt | 11 +++++--- .../service/scheduler/FilterSchedulerTest.kt | 11 ++++++-- .../kotlin/org/opendc/compute/simulator/SimHost.kt | 12 ++++++--- .../simulator/failure/StochasticVictimSelector.kt | 2 +- .../org/opendc/compute/simulator/internal/Guest.kt | 7 +++++- .../simulator/internal/HostFaultInjectorImpl.kt | 6 ++++- .../org/opendc/compute/simulator/SimHostTest.kt | 14 ++++++++--- .../opendc/experiments/provisioner/Provisioner.kt | 2 +- .../experiments/provisioner/ProvisioningContext.kt | 2 +- .../org/opendc/experiments/ServiceRegistryTest.kt | 5 +++- .../experiments/capelin/CapelinBenchmarks.kt | 18 +++++++++++--- .../org/opendc/experiments/capelin/CapelinCli.kt | 13 ++++++++-- .../opendc/experiments/capelin/CapelinRunner.kt | 10 ++++++-- .../capelin/topology/TopologyFactories.kt | 3 ++- .../experiments/capelin/CapelinIntegrationTest.kt | 12 +++++++-- .../experiments/compute/ComputeSchedulers.kt | 2 +- .../opendc/experiments/compute/ComputeWorkload.kt | 2 +- .../experiments/compute/ComputeWorkloadLoader.kt | 20 ++++++++++++--- .../org/opendc/experiments/compute/FailureModel.kt | 2 +- .../opendc/experiments/compute/FailureModels.kt | 2 +- .../experiments/compute/HostsProvisioningStep.kt | 2 +- .../org/opendc/experiments/compute/TraceHelpers.kt | 7 ++++-- .../opendc/experiments/compute/VirtualMachine.kt | 2 +- .../export/parquet/ParquetHostDataWriter.kt | 7 ++++-- .../export/parquet/ParquetServerDataWriter.kt | 7 ++++-- .../export/parquet/ParquetServiceDataWriter.kt | 5 +++- .../compute/internal/CompositeComputeWorkload.kt | 2 +- .../compute/internal/HpcSampledComputeWorkload.kt | 3 ++- .../compute/internal/LoadSampledComputeWorkload.kt | 2 +- .../compute/internal/TraceComputeWorkload.kt | 2 +- .../compute/telemetry/ComputeMetricReader.kt | 6 ++++- .../experiments/compute/topology/HostSpec.kt | 2 +- .../faas/FaaSServiceProvisioningStep.kt | 2 +- .../opendc/experiments/tf20/core/SimTFDevice.kt | 14 ++++++++--- .../org/opendc/experiments/tf20/core/TFDevice.kt | 2 +- .../experiments/tf20/util/MLEnvironmentReader.kt | 2 +- .../org/opendc/experiments/tf20/util/MachineDef.kt | 2 +- .../org/opendc/experiments/tf20/TensorFlowTest.kt | 2 +- .../experiments/tf20/core/SimTFDeviceTest.kt | 2 +- .../opendc/experiments/workflow/TraceHelpers.kt | 13 +++++++--- .../main/kotlin/org/opendc/faas/api/FaaSClient.kt | 2 +- .../org/opendc/faas/service/FunctionObject.kt | 2 +- .../faas/service/internal/FaaSFunctionImpl.kt | 2 +- .../faas/service/internal/FaaSServiceImpl.kt | 10 ++++++-- .../org/opendc/faas/service/FaaSServiceTest.kt | 9 ++++--- .../opendc/faas/simulator/SimFunctionDeployer.kt | 9 ++++++- .../simulator/delay/StochasticDelayInjector.kt | 2 +- .../opendc/faas/simulator/SimFaaSServiceTest.kt | 2 +- .../simulator/compute/SimMachineBenchmarks.kt | 8 +++++- .../opendc/simulator/compute/SimAbstractMachine.kt | 8 +++++- .../simulator/compute/SimBareMetalMachine.kt | 3 ++- .../org/opendc/simulator/compute/device/SimPsu.kt | 2 +- .../simulator/compute/kernel/SimHypervisor.kt | 9 +++++-- .../kernel/interference/VmInterferenceMember.kt | 2 +- .../kernel/interference/VmInterferenceModel.kt | 3 ++- .../simulator/compute/power/PStatePowerDriver.kt | 2 +- .../org/opendc/simulator/compute/SimMachineTest.kt | 17 ++++++++++--- .../compute/kernel/SimFairShareHypervisorTest.kt | 6 +++-- .../compute/kernel/SimSpaceSharedHypervisorTest.kt | 14 ++++++++--- .../compute/workload/SimTraceWorkloadTest.kt | 5 +++- .../opendc/simulator/kotlin/SimulationBuilders.kt | 5 +++- .../kotlin/SimulationCoroutineDispatcher.kt | 8 ++++-- .../kotlin/org/opendc/simulator/TaskQueueTest.kt | 5 +++- .../org/opendc/simulator/flow/FlowBenchmarks.kt | 10 +++++--- .../flow/internal/FlowConsumerContextImpl.kt | 7 ++++-- .../opendc/simulator/flow/internal/FlowDeque.kt | 2 +- .../simulator/flow/internal/FlowEngineImpl.kt | 7 ++++-- .../flow/mux/ForwardingFlowMultiplexer.kt | 8 +++++- .../simulator/flow/mux/MaxMinFlowMultiplexer.kt | 9 ++++++- .../simulator/flow/FlowConsumerContextTest.kt | 7 ++++-- .../org/opendc/simulator/flow/FlowForwarderTest.kt | 14 ++++++++--- .../org/opendc/simulator/flow/FlowSinkTest.kt | 8 ++++-- .../flow/mux/ForwardingFlowMultiplexerTest.kt | 6 ++++- .../flow/mux/MaxMinFlowMultiplexerTest.kt | 3 ++- .../org/opendc/simulator/network/SimNetworkSink.kt | 6 ++++- .../simulator/network/SimNetworkSwitchVirtual.kt | 4 ++- .../opendc/simulator/network/SimNetworkLinkTest.kt | 4 ++- .../opendc/simulator/network/SimNetworkSinkTest.kt | 10 ++++++-- .../network/SimNetworkSwitchVirtualTest.kt | 5 +++- .../kotlin/org/opendc/simulator/power/SimPdu.kt | 5 +++- .../kotlin/org/opendc/simulator/power/SimUps.kt | 5 +++- .../opendc/simulator/power/SimPowerSourceTest.kt | 5 +++- .../main/kotlin/org/opendc/trace/TableWriter.kt | 2 +- .../kotlin/org/opendc/trace/internal/TableImpl.kt | 2 +- .../kotlin/org/opendc/trace/internal/TraceImpl.kt | 2 +- .../kotlin/org/opendc/trace/spi/TraceFormat.kt | 2 +- .../org/opendc/trace/util/CompositeTableReader.kt | 2 +- .../org/opendc/trace/azure/AzureTraceBenchmarks.kt | 12 +++++++-- .../trace/azure/AzureResourceStateTableReader.kt | 4 +-- .../opendc/trace/azure/AzureResourceTableReader.kt | 10 +++++--- .../org/opendc/trace/azure/AzureTraceFormat.kt | 15 +++++++++-- .../org/opendc/trace/azure/AzureTraceFormatTest.kt | 18 +++++++++++--- .../BitbrainsExResourceStateTableReader.kt | 17 ++++++++++--- .../trace/bitbrains/BitbrainsExTraceFormat.kt | 19 ++++++++++++-- .../bitbrains/BitbrainsResourceStateTableReader.kt | 18 +++++++++++--- .../bitbrains/BitbrainsResourceTableReader.kt | 4 +-- .../opendc/trace/bitbrains/BitbrainsTraceFormat.kt | 20 +++++++++++++-- .../trace/bitbrains/BitbrainsExTraceFormatTest.kt | 10 ++++++-- .../trace/bitbrains/BitbrainsTraceFormatTest.kt | 17 ++++++++++--- .../kotlin/org/opendc/trace/calcite/TraceTable.kt | 12 ++++++--- .../org/opendc/trace/calcite/TraceTableModify.kt | 12 +++++++-- .../kotlin/org/opendc/trace/calcite/CalciteTest.kt | 9 +++++-- .../opendc/trace/calcite/TraceSchemaFactoryTest.kt | 6 +++-- .../org/opendc/trace/gwf/GwfTaskTableReader.kt | 13 +++++++--- .../kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt | 14 +++++++++-- .../org/opendc/trace/gwf/GwfTraceFormatTest.kt | 18 +++++++++++--- .../opendc/trace/opendc/OdcVmTraceBenchmarks.kt | 14 +++++++++-- .../opendc/OdcVmInterferenceJsonTableReader.kt | 5 ++-- .../opendc/OdcVmInterferenceJsonTableWriter.kt | 4 +-- .../trace/opendc/OdcVmResourceStateTableReader.kt | 10 +++++--- .../trace/opendc/OdcVmResourceStateTableWriter.kt | 10 +++++--- .../trace/opendc/OdcVmResourceTableReader.kt | 11 +++++--- .../trace/opendc/OdcVmResourceTableWriter.kt | 11 +++++--- .../org/opendc/trace/opendc/OdcVmTraceFormat.kt | 21 ++++++++++++++-- .../trace/opendc/parquet/ResourceReadSupport.kt | 12 +++++++-- .../opendc/parquet/ResourceRecordMaterializer.kt | 6 ++++- .../opendc/parquet/ResourceStateReadSupport.kt | 11 ++++++-- .../parquet/ResourceStateRecordMaterializer.kt | 6 ++++- .../opendc/parquet/ResourceStateWriteSupport.kt | 5 +++- .../trace/opendc/parquet/ResourceWriteSupport.kt | 5 +++- .../opendc/trace/opendc/OdcVmTraceFormatTest.kt | 20 +++++++++++++-- .../org/opendc/trace/util/parquet/ParquetTest.kt | 5 +++- .../org/opendc/trace/swf/SwfTaskTableReader.kt | 15 ++++++++--- .../kotlin/org/opendc/trace/swf/SwfTraceFormat.kt | 17 +++++++++++-- .../org/opendc/trace/swf/SwfTraceFormatTest.kt | 11 ++++++-- .../org/opendc/trace/testkit/TableReaderTestKit.kt | 8 ++++-- .../org/opendc/trace/testkit/TableWriterTestKit.kt | 5 ++-- .../org/opendc/trace/tools/ConvertCommand.kt | 29 ++++++++++++++++++---- .../kotlin/org/opendc/trace/tools/QueryCommand.kt | 2 +- .../trace/wfformat/WfFormatTaskTableReader.kt | 12 ++++++--- .../opendc/trace/wfformat/WfFormatTraceFormat.kt | 13 ++++++++-- .../trace/wfformat/WfFormatTaskTableReaderTest.kt | 4 ++- .../trace/wfformat/WfFormatTraceFormatTest.kt | 17 ++++++++++--- .../org/opendc/trace/wtf/WtfTaskTableReader.kt | 16 +++++++++--- .../kotlin/org/opendc/trace/wtf/WtfTraceFormat.kt | 17 +++++++++++-- .../opendc/trace/wtf/parquet/TaskReadSupport.kt | 17 +++++++++++-- .../trace/wtf/parquet/TaskRecordMaterializer.kt | 5 +++- .../org/opendc/trace/wtf/WtfTraceFormatTest.kt | 17 ++++++++++--- .../org/opendc/web/client/ProjectResource.kt | 4 ++- .../kotlin/org/opendc/web/client/TraceResource.kt | 2 +- .../org/opendc/web/client/runner/JobResource.kt | 3 ++- .../opendc/web/client/runner/OpenDCRunnerClient.kt | 3 ++- .../kotlin/org/opendc/web/proto/runner/Scenario.kt | 3 ++- .../kotlin/org/opendc/web/proto/runner/Topology.kt | 2 +- .../src/cli/kotlin/org/opendc/web/runner/Main.kt | 6 ++++- .../kotlin/org/opendc/web/runner/OpenDCRunner.kt | 21 +++++++++++++--- .../main/kotlin/org/opendc/web/server/model/Job.kt | 12 ++++++++- .../org/opendc/web/server/model/Portfolio.kt | 16 +++++++++++- .../kotlin/org/opendc/web/server/model/Project.kt | 12 ++++++++- .../web/server/model/ProjectAuthorization.kt | 8 +++++- .../kotlin/org/opendc/web/server/model/Scenario.kt | 16 +++++++++++- .../kotlin/org/opendc/web/server/model/Topology.kt | 13 +++++++++- .../kotlin/org/opendc/web/server/model/Trace.kt | 7 +++++- .../org/opendc/web/server/rest/TraceResource.kt | 5 +++- .../opendc/web/server/rest/runner/JobResource.kt | 6 ++++- .../web/server/rest/user/PortfolioResource.kt | 7 +++++- .../server/rest/user/PortfolioScenarioResource.kt | 6 ++++- .../opendc/web/server/rest/user/ProjectResource.kt | 7 +++++- .../web/server/rest/user/ScenarioResource.kt | 6 ++++- .../web/server/rest/user/TopologyResource.kt | 8 +++++- .../opendc/web/server/service/PortfolioService.kt | 1 - .../opendc/web/server/service/ProjectService.kt | 14 ++++++----- .../opendc/web/server/service/ScenarioService.kt | 20 +++++++++------ .../opendc/web/server/service/UserConversions.kt | 8 +++++- .../hibernate/json/JsonBytesSqlTypeDescriptor.kt | 5 +++- .../util/hibernate/json/JsonSqlTypeDescriptor.kt | 5 +++- .../hibernate/json/JsonStringSqlTypeDescriptor.kt | 5 +++- .../web/server/util/hibernate/json/JsonType.kt | 2 +- .../util/hibernate/json/JsonTypeDescriptor.kt | 3 ++- .../web/server/rest/runner/JobResourceTest.kt | 5 +++- .../rest/user/PortfolioScenarioResourceTest.kt | 13 ++++++++-- .../web/server/rest/user/ScenarioResourceTest.kt | 13 ++++++++-- .../src/main/kotlin/org/opendc/workflow/api/Job.kt | 2 +- .../main/kotlin/org/opendc/workflow/api/Task.kt | 3 +-- .../service/internal/WorkflowServiceImpl.kt | 18 ++++++++++---- .../service/scheduler/job/RandomJobOrderPolicy.kt | 2 +- .../scheduler/task/DurationTaskOrderPolicy.kt | 2 +- .../scheduler/task/RandomTaskEligibilityPolicy.kt | 2 +- .../opendc/workflow/service/WorkflowServiceTest.kt | 7 ++++-- 197 files changed, 1184 insertions(+), 333 deletions(-) diff --git a/.editorconfig b/.editorconfig index c8c1b1df..fcb56876 100644 --- a/.editorconfig +++ b/.editorconfig @@ -19,6 +19,11 @@ trim_trailing_whitespace = false [*.{yml,yaml}] indent_size = 2 +[*.java] +ij_java_packages_to_use_import_on_demand = unset + # ktlint [*.{kt, kts}] -disabled_rules = no-wildcard-imports +ij_kotlin_name_count_to_use_star_import = 2147483647 +ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 +ij_kotlin_packages_to_use_import_on_demand = unset diff --git a/opendc-common/src/main/kotlin/org/opendc/common/util/Pacer.kt b/opendc-common/src/main/kotlin/org/opendc/common/util/Pacer.kt index 8ccff6c3..edf607d2 100644 --- a/opendc-common/src/main/kotlin/org/opendc/common/util/Pacer.kt +++ b/opendc-common/src/main/kotlin/org/opendc/common/util/Pacer.kt @@ -22,7 +22,9 @@ package org.opendc.common.util -import kotlinx.coroutines.* +import kotlinx.coroutines.Delay +import kotlinx.coroutines.DisposableHandle +import kotlinx.coroutines.InternalCoroutinesApi import java.lang.Runnable import java.time.Clock import kotlin.coroutines.ContinuationInterceptor diff --git a/opendc-common/src/main/kotlin/org/opendc/common/util/TimerScheduler.kt b/opendc-common/src/main/kotlin/org/opendc/common/util/TimerScheduler.kt index bec2c9f1..44d6010f 100644 --- a/opendc-common/src/main/kotlin/org/opendc/common/util/TimerScheduler.kt +++ b/opendc-common/src/main/kotlin/org/opendc/common/util/TimerScheduler.kt @@ -22,9 +22,12 @@ package org.opendc.common.util -import kotlinx.coroutines.* +import kotlinx.coroutines.Delay +import kotlinx.coroutines.DisposableHandle +import kotlinx.coroutines.InternalCoroutinesApi import java.time.Clock -import java.util.* +import java.util.ArrayDeque +import java.util.PriorityQueue import kotlin.coroutines.ContinuationInterceptor import kotlin.coroutines.CoroutineContext @@ -34,7 +37,6 @@ import kotlin.coroutines.CoroutineContext * @param context The [CoroutineContext] to run the tasks with. * @param clock The clock to keep track of the time. */ -@OptIn(ExperimentalCoroutinesApi::class) public class TimerScheduler(private val context: CoroutineContext, private val clock: Clock) { /** * The [Delay] instance that provides scheduled execution of [Runnable]s. diff --git a/opendc-common/src/test/kotlin/org/opendc/common/util/PacerTest.kt b/opendc-common/src/test/kotlin/org/opendc/common/util/PacerTest.kt index de9fd472..3fae2ebc 100644 --- a/opendc-common/src/test/kotlin/org/opendc/common/util/PacerTest.kt +++ b/opendc-common/src/test/kotlin/org/opendc/common/util/PacerTest.kt @@ -23,7 +23,10 @@ package org.opendc.common.util import kotlinx.coroutines.delay -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertDoesNotThrow +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import org.opendc.simulator.kotlin.runSimulation diff --git a/opendc-common/src/test/kotlin/org/opendc/common/util/TimerSchedulerTest.kt b/opendc-common/src/test/kotlin/org/opendc/common/util/TimerSchedulerTest.kt index 183ab66a..f3d2b23d 100644 --- a/opendc-common/src/test/kotlin/org/opendc/common/util/TimerSchedulerTest.kt +++ b/opendc-common/src/test/kotlin/org/opendc/common/util/TimerSchedulerTest.kt @@ -22,8 +22,10 @@ package org.opendc.common.util -import kotlinx.coroutines.ExperimentalCoroutinesApi -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.Assertions.fail import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import org.opendc.simulator.kotlin.runSimulation @@ -33,7 +35,6 @@ import kotlin.coroutines.EmptyCoroutineContext /** * A test suite for the [TimerScheduler] class. */ -@OptIn(ExperimentalCoroutinesApi::class) internal class TimerSchedulerTest { @Test fun testEmptyContext() { diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/Host.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/Host.kt index 67b144d9..fad8757e 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/Host.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/Host.kt @@ -27,7 +27,7 @@ import org.opendc.compute.service.driver.telemetry.GuestCpuStats import org.opendc.compute.service.driver.telemetry.GuestSystemStats import org.opendc.compute.service.driver.telemetry.HostCpuStats import org.opendc.compute.service.driver.telemetry.HostSystemStats -import java.util.* +import java.util.UUID /** * Base interface for representing compute resources that host virtualized [Server] instances. diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ClientImage.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ClientImage.kt index e0b5c171..f0032acf 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ClientImage.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ClientImage.kt @@ -23,7 +23,7 @@ package org.opendc.compute.service.internal import org.opendc.compute.api.Image -import java.util.* +import java.util.UUID /** * An [Image] implementation that is passed to clients but delegates its implementation to another class. diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ClientServer.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ClientServer.kt index 45775640..6cd7d30f 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ClientServer.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ClientServer.kt @@ -28,7 +28,7 @@ import org.opendc.compute.api.Server import org.opendc.compute.api.ServerState import org.opendc.compute.api.ServerWatcher import java.time.Instant -import java.util.* +import java.util.UUID /** * A [Server] implementation that is passed to clients but delegates its implementation to another class. diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt index 519cf6c6..caa95e09 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt @@ -22,10 +22,18 @@ package org.opendc.compute.service.internal -import kotlinx.coroutines.* +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Job +import kotlinx.coroutines.cancel +import kotlinx.coroutines.isActive +import kotlinx.coroutines.launch import mu.KotlinLogging import org.opendc.common.util.Pacer -import org.opendc.compute.api.* +import org.opendc.compute.api.ComputeClient +import org.opendc.compute.api.Flavor +import org.opendc.compute.api.Image +import org.opendc.compute.api.Server +import org.opendc.compute.api.ServerState import org.opendc.compute.service.ComputeService import org.opendc.compute.service.driver.Host import org.opendc.compute.service.driver.HostListener @@ -35,7 +43,10 @@ import org.opendc.compute.service.telemetry.SchedulerStats import java.time.Clock import java.time.Duration import java.time.Instant -import java.util.* +import java.util.ArrayDeque +import java.util.Deque +import java.util.Random +import java.util.UUID import kotlin.coroutines.CoroutineContext import kotlin.math.max diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalFlavor.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalFlavor.kt index b8fb6279..acd87dfc 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalFlavor.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalFlavor.kt @@ -23,7 +23,7 @@ package org.opendc.compute.service.internal import org.opendc.compute.api.Flavor -import java.util.* +import java.util.UUID /** * Internal stateful representation of a [Flavor]. diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalImage.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalImage.kt index d9ed5896..a0a35a55 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalImage.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalImage.kt @@ -23,7 +23,7 @@ package org.opendc.compute.service.internal import org.opendc.compute.api.Image -import java.util.* +import java.util.UUID /** * Internal stateful representation of an [Image]. diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalServer.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalServer.kt index f9da24d8..e3bae405 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalServer.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/InternalServer.kt @@ -23,7 +23,9 @@ package org.opendc.compute.service.internal import mu.KotlinLogging -import org.opendc.compute.api.* +import org.opendc.compute.api.Server +import org.opendc.compute.api.ServerState +import org.opendc.compute.api.ServerWatcher import org.opendc.compute.service.driver.Host import java.time.Instant import java.util.UUID 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 8c2d4715..233f5ef6 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 @@ -26,7 +26,7 @@ import org.opendc.compute.api.Server import org.opendc.compute.service.internal.HostView import org.opendc.compute.service.scheduler.filters.HostFilter import org.opendc.compute.service.scheduler.weights.HostWeigher -import java.util.* +import java.util.Random import kotlin.math.min /** diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/DifferentHostFilter.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/DifferentHostFilter.kt index 54f2f303..f6736ac0 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/DifferentHostFilter.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/DifferentHostFilter.kt @@ -24,7 +24,7 @@ package org.opendc.compute.service.scheduler.filters import org.opendc.compute.api.Server import org.opendc.compute.service.internal.HostView -import java.util.* +import java.util.UUID /** * A [HostFilter] that ensures an instance is scheduled on a different host from a set of instances. diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/SameHostFilter.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/SameHostFilter.kt index febb085d..090e1437 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/SameHostFilter.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/filters/SameHostFilter.kt @@ -24,7 +24,7 @@ package org.opendc.compute.service.scheduler.filters import org.opendc.compute.api.Server import org.opendc.compute.service.internal.HostView -import java.util.* +import java.util.UUID /** * A [HostFilter] that ensures an instance is scheduled on the same host as all other instances in a set of instances. diff --git a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/ComputeServiceTest.kt b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/ComputeServiceTest.kt index 4f4008bc..73e9b3d7 100644 --- a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/ComputeServiceTest.kt +++ b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/ComputeServiceTest.kt @@ -22,14 +22,23 @@ package org.opendc.compute.service -import io.mockk.* +import io.mockk.coEvery +import io.mockk.coVerify +import io.mockk.every +import io.mockk.mockk +import io.mockk.slot +import io.mockk.verify import kotlinx.coroutines.delay import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows -import org.opendc.compute.api.* +import org.opendc.compute.api.Flavor +import org.opendc.compute.api.Image +import org.opendc.compute.api.Server +import org.opendc.compute.api.ServerState +import org.opendc.compute.api.ServerWatcher import org.opendc.compute.service.driver.Host import org.opendc.compute.service.driver.HostListener import org.opendc.compute.service.driver.HostModel @@ -41,7 +50,7 @@ import org.opendc.compute.service.scheduler.filters.VCpuFilter import org.opendc.compute.service.scheduler.weights.RamWeigher import org.opendc.simulator.kotlin.SimulationCoroutineScope import org.opendc.simulator.kotlin.runSimulation -import java.util.* +import java.util.UUID /** * Test suite for the [ComputeService] interface. diff --git a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalFlavorTest.kt b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalFlavorTest.kt index 18d698c6..fe92f7f2 100644 --- a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalFlavorTest.kt +++ b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalFlavorTest.kt @@ -22,14 +22,15 @@ package org.opendc.compute.service -import io.mockk.* +import io.mockk.every +import io.mockk.mockk import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotEquals import org.junit.jupiter.api.Test import org.opendc.compute.api.Flavor import org.opendc.compute.service.internal.ComputeServiceImpl import org.opendc.compute.service.internal.InternalFlavor -import java.util.* +import java.util.UUID /** * Test suite for the [InternalFlavor] implementation. diff --git a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalImageTest.kt b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalImageTest.kt index e1cb0128..d60aa628 100644 --- a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalImageTest.kt +++ b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalImageTest.kt @@ -22,7 +22,8 @@ package org.opendc.compute.service -import io.mockk.* +import io.mockk.every +import io.mockk.mockk import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotEquals import org.junit.jupiter.api.Test @@ -30,7 +31,7 @@ import org.opendc.compute.api.Image import org.opendc.compute.service.internal.ComputeServiceImpl import org.opendc.compute.service.internal.InternalFlavor import org.opendc.compute.service.internal.InternalImage -import java.util.* +import java.util.UUID /** * Test suite for the [InternalFlavor] implementation. diff --git a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalServerTest.kt b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalServerTest.kt index 9e59949f..05a8160e 100644 --- a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalServerTest.kt +++ b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalServerTest.kt @@ -22,9 +22,14 @@ package org.opendc.compute.service -import io.mockk.* +import io.mockk.coVerify +import io.mockk.every +import io.mockk.mockk +import io.mockk.verify import kotlinx.coroutines.yield -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertNotEquals +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import org.opendc.compute.api.Server @@ -35,7 +40,7 @@ import org.opendc.compute.service.internal.InternalFlavor import org.opendc.compute.service.internal.InternalImage import org.opendc.compute.service.internal.InternalServer import org.opendc.simulator.kotlin.runSimulation -import java.util.* +import java.util.UUID /** * Test suite for the [InternalServer] implementation. diff --git a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/scheduler/FilterSchedulerTest.kt b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/scheduler/FilterSchedulerTest.kt index 350ac944..8ecf7f87 100644 --- a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/scheduler/FilterSchedulerTest.kt +++ b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/scheduler/FilterSchedulerTest.kt @@ -33,12 +33,19 @@ import org.opendc.compute.api.Server import org.opendc.compute.service.driver.HostModel import org.opendc.compute.service.driver.HostState import org.opendc.compute.service.internal.HostView -import org.opendc.compute.service.scheduler.filters.* +import org.opendc.compute.service.scheduler.filters.ComputeFilter +import org.opendc.compute.service.scheduler.filters.DifferentHostFilter +import org.opendc.compute.service.scheduler.filters.InstanceCountFilter +import org.opendc.compute.service.scheduler.filters.RamFilter +import org.opendc.compute.service.scheduler.filters.SameHostFilter +import org.opendc.compute.service.scheduler.filters.VCpuCapacityFilter +import org.opendc.compute.service.scheduler.filters.VCpuFilter import org.opendc.compute.service.scheduler.weights.CoreRamWeigher import org.opendc.compute.service.scheduler.weights.InstanceCountWeigher import org.opendc.compute.service.scheduler.weights.RamWeigher import org.opendc.compute.service.scheduler.weights.VCpuWeigher -import java.util.* +import java.util.Random +import java.util.UUID /** * Test suite for the [FilterScheduler]. diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt index c04573b5..9969ac2b 100644 --- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt +++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/SimHost.kt @@ -22,18 +22,22 @@ package org.opendc.compute.simulator -import kotlinx.coroutines.* +import kotlinx.coroutines.yield import org.opendc.compute.api.Flavor import org.opendc.compute.api.Server import org.opendc.compute.api.ServerState -import org.opendc.compute.service.driver.* +import org.opendc.compute.service.driver.Host +import org.opendc.compute.service.driver.HostListener +import org.opendc.compute.service.driver.HostModel +import org.opendc.compute.service.driver.HostState import org.opendc.compute.service.driver.telemetry.GuestCpuStats import org.opendc.compute.service.driver.telemetry.GuestSystemStats import org.opendc.compute.service.driver.telemetry.HostCpuStats import org.opendc.compute.service.driver.telemetry.HostSystemStats import org.opendc.compute.simulator.internal.Guest import org.opendc.compute.simulator.internal.GuestListener -import org.opendc.simulator.compute.* +import org.opendc.simulator.compute.SimBareMetalMachine +import org.opendc.simulator.compute.SimMachineContext import org.opendc.simulator.compute.kernel.SimHypervisor import org.opendc.simulator.compute.model.MachineModel import org.opendc.simulator.compute.model.MemoryUnit @@ -41,7 +45,7 @@ import org.opendc.simulator.compute.workload.SimWorkload import java.time.Clock import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID import kotlin.coroutines.CoroutineContext /** diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/failure/StochasticVictimSelector.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/failure/StochasticVictimSelector.kt index fcd9dd7e..b6d466bd 100644 --- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/failure/StochasticVictimSelector.kt +++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/failure/StochasticVictimSelector.kt @@ -24,7 +24,7 @@ package org.opendc.compute.simulator.failure import org.apache.commons.math3.distribution.RealDistribution import org.opendc.compute.simulator.SimHost -import java.util.* +import java.util.Random import kotlin.math.roundToInt /** diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/internal/Guest.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/internal/Guest.kt index cc084526..6b74fa3a 100644 --- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/internal/Guest.kt +++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/internal/Guest.kt @@ -22,7 +22,12 @@ package org.opendc.compute.simulator.internal -import kotlinx.coroutines.* +import kotlinx.coroutines.CancellationException +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Job +import kotlinx.coroutines.cancel +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch import mu.KotlinLogging import org.opendc.compute.api.Server import org.opendc.compute.api.ServerState diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/internal/HostFaultInjectorImpl.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/internal/HostFaultInjectorImpl.kt index 7d46e626..f03bffe9 100644 --- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/internal/HostFaultInjectorImpl.kt +++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/internal/HostFaultInjectorImpl.kt @@ -22,7 +22,11 @@ package org.opendc.compute.simulator.internal -import kotlinx.coroutines.* +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Job +import kotlinx.coroutines.cancel +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch import org.apache.commons.math3.distribution.RealDistribution import org.opendc.compute.simulator.SimHost import org.opendc.compute.simulator.failure.HostFault diff --git a/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt b/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt index f63d4c6f..7092d57e 100644 --- a/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt +++ b/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt @@ -22,12 +22,19 @@ package org.opendc.compute.simulator -import kotlinx.coroutines.* +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import kotlinx.coroutines.suspendCancellableCoroutine import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertAll -import org.opendc.compute.api.* +import org.opendc.compute.api.Flavor +import org.opendc.compute.api.Image +import org.opendc.compute.api.Server +import org.opendc.compute.api.ServerState +import org.opendc.compute.api.ServerWatcher import org.opendc.compute.service.driver.Host import org.opendc.compute.service.driver.HostListener import org.opendc.simulator.compute.SimBareMetalMachine @@ -45,7 +52,8 @@ import org.opendc.simulator.flow.FlowEngine import org.opendc.simulator.flow.mux.FlowMultiplexerFactory import org.opendc.simulator.kotlin.runSimulation import java.time.Instant -import java.util.* +import java.util.SplittableRandom +import java.util.UUID import kotlin.coroutines.resume /** diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/provisioner/Provisioner.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/provisioner/Provisioner.kt index 3a1c3144..7fe3a2eb 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/provisioner/Provisioner.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/provisioner/Provisioner.kt @@ -26,8 +26,8 @@ import org.opendc.experiments.MutableServiceRegistry import org.opendc.experiments.ServiceRegistry import org.opendc.experiments.internal.ServiceRegistryImpl import java.time.Clock -import java.util.* import java.util.ArrayDeque +import java.util.SplittableRandom import kotlin.coroutines.CoroutineContext /** diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/provisioner/ProvisioningContext.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/provisioner/ProvisioningContext.kt index 58f6844d..73897315 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/provisioner/ProvisioningContext.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/provisioner/ProvisioningContext.kt @@ -24,7 +24,7 @@ package org.opendc.experiments.provisioner import org.opendc.experiments.MutableServiceRegistry import java.time.Clock -import java.util.* +import java.util.SplittableRandom import kotlin.coroutines.CoroutineContext /** diff --git a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/ServiceRegistryTest.kt b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/ServiceRegistryTest.kt index f69c07c1..67dbaba9 100644 --- a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/ServiceRegistryTest.kt +++ b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/ServiceRegistryTest.kt @@ -22,7 +22,10 @@ package org.opendc.experiments -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertDoesNotThrow +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import org.opendc.experiments.internal.ServiceRegistryImpl diff --git a/opendc-experiments/opendc-experiments-capelin/src/jmh/kotlin/org/opendc/experiments/capelin/CapelinBenchmarks.kt b/opendc-experiments/opendc-experiments-capelin/src/jmh/kotlin/org/opendc/experiments/capelin/CapelinBenchmarks.kt index ef3deeb2..3e3d758d 100644 --- a/opendc-experiments/opendc-experiments-capelin/src/jmh/kotlin/org/opendc/experiments/capelin/CapelinBenchmarks.kt +++ b/opendc-experiments/opendc-experiments-capelin/src/jmh/kotlin/org/opendc/experiments/capelin/CapelinBenchmarks.kt @@ -29,13 +29,25 @@ import org.opendc.compute.service.scheduler.filters.RamFilter import org.opendc.compute.service.scheduler.filters.VCpuFilter import org.opendc.compute.service.scheduler.weights.CoreRamWeigher import org.opendc.experiments.capelin.topology.clusterTopology -import org.opendc.experiments.compute.* +import org.opendc.experiments.compute.ComputeWorkloadLoader +import org.opendc.experiments.compute.VirtualMachine +import org.opendc.experiments.compute.replay +import org.opendc.experiments.compute.setupComputeService +import org.opendc.experiments.compute.setupHosts import org.opendc.experiments.compute.topology.HostSpec +import org.opendc.experiments.compute.trace import org.opendc.experiments.provisioner.Provisioner import org.opendc.simulator.kotlin.runSimulation -import org.openjdk.jmh.annotations.* +import org.openjdk.jmh.annotations.Benchmark +import org.openjdk.jmh.annotations.Fork +import org.openjdk.jmh.annotations.Measurement +import org.openjdk.jmh.annotations.Param +import org.openjdk.jmh.annotations.Scope +import org.openjdk.jmh.annotations.Setup +import org.openjdk.jmh.annotations.State +import org.openjdk.jmh.annotations.Warmup import java.io.File -import java.util.* +import java.util.Random import java.util.concurrent.TimeUnit /** diff --git a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/CapelinCli.kt b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/CapelinCli.kt index 875ae0dc..35a51de5 100644 --- a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/CapelinCli.kt +++ b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/CapelinCli.kt @@ -25,7 +25,11 @@ package org.opendc.experiments.capelin import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.arguments.argument -import com.github.ajalt.clikt.parameters.options.* +import com.github.ajalt.clikt.parameters.options.associate +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.types.choice import com.github.ajalt.clikt.parameters.types.file import com.github.ajalt.clikt.parameters.types.int @@ -33,7 +37,12 @@ import com.github.ajalt.clikt.parameters.types.long import me.tongfei.progressbar.ProgressBarBuilder import me.tongfei.progressbar.ProgressBarStyle import org.opendc.experiments.capelin.model.Scenario -import org.opendc.experiments.capelin.portfolio.* +import org.opendc.experiments.capelin.portfolio.CompositeWorkloadPortfolio +import org.opendc.experiments.capelin.portfolio.HorVerPortfolio +import org.opendc.experiments.capelin.portfolio.MoreHpcPortfolio +import org.opendc.experiments.capelin.portfolio.MoreVelocityPortfolio +import org.opendc.experiments.capelin.portfolio.OperationalPhenomenaPortfolio +import org.opendc.experiments.capelin.portfolio.TestPortfolio import java.io.File import java.util.concurrent.ForkJoinPool import java.util.stream.LongStream diff --git a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/CapelinRunner.kt b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/CapelinRunner.kt index 7461038d..44079cc2 100644 --- a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/CapelinRunner.kt +++ b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/CapelinRunner.kt @@ -25,13 +25,19 @@ package org.opendc.experiments.capelin import org.opendc.compute.service.ComputeService import org.opendc.experiments.capelin.model.Scenario import org.opendc.experiments.capelin.topology.clusterTopology -import org.opendc.experiments.compute.* +import org.opendc.experiments.compute.ComputeWorkloadLoader +import org.opendc.experiments.compute.createComputeScheduler import org.opendc.experiments.compute.export.parquet.ParquetComputeMonitor +import org.opendc.experiments.compute.grid5000 +import org.opendc.experiments.compute.registerComputeMonitor +import org.opendc.experiments.compute.replay +import org.opendc.experiments.compute.setupComputeService +import org.opendc.experiments.compute.setupHosts import org.opendc.experiments.provisioner.Provisioner import org.opendc.simulator.kotlin.runSimulation import java.io.File import java.time.Duration -import java.util.* +import java.util.Random import kotlin.math.roundToLong /** diff --git a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt index 054adfcd..c78925a1 100644 --- a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt +++ b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt @@ -33,7 +33,8 @@ import org.opendc.simulator.compute.power.PowerModel import org.opendc.simulator.compute.power.SimplePowerDriver import java.io.File import java.io.InputStream -import java.util.* +import java.util.Random +import java.util.UUID import kotlin.math.roundToLong /** diff --git a/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt b/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt index 238a5f87..b39f68fd 100644 --- a/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt +++ b/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt @@ -33,16 +33,24 @@ import org.opendc.compute.service.scheduler.filters.RamFilter import org.opendc.compute.service.scheduler.filters.VCpuFilter import org.opendc.compute.service.scheduler.weights.CoreRamWeigher import org.opendc.experiments.capelin.topology.clusterTopology -import org.opendc.experiments.compute.* +import org.opendc.experiments.compute.ComputeWorkloadLoader +import org.opendc.experiments.compute.VirtualMachine +import org.opendc.experiments.compute.grid5000 +import org.opendc.experiments.compute.registerComputeMonitor +import org.opendc.experiments.compute.replay +import org.opendc.experiments.compute.sampleByLoad +import org.opendc.experiments.compute.setupComputeService +import org.opendc.experiments.compute.setupHosts import org.opendc.experiments.compute.telemetry.ComputeMonitor import org.opendc.experiments.compute.telemetry.table.HostTableReader import org.opendc.experiments.compute.telemetry.table.ServiceTableReader import org.opendc.experiments.compute.topology.HostSpec +import org.opendc.experiments.compute.trace import org.opendc.experiments.provisioner.Provisioner import org.opendc.simulator.kotlin.runSimulation import java.io.File import java.time.Duration -import java.util.* +import java.util.Random /** * An integration test suite for the Capelin experiments. diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeSchedulers.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeSchedulers.kt index 1731a4ac..9ed2e564 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeSchedulers.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeSchedulers.kt @@ -33,7 +33,7 @@ import org.opendc.compute.service.scheduler.weights.CoreRamWeigher import org.opendc.compute.service.scheduler.weights.InstanceCountWeigher import org.opendc.compute.service.scheduler.weights.RamWeigher import org.opendc.compute.service.scheduler.weights.VCpuWeigher -import java.util.* +import java.util.Random /** * Create a [ComputeScheduler] for the experiment. diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeWorkload.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeWorkload.kt index 3db980ca..2200880d 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeWorkload.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeWorkload.kt @@ -22,7 +22,7 @@ package org.opendc.experiments.compute -import java.util.* +import java.util.Random /** * An interface that describes how a workload is resolved. diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeWorkloadLoader.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeWorkloadLoader.kt index f92e10e3..daf6b505 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeWorkloadLoader.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeWorkloadLoader.kt @@ -25,11 +25,25 @@ package org.opendc.experiments.compute import mu.KotlinLogging import org.opendc.simulator.compute.kernel.interference.VmInterferenceModel import org.opendc.simulator.compute.workload.SimTrace -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.Trace +import org.opendc.trace.conv.INTERFERENCE_GROUP_MEMBERS +import org.opendc.trace.conv.INTERFERENCE_GROUP_SCORE +import org.opendc.trace.conv.INTERFERENCE_GROUP_TARGET +import org.opendc.trace.conv.RESOURCE_CPU_CAPACITY +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_MEM_CAPACITY +import org.opendc.trace.conv.RESOURCE_START_TIME +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE +import org.opendc.trace.conv.RESOURCE_STATE_DURATION +import org.opendc.trace.conv.RESOURCE_STATE_TIMESTAMP +import org.opendc.trace.conv.RESOURCE_STOP_TIME +import org.opendc.trace.conv.TABLE_INTERFERENCE_GROUPS +import org.opendc.trace.conv.TABLE_RESOURCES +import org.opendc.trace.conv.TABLE_RESOURCE_STATES import java.io.File import java.lang.ref.SoftReference -import java.util.* +import java.util.UUID import java.util.concurrent.ConcurrentHashMap import kotlin.math.max import kotlin.math.roundToLong diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/FailureModel.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/FailureModel.kt index f96b7e16..e0d6fdc1 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/FailureModel.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/FailureModel.kt @@ -25,7 +25,7 @@ package org.opendc.experiments.compute import org.opendc.compute.service.ComputeService import org.opendc.compute.simulator.failure.HostFaultInjector import java.time.Clock -import java.util.* +import java.util.Random import kotlin.coroutines.CoroutineContext /** diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/FailureModels.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/FailureModels.kt index 00bf44a1..7480e116 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/FailureModels.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/FailureModels.kt @@ -32,7 +32,7 @@ import org.opendc.compute.simulator.failure.StartStopHostFault import org.opendc.compute.simulator.failure.StochasticVictimSelector import java.time.Clock import java.time.Duration -import java.util.* +import java.util.Random import kotlin.coroutines.CoroutineContext import kotlin.math.ln diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt index 28c9bc01..9fa8d00c 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt @@ -30,7 +30,7 @@ import org.opendc.experiments.provisioner.ProvisioningStep import org.opendc.simulator.compute.SimBareMetalMachine import org.opendc.simulator.compute.kernel.SimHypervisor import org.opendc.simulator.flow.FlowEngine -import java.util.* +import java.util.SplittableRandom /** * A [ProvisioningStep] that provisions a list of hosts for a [ComputeService]. diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/TraceHelpers.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/TraceHelpers.kt index 0df9305a..9562baf5 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/TraceHelpers.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/TraceHelpers.kt @@ -23,11 +23,14 @@ @file:JvmName("TraceHelpers") package org.opendc.experiments.compute -import kotlinx.coroutines.* +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import kotlinx.coroutines.yield import org.opendc.compute.service.ComputeService import org.opendc.simulator.compute.workload.SimTraceWorkload import java.time.Clock -import java.util.* +import java.util.Random import kotlin.coroutines.coroutineContext import kotlin.math.max diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/VirtualMachine.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/VirtualMachine.kt index 3ed497a0..509af59f 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/VirtualMachine.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/VirtualMachine.kt @@ -25,7 +25,7 @@ package org.opendc.experiments.compute import org.opendc.simulator.compute.kernel.interference.VmInterferenceProfile import org.opendc.simulator.compute.workload.SimTrace import java.time.Instant -import java.util.* +import java.util.UUID /** * A virtual machine workload. diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetHostDataWriter.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetHostDataWriter.kt index cf0a3bf2..df0163d2 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetHostDataWriter.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetHostDataWriter.kt @@ -26,11 +26,14 @@ import org.apache.hadoop.conf.Configuration import org.apache.parquet.hadoop.ParquetWriter import org.apache.parquet.hadoop.api.WriteSupport import org.apache.parquet.io.api.RecordConsumer -import org.apache.parquet.schema.* +import org.apache.parquet.schema.LogicalTypeAnnotation +import org.apache.parquet.schema.MessageType +import org.apache.parquet.schema.PrimitiveType +import org.apache.parquet.schema.Types import org.opendc.experiments.compute.telemetry.table.HostTableReader import org.opendc.trace.util.parquet.LocalParquetWriter import java.io.File -import java.util.* +import java.util.UUID /** * A Parquet event writer for [HostTableReader]s. diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetServerDataWriter.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetServerDataWriter.kt index 1622289e..99ef83c6 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetServerDataWriter.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetServerDataWriter.kt @@ -26,11 +26,14 @@ import org.apache.hadoop.conf.Configuration import org.apache.parquet.hadoop.ParquetWriter import org.apache.parquet.hadoop.api.WriteSupport import org.apache.parquet.io.api.RecordConsumer -import org.apache.parquet.schema.* +import org.apache.parquet.schema.LogicalTypeAnnotation +import org.apache.parquet.schema.MessageType +import org.apache.parquet.schema.PrimitiveType +import org.apache.parquet.schema.Types import org.opendc.experiments.compute.telemetry.table.ServerTableReader import org.opendc.trace.util.parquet.LocalParquetWriter import java.io.File -import java.util.* +import java.util.UUID /** * A Parquet event writer for [ServerTableReader]s. diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetServiceDataWriter.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetServiceDataWriter.kt index 0c466d39..6f1d5ad5 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetServiceDataWriter.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetServiceDataWriter.kt @@ -25,7 +25,10 @@ package org.opendc.experiments.compute.export.parquet import org.apache.hadoop.conf.Configuration import org.apache.parquet.hadoop.api.WriteSupport import org.apache.parquet.io.api.RecordConsumer -import org.apache.parquet.schema.* +import org.apache.parquet.schema.LogicalTypeAnnotation +import org.apache.parquet.schema.MessageType +import org.apache.parquet.schema.PrimitiveType +import org.apache.parquet.schema.Types import org.opendc.experiments.compute.telemetry.table.ServiceTableReader import java.io.File diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/internal/CompositeComputeWorkload.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/internal/CompositeComputeWorkload.kt index 75779088..3a7a51f2 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/internal/CompositeComputeWorkload.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/internal/CompositeComputeWorkload.kt @@ -26,7 +26,7 @@ import mu.KotlinLogging import org.opendc.experiments.compute.ComputeWorkload import org.opendc.experiments.compute.ComputeWorkloadLoader import org.opendc.experiments.compute.VirtualMachine -import java.util.* +import java.util.Random /** * A [ComputeWorkload] that samples multiple workloads based on the total load of all workloads. diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/internal/HpcSampledComputeWorkload.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/internal/HpcSampledComputeWorkload.kt index 23efb154..a6055762 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/internal/HpcSampledComputeWorkload.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/internal/HpcSampledComputeWorkload.kt @@ -26,7 +26,8 @@ import mu.KotlinLogging import org.opendc.experiments.compute.ComputeWorkload import org.opendc.experiments.compute.ComputeWorkloadLoader import org.opendc.experiments.compute.VirtualMachine -import java.util.* +import java.util.Random +import java.util.UUID /** * A [ComputeWorkload] that samples HPC VMs in the workload. diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/internal/LoadSampledComputeWorkload.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/internal/LoadSampledComputeWorkload.kt index 4663c59e..793f1de9 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/internal/LoadSampledComputeWorkload.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/internal/LoadSampledComputeWorkload.kt @@ -26,7 +26,7 @@ import mu.KotlinLogging import org.opendc.experiments.compute.ComputeWorkload import org.opendc.experiments.compute.ComputeWorkloadLoader import org.opendc.experiments.compute.VirtualMachine -import java.util.* +import java.util.Random /** * A [ComputeWorkload] that is sampled based on total load. diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/internal/TraceComputeWorkload.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/internal/TraceComputeWorkload.kt index 1cfee3bd..b4e9005f 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/internal/TraceComputeWorkload.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/internal/TraceComputeWorkload.kt @@ -25,7 +25,7 @@ package org.opendc.experiments.compute.internal import org.opendc.experiments.compute.ComputeWorkload import org.opendc.experiments.compute.ComputeWorkloadLoader import org.opendc.experiments.compute.VirtualMachine -import java.util.* +import java.util.Random /** * A [ComputeWorkload] from a trace. diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/telemetry/ComputeMetricReader.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/telemetry/ComputeMetricReader.kt index 088f98e9..7e89eab1 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/telemetry/ComputeMetricReader.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/telemetry/ComputeMetricReader.kt @@ -30,7 +30,11 @@ import mu.KotlinLogging import org.opendc.compute.api.Server import org.opendc.compute.service.ComputeService import org.opendc.compute.service.driver.Host -import org.opendc.experiments.compute.telemetry.table.* +import org.opendc.experiments.compute.telemetry.table.HostInfo +import org.opendc.experiments.compute.telemetry.table.HostTableReader +import org.opendc.experiments.compute.telemetry.table.ServerInfo +import org.opendc.experiments.compute.telemetry.table.ServerTableReader +import org.opendc.experiments.compute.telemetry.table.ServiceTableReader import java.time.Clock import java.time.Duration import java.time.Instant diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/topology/HostSpec.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/topology/HostSpec.kt index 8ade963a..b5dbaaeb 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/topology/HostSpec.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/topology/HostSpec.kt @@ -27,7 +27,7 @@ import org.opendc.simulator.compute.power.LinearPowerModel import org.opendc.simulator.compute.power.PowerDriver import org.opendc.simulator.compute.power.SimplePowerDriver import org.opendc.simulator.flow.mux.FlowMultiplexerFactory -import java.util.* +import java.util.UUID /** * Description of a physical host that will be simulated by OpenDC and host the virtual machines. diff --git a/opendc-experiments/opendc-experiments-faas/src/main/kotlin/org/opendc/experiments/faas/FaaSServiceProvisioningStep.kt b/opendc-experiments/opendc-experiments-faas/src/main/kotlin/org/opendc/experiments/faas/FaaSServiceProvisioningStep.kt index d977042e..301ea8c3 100644 --- a/opendc-experiments/opendc-experiments-faas/src/main/kotlin/org/opendc/experiments/faas/FaaSServiceProvisioningStep.kt +++ b/opendc-experiments/opendc-experiments-faas/src/main/kotlin/org/opendc/experiments/faas/FaaSServiceProvisioningStep.kt @@ -32,7 +32,7 @@ import org.opendc.faas.simulator.delay.ColdStartModel import org.opendc.faas.simulator.delay.StochasticDelayInjector import org.opendc.faas.simulator.delay.ZeroDelayInjector import org.opendc.simulator.compute.model.MachineModel -import java.util.* +import java.util.Random /** * A [ProvisioningStep] implementation for a [FaaSService]. diff --git a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt index 2c79da02..9b50758b 100644 --- a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt +++ b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt @@ -22,7 +22,12 @@ package org.opendc.experiments.tf20.core -import kotlinx.coroutines.* +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Job +import kotlinx.coroutines.cancel +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import kotlinx.coroutines.suspendCancellableCoroutine import org.opendc.simulator.compute.SimBareMetalMachine import org.opendc.simulator.compute.SimMachine import org.opendc.simulator.compute.SimMachineContext @@ -33,9 +38,12 @@ import org.opendc.simulator.compute.power.PowerModel import org.opendc.simulator.compute.power.SimplePowerDriver import org.opendc.simulator.compute.runWorkload import org.opendc.simulator.compute.workload.SimWorkload -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConnection +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowSource import java.time.Clock -import java.util.* +import java.util.ArrayDeque +import java.util.UUID import kotlin.coroutines.Continuation import kotlin.coroutines.CoroutineContext import kotlin.coroutines.resume diff --git a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/TFDevice.kt b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/TFDevice.kt index 839ed8a9..2d23f5b3 100644 --- a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/TFDevice.kt +++ b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/TFDevice.kt @@ -22,7 +22,7 @@ package org.opendc.experiments.tf20.core -import java.util.* +import java.util.UUID /** * A compute device on which tensor operations are performed. diff --git a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/util/MLEnvironmentReader.kt b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/util/MLEnvironmentReader.kt index 3cdf28fd..4913c019 100644 --- a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/util/MLEnvironmentReader.kt +++ b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/util/MLEnvironmentReader.kt @@ -31,7 +31,7 @@ import org.opendc.simulator.compute.model.ProcessingNode import org.opendc.simulator.compute.model.ProcessingUnit import org.opendc.simulator.compute.power.LinearPowerModel import java.io.InputStream -import java.util.* +import java.util.UUID /** * An environment reader for the TensorFlow experiments. diff --git a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/util/MachineDef.kt b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/util/MachineDef.kt index 271f5923..63f00d53 100644 --- a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/util/MachineDef.kt +++ b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/util/MachineDef.kt @@ -24,7 +24,7 @@ package org.opendc.experiments.tf20.util import org.opendc.simulator.compute.model.MachineModel import org.opendc.simulator.compute.power.PowerModel -import java.util.* +import java.util.UUID /** * A definition of a machine in a cluster. diff --git a/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/TensorFlowTest.kt b/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/TensorFlowTest.kt index eee8b730..f5d35fa4 100644 --- a/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/TensorFlowTest.kt +++ b/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/TensorFlowTest.kt @@ -31,7 +31,7 @@ import org.opendc.experiments.tf20.distribute.OneDeviceStrategy import org.opendc.experiments.tf20.util.MLEnvironmentReader import org.opendc.simulator.compute.power.LinearPowerModel import org.opendc.simulator.kotlin.runSimulation -import java.util.* +import java.util.UUID /** * Integration test suite for the TensorFlow application model in OpenDC. diff --git a/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/core/SimTFDeviceTest.kt b/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/core/SimTFDeviceTest.kt index 966ca5ef..85d63e9b 100644 --- a/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/core/SimTFDeviceTest.kt +++ b/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/core/SimTFDeviceTest.kt @@ -32,7 +32,7 @@ import org.opendc.simulator.compute.model.ProcessingNode import org.opendc.simulator.compute.model.ProcessingUnit import org.opendc.simulator.compute.power.LinearPowerModel import org.opendc.simulator.kotlin.runSimulation -import java.util.* +import java.util.UUID /** * Test suite for the [SimTFDevice] class. diff --git a/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt b/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt index a15d3d5b..d1009d44 100644 --- a/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt +++ b/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt @@ -27,15 +27,22 @@ import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.delay import kotlinx.coroutines.launch import org.opendc.simulator.compute.workload.SimFlopsWorkload -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.Trace +import org.opendc.trace.conv.TABLE_TASKS +import org.opendc.trace.conv.TASK_ALLOC_NCPUS +import org.opendc.trace.conv.TASK_ID +import org.opendc.trace.conv.TASK_PARENTS +import org.opendc.trace.conv.TASK_REQ_NCPUS +import org.opendc.trace.conv.TASK_RUNTIME +import org.opendc.trace.conv.TASK_SUBMIT_TIME +import org.opendc.trace.conv.TASK_WORKFLOW_ID import org.opendc.workflow.api.Job import org.opendc.workflow.api.Task import org.opendc.workflow.api.WORKFLOW_TASK_CORES import org.opendc.workflow.api.WORKFLOW_TASK_DEADLINE import org.opendc.workflow.service.WorkflowService import java.time.Clock -import java.util.* +import java.util.UUID import kotlin.collections.HashMap import kotlin.collections.HashSet import kotlin.math.min diff --git a/opendc-faas/opendc-faas-api/src/main/kotlin/org/opendc/faas/api/FaaSClient.kt b/opendc-faas/opendc-faas-api/src/main/kotlin/org/opendc/faas/api/FaaSClient.kt index ebda4f90..d3abb7f1 100644 --- a/opendc-faas/opendc-faas-api/src/main/kotlin/org/opendc/faas/api/FaaSClient.kt +++ b/opendc-faas/opendc-faas-api/src/main/kotlin/org/opendc/faas/api/FaaSClient.kt @@ -22,7 +22,7 @@ package org.opendc.faas.api -import java.util.* +import java.util.UUID /** * Client interface to the OpenDC FaaS platform. diff --git a/opendc-faas/opendc-faas-service/src/main/kotlin/org/opendc/faas/service/FunctionObject.kt b/opendc-faas/opendc-faas-service/src/main/kotlin/org/opendc/faas/service/FunctionObject.kt index d953f737..091e82a8 100644 --- a/opendc-faas/opendc-faas-service/src/main/kotlin/org/opendc/faas/service/FunctionObject.kt +++ b/opendc-faas/opendc-faas-service/src/main/kotlin/org/opendc/faas/service/FunctionObject.kt @@ -25,7 +25,7 @@ package org.opendc.faas.service import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics import org.opendc.faas.service.deployer.FunctionInstance import org.opendc.faas.service.telemetry.FunctionStats -import java.util.* +import java.util.UUID /** * An [FunctionObject] represents the service's view of a serverless function. diff --git a/opendc-faas/opendc-faas-service/src/main/kotlin/org/opendc/faas/service/internal/FaaSFunctionImpl.kt b/opendc-faas/opendc-faas-service/src/main/kotlin/org/opendc/faas/service/internal/FaaSFunctionImpl.kt index bd7f13f6..36532aa8 100644 --- a/opendc-faas/opendc-faas-service/src/main/kotlin/org/opendc/faas/service/internal/FaaSFunctionImpl.kt +++ b/opendc-faas/opendc-faas-service/src/main/kotlin/org/opendc/faas/service/internal/FaaSFunctionImpl.kt @@ -24,7 +24,7 @@ package org.opendc.faas.service.internal import org.opendc.faas.api.FaaSFunction import org.opendc.faas.service.FunctionObject -import java.util.* +import java.util.UUID /** * A [FaaSFunction] implementation that is passed to clients. diff --git a/opendc-faas/opendc-faas-service/src/main/kotlin/org/opendc/faas/service/internal/FaaSServiceImpl.kt b/opendc-faas/opendc-faas-service/src/main/kotlin/org/opendc/faas/service/internal/FaaSServiceImpl.kt index 4ee55dea..901213af 100644 --- a/opendc-faas/opendc-faas-service/src/main/kotlin/org/opendc/faas/service/internal/FaaSServiceImpl.kt +++ b/opendc-faas/opendc-faas-service/src/main/kotlin/org/opendc/faas/service/internal/FaaSServiceImpl.kt @@ -22,8 +22,12 @@ package org.opendc.faas.service.internal -import kotlinx.coroutines.* +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.InternalCoroutinesApi +import kotlinx.coroutines.Job +import kotlinx.coroutines.cancel import kotlinx.coroutines.intrinsics.startCoroutineCancellable +import kotlinx.coroutines.suspendCancellableCoroutine import mu.KotlinLogging import org.opendc.common.util.Pacer import org.opendc.faas.api.FaaSClient @@ -41,7 +45,9 @@ import org.opendc.faas.service.telemetry.SchedulerStats import java.lang.IllegalStateException import java.time.Clock import java.time.Duration -import java.util.* +import java.util.ArrayDeque +import java.util.Random +import java.util.UUID import kotlin.coroutines.Continuation import kotlin.coroutines.CoroutineContext import kotlin.coroutines.resumeWithException diff --git a/opendc-faas/opendc-faas-service/src/test/kotlin/org/opendc/faas/service/FaaSServiceTest.kt b/opendc-faas/opendc-faas-service/src/test/kotlin/org/opendc/faas/service/FaaSServiceTest.kt index 28234cf4..97ffc5a5 100644 --- a/opendc-faas/opendc-faas-service/src/test/kotlin/org/opendc/faas/service/FaaSServiceTest.kt +++ b/opendc-faas/opendc-faas-service/src/test/kotlin/org/opendc/faas/service/FaaSServiceTest.kt @@ -22,8 +22,11 @@ package org.opendc.faas.service -import io.mockk.* -import org.junit.jupiter.api.Assertions.* +import io.mockk.every +import io.mockk.mockk +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertNotNull +import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertThrows @@ -32,7 +35,7 @@ import org.opendc.faas.service.deployer.FunctionDeployer import org.opendc.faas.service.deployer.FunctionInstance import org.opendc.faas.service.deployer.FunctionInstanceState import org.opendc.simulator.kotlin.runSimulation -import java.util.* +import java.util.UUID /** * Test suite for the [FaaSService] implementation. diff --git a/opendc-faas/opendc-faas-simulator/src/main/kotlin/org/opendc/faas/simulator/SimFunctionDeployer.kt b/opendc-faas/opendc-faas-simulator/src/main/kotlin/org/opendc/faas/simulator/SimFunctionDeployer.kt index 22131b13..eba90cce 100644 --- a/opendc-faas/opendc-faas-simulator/src/main/kotlin/org/opendc/faas/simulator/SimFunctionDeployer.kt +++ b/opendc-faas/opendc-faas-simulator/src/main/kotlin/org/opendc/faas/simulator/SimFunctionDeployer.kt @@ -22,8 +22,15 @@ package org.opendc.faas.simulator -import kotlinx.coroutines.* +import kotlinx.coroutines.CancellationException +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Job +import kotlinx.coroutines.cancel import kotlinx.coroutines.channels.Channel +import kotlinx.coroutines.delay +import kotlinx.coroutines.isActive +import kotlinx.coroutines.launch +import kotlinx.coroutines.suspendCancellableCoroutine import org.opendc.faas.service.FunctionObject import org.opendc.faas.service.deployer.FunctionDeployer import org.opendc.faas.service.deployer.FunctionInstance diff --git a/opendc-faas/opendc-faas-simulator/src/main/kotlin/org/opendc/faas/simulator/delay/StochasticDelayInjector.kt b/opendc-faas/opendc-faas-simulator/src/main/kotlin/org/opendc/faas/simulator/delay/StochasticDelayInjector.kt index 9442e2d3..d3b31bb9 100644 --- a/opendc-faas/opendc-faas-simulator/src/main/kotlin/org/opendc/faas/simulator/delay/StochasticDelayInjector.kt +++ b/opendc-faas/opendc-faas-simulator/src/main/kotlin/org/opendc/faas/simulator/delay/StochasticDelayInjector.kt @@ -23,7 +23,7 @@ package org.opendc.faas.simulator.delay import org.opendc.faas.service.deployer.FunctionInstance -import java.util.* +import java.util.Random import kotlin.math.abs /* diff --git a/opendc-faas/opendc-faas-simulator/src/test/kotlin/org/opendc/faas/simulator/SimFaaSServiceTest.kt b/opendc-faas/opendc-faas-simulator/src/test/kotlin/org/opendc/faas/simulator/SimFaaSServiceTest.kt index 317eb0aa..6513296d 100644 --- a/opendc-faas/opendc-faas-simulator/src/test/kotlin/org/opendc/faas/simulator/SimFaaSServiceTest.kt +++ b/opendc-faas/opendc-faas-simulator/src/test/kotlin/org/opendc/faas/simulator/SimFaaSServiceTest.kt @@ -44,7 +44,7 @@ import org.opendc.simulator.compute.workload.SimRuntimeWorkload import org.opendc.simulator.compute.workload.SimWorkload import org.opendc.simulator.kotlin.runSimulation import java.time.Duration -import java.util.* +import java.util.Random /** * A test suite for the [FaaSService] implementation under simulated conditions. diff --git a/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt b/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt index b319a677..651c3b63 100644 --- a/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt +++ b/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt @@ -36,7 +36,13 @@ import org.opendc.simulator.compute.workload.SimTraceWorkload import org.opendc.simulator.flow.FlowEngine import org.opendc.simulator.flow.mux.FlowMultiplexerFactory import org.opendc.simulator.kotlin.runSimulation -import org.openjdk.jmh.annotations.* +import org.openjdk.jmh.annotations.Benchmark +import org.openjdk.jmh.annotations.Fork +import org.openjdk.jmh.annotations.Measurement +import org.openjdk.jmh.annotations.Scope +import org.openjdk.jmh.annotations.Setup +import org.openjdk.jmh.annotations.State +import org.openjdk.jmh.annotations.Warmup import java.util.SplittableRandom import java.util.concurrent.ThreadLocalRandom import java.util.concurrent.TimeUnit 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 ef0cd323..71784567 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 @@ -30,7 +30,13 @@ import org.opendc.simulator.compute.model.MemoryUnit import org.opendc.simulator.compute.model.NetworkAdapter import org.opendc.simulator.compute.model.StorageDevice import org.opendc.simulator.compute.workload.SimWorkload -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowConvergenceListener +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowForwarder +import org.opendc.simulator.flow.FlowSink +import org.opendc.simulator.flow.FlowSource +import org.opendc.simulator.flow.batch /** * Abstract implementation of the [SimMachine] interface. diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt index 0df897b6..ee56c8c8 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt @@ -26,8 +26,9 @@ import org.opendc.simulator.compute.device.SimPsu import org.opendc.simulator.compute.model.MachineModel import org.opendc.simulator.compute.model.ProcessingUnit import org.opendc.simulator.compute.power.PowerDriver -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConsumer import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowSink import kotlin.math.max /** diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt index caff4dc3..243790b9 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt @@ -26,7 +26,7 @@ import org.opendc.simulator.compute.power.PowerDriver import org.opendc.simulator.flow.FlowConnection import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.power.SimPowerInlet -import java.util.* +import java.util.TreeMap /** * A power supply of a [SimBareMetalMachine]. diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt index 7594bf4d..20d946a4 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt @@ -22,7 +22,10 @@ package org.opendc.simulator.compute.kernel -import org.opendc.simulator.compute.* +import org.opendc.simulator.compute.SimAbstractMachine +import org.opendc.simulator.compute.SimMachine +import org.opendc.simulator.compute.SimMachineContext +import org.opendc.simulator.compute.SimProcessingUnit import org.opendc.simulator.compute.kernel.cpufreq.ScalingGovernor import org.opendc.simulator.compute.kernel.cpufreq.ScalingPolicy import org.opendc.simulator.compute.kernel.interference.VmInterferenceDomain @@ -31,7 +34,9 @@ import org.opendc.simulator.compute.kernel.interference.VmInterferenceProfile import org.opendc.simulator.compute.model.MachineModel import org.opendc.simulator.compute.model.ProcessingUnit import org.opendc.simulator.compute.workload.SimWorkload -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowConvergenceListener +import org.opendc.simulator.flow.FlowEngine import org.opendc.simulator.flow.mux.FlowMultiplexer import org.opendc.simulator.flow.mux.FlowMultiplexerFactory import java.util.SplittableRandom diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceMember.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceMember.kt index 762bb568..4b56a058 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceMember.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceMember.kt @@ -22,7 +22,7 @@ package org.opendc.simulator.compute.kernel.interference -import java.util.* +import java.util.SplittableRandom /** * A participant of an interference domain. diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt index 018c6e3d..36fad4c3 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt @@ -22,7 +22,8 @@ package org.opendc.simulator.compute.kernel.interference -import java.util.* +import java.util.TreeMap +import java.util.TreeSet /** * An interference model that models the resource interference between virtual machines on a host. diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/PStatePowerDriver.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/PStatePowerDriver.kt index f71446f8..ce7225d2 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/PStatePowerDriver.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/PStatePowerDriver.kt @@ -24,7 +24,7 @@ package org.opendc.simulator.compute.power import org.opendc.simulator.compute.SimMachine import org.opendc.simulator.compute.SimProcessingUnit -import java.util.* +import java.util.TreeMap import kotlin.math.max import kotlin.math.min diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt index b7af6803..1eddf82c 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt @@ -22,11 +22,22 @@ package org.opendc.simulator.compute -import kotlinx.coroutines.* -import org.junit.jupiter.api.* +import kotlinx.coroutines.CancellationException +import kotlinx.coroutines.cancel +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.launch +import org.junit.jupiter.api.Assertions.assertAll import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import org.opendc.simulator.compute.device.SimNetworkAdapter -import org.opendc.simulator.compute.model.* +import org.opendc.simulator.compute.model.MachineModel +import org.opendc.simulator.compute.model.MemoryUnit +import org.opendc.simulator.compute.model.NetworkAdapter +import org.opendc.simulator.compute.model.ProcessingNode +import org.opendc.simulator.compute.model.ProcessingUnit +import org.opendc.simulator.compute.model.StorageDevice import org.opendc.simulator.compute.power.ConstantPowerModel import org.opendc.simulator.compute.power.LinearPowerModel import org.opendc.simulator.compute.power.SimplePowerDriver diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt index aae8d139..9ff492cc 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt @@ -22,7 +22,9 @@ package org.opendc.simulator.compute.kernel -import kotlinx.coroutines.* +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.launch +import kotlinx.coroutines.yield import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @@ -44,7 +46,7 @@ import org.opendc.simulator.compute.workload.SimTraceWorkload import org.opendc.simulator.flow.FlowEngine import org.opendc.simulator.flow.mux.FlowMultiplexerFactory import org.opendc.simulator.kotlin.runSimulation -import java.util.* +import java.util.SplittableRandom /** * Test suite for the [SimHypervisor] class. diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt index 664bb2da..7a8da325 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt @@ -24,7 +24,11 @@ package org.opendc.simulator.compute.kernel import kotlinx.coroutines.launch import kotlinx.coroutines.yield -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertDoesNotThrow +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -36,11 +40,15 @@ import org.opendc.simulator.compute.model.ProcessingUnit import org.opendc.simulator.compute.power.ConstantPowerModel import org.opendc.simulator.compute.power.SimplePowerDriver import org.opendc.simulator.compute.runWorkload -import org.opendc.simulator.compute.workload.* +import org.opendc.simulator.compute.workload.SimFlopsWorkload +import org.opendc.simulator.compute.workload.SimRuntimeWorkload +import org.opendc.simulator.compute.workload.SimTrace +import org.opendc.simulator.compute.workload.SimTraceFragment +import org.opendc.simulator.compute.workload.SimTraceWorkload import org.opendc.simulator.flow.FlowEngine import org.opendc.simulator.flow.mux.FlowMultiplexerFactory import org.opendc.simulator.kotlin.runSimulation -import java.util.* +import java.util.SplittableRandom /** * A test suite for a space-shared [SimHypervisor]. diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkloadTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkloadTest.kt index 70aea3f4..83e1f81c 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkloadTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkloadTest.kt @@ -27,7 +27,10 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.opendc.simulator.compute.SimBareMetalMachine -import org.opendc.simulator.compute.model.* +import org.opendc.simulator.compute.model.MachineModel +import org.opendc.simulator.compute.model.MemoryUnit +import org.opendc.simulator.compute.model.ProcessingNode +import org.opendc.simulator.compute.model.ProcessingUnit import org.opendc.simulator.compute.power.ConstantPowerModel import org.opendc.simulator.compute.power.SimplePowerDriver import org.opendc.simulator.compute.runWorkload diff --git a/opendc-simulator/opendc-simulator-core/src/main/kotlin/org/opendc/simulator/kotlin/SimulationBuilders.kt b/opendc-simulator/opendc-simulator-core/src/main/kotlin/org/opendc/simulator/kotlin/SimulationBuilders.kt index c4cc0171..882a0fc5 100644 --- a/opendc-simulator/opendc-simulator-core/src/main/kotlin/org/opendc/simulator/kotlin/SimulationBuilders.kt +++ b/opendc-simulator/opendc-simulator-core/src/main/kotlin/org/opendc/simulator/kotlin/SimulationBuilders.kt @@ -22,7 +22,10 @@ package org.opendc.simulator.kotlin -import kotlinx.coroutines.* +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.Job +import kotlinx.coroutines.SupervisorJob +import kotlinx.coroutines.async import org.opendc.simulator.SimulationScheduler import kotlin.coroutines.ContinuationInterceptor import kotlin.coroutines.CoroutineContext diff --git a/opendc-simulator/opendc-simulator-core/src/main/kotlin/org/opendc/simulator/kotlin/SimulationCoroutineDispatcher.kt b/opendc-simulator/opendc-simulator-core/src/main/kotlin/org/opendc/simulator/kotlin/SimulationCoroutineDispatcher.kt index 21ad1a86..cacbbbf7 100644 --- a/opendc-simulator/opendc-simulator-core/src/main/kotlin/org/opendc/simulator/kotlin/SimulationCoroutineDispatcher.kt +++ b/opendc-simulator/opendc-simulator-core/src/main/kotlin/org/opendc/simulator/kotlin/SimulationCoroutineDispatcher.kt @@ -22,11 +22,15 @@ package org.opendc.simulator.kotlin -import kotlinx.coroutines.* +import kotlinx.coroutines.CancellableContinuation +import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.Delay +import kotlinx.coroutines.DisposableHandle +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.InternalCoroutinesApi import org.opendc.simulator.SimulationScheduler import java.lang.Runnable import java.time.Clock -import java.util.* import kotlin.coroutines.CoroutineContext /** diff --git a/opendc-simulator/opendc-simulator-core/src/test/kotlin/org/opendc/simulator/TaskQueueTest.kt b/opendc-simulator/opendc-simulator-core/src/test/kotlin/org/opendc/simulator/TaskQueueTest.kt index a4d779cb..f1559ce3 100644 --- a/opendc-simulator/opendc-simulator-core/src/test/kotlin/org/opendc/simulator/TaskQueueTest.kt +++ b/opendc-simulator/opendc-simulator-core/src/test/kotlin/org/opendc/simulator/TaskQueueTest.kt @@ -22,7 +22,10 @@ package org.opendc.simulator -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test diff --git a/opendc-simulator/opendc-simulator-flow/src/jmh/kotlin/org/opendc/simulator/flow/FlowBenchmarks.kt b/opendc-simulator/opendc-simulator-flow/src/jmh/kotlin/org/opendc/simulator/flow/FlowBenchmarks.kt index 86fbe8e4..58f84d82 100644 --- a/opendc-simulator/opendc-simulator-flow/src/jmh/kotlin/org/opendc/simulator/flow/FlowBenchmarks.kt +++ b/opendc-simulator/opendc-simulator-flow/src/jmh/kotlin/org/opendc/simulator/flow/FlowBenchmarks.kt @@ -22,13 +22,18 @@ package org.opendc.simulator.flow -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.launch import org.opendc.simulator.flow.mux.ForwardingFlowMultiplexer import org.opendc.simulator.flow.mux.MaxMinFlowMultiplexer import org.opendc.simulator.flow.source.TraceFlowSource import org.opendc.simulator.kotlin.runSimulation -import org.openjdk.jmh.annotations.* +import org.openjdk.jmh.annotations.Benchmark +import org.openjdk.jmh.annotations.Fork +import org.openjdk.jmh.annotations.Measurement +import org.openjdk.jmh.annotations.Scope +import org.openjdk.jmh.annotations.Setup +import org.openjdk.jmh.annotations.State +import org.openjdk.jmh.annotations.Warmup import java.util.concurrent.ThreadLocalRandom import java.util.concurrent.TimeUnit @@ -36,7 +41,6 @@ import java.util.concurrent.TimeUnit @Fork(1) @Warmup(iterations = 2, time = 1, timeUnit = TimeUnit.SECONDS) @Measurement(iterations = 5, time = 3, timeUnit = TimeUnit.SECONDS) -@OptIn(ExperimentalCoroutinesApi::class) class FlowBenchmarks { private lateinit var trace: Sequence diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt index bc6bae71..393a2635 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt @@ -23,8 +23,11 @@ package org.opendc.simulator.flow.internal import mu.KotlinLogging -import org.opendc.simulator.flow.* -import java.util.* +import org.opendc.simulator.flow.FlowConsumerContext +import org.opendc.simulator.flow.FlowConsumerLogic +import org.opendc.simulator.flow.FlowSource +import org.opendc.simulator.flow.batch +import java.util.ArrayDeque import kotlin.math.min /** diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowDeque.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowDeque.kt index 94232954..403a9aec 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowDeque.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowDeque.kt @@ -22,7 +22,7 @@ package org.opendc.simulator.flow.internal -import java.util.* +import java.util.ArrayDeque /** * A specialized [ArrayDeque] that tracks the [FlowConsumerContextImpl] instances that have updated in an interpreter diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowEngineImpl.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowEngineImpl.kt index 3c79d54e..6fd1ef31 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowEngineImpl.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowEngineImpl.kt @@ -26,9 +26,12 @@ import kotlinx.coroutines.Delay import kotlinx.coroutines.DisposableHandle import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.Runnable -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConsumerContext +import org.opendc.simulator.flow.FlowConsumerLogic +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowSource import java.time.Clock -import java.util.* +import java.util.ArrayDeque import kotlin.coroutines.ContinuationInterceptor import kotlin.coroutines.CoroutineContext diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexer.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexer.kt index c50e9bbc..53f94a94 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexer.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexer.kt @@ -22,7 +22,13 @@ package org.opendc.simulator.flow.mux -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConnection +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowConvergenceListener +import org.opendc.simulator.flow.FlowCounters +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowForwarder +import org.opendc.simulator.flow.FlowSource import java.util.ArrayDeque /** diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt index f2a4c1a4..a52a5b0e 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt @@ -22,7 +22,14 @@ package org.opendc.simulator.flow.mux -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConnection +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowConsumerContext +import org.opendc.simulator.flow.FlowConsumerLogic +import org.opendc.simulator.flow.FlowConvergenceListener +import org.opendc.simulator.flow.FlowCounters +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.flow.internal.D_MS_TO_S import org.opendc.simulator.flow.internal.MutableFlowCounters import kotlin.math.min diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt index d782d036..f89133dd 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt @@ -22,8 +22,11 @@ package org.opendc.simulator.flow -import io.mockk.* -import org.junit.jupiter.api.* +import io.mockk.spyk +import io.mockk.verify +import net.bytebuddy.matcher.ElementMatchers.any +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import org.opendc.simulator.flow.internal.FlowConsumerContextImpl import org.opendc.simulator.flow.internal.FlowEngineImpl import org.opendc.simulator.kotlin.runSimulation diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt index 2025dd52..f75e5037 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt @@ -22,9 +22,17 @@ package org.opendc.simulator.flow -import io.mockk.* -import kotlinx.coroutines.* -import org.junit.jupiter.api.Assertions.* +import io.mockk.spyk +import io.mockk.verify +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import kotlinx.coroutines.yield +import net.bytebuddy.matcher.ElementMatchers.any +import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt index 22a84edb..746d752d 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt @@ -24,9 +24,13 @@ package org.opendc.simulator.flow import io.mockk.spyk import io.mockk.verify -import kotlinx.coroutines.* -import org.junit.jupiter.api.* +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import kotlinx.coroutines.yield import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import org.opendc.simulator.flow.internal.FlowEngineImpl import org.opendc.simulator.flow.source.FixedFlowSource import org.opendc.simulator.flow.source.FlowSourceRateAdapter diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt index cfd2bdf0..1a71580b 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt @@ -27,7 +27,11 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertAll import org.junit.jupiter.api.assertThrows -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConnection +import org.opendc.simulator.flow.FlowForwarder +import org.opendc.simulator.flow.FlowSink +import org.opendc.simulator.flow.FlowSource +import org.opendc.simulator.flow.consume import org.opendc.simulator.flow.internal.FlowEngineImpl import org.opendc.simulator.flow.source.FixedFlowSource import org.opendc.simulator.flow.source.FlowSourceRateAdapter diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt index 4e242292..34198f17 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt @@ -25,8 +25,9 @@ package org.opendc.simulator.flow.mux import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.launch import kotlinx.coroutines.yield -import org.junit.jupiter.api.* +import org.junit.jupiter.api.Assertions.assertAll import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Test import org.opendc.simulator.flow.FlowSink import org.opendc.simulator.flow.consume import org.opendc.simulator.flow.internal.FlowEngineImpl diff --git a/opendc-simulator/opendc-simulator-network/src/main/kotlin/org/opendc/simulator/network/SimNetworkSink.kt b/opendc-simulator/opendc-simulator-network/src/main/kotlin/org/opendc/simulator/network/SimNetworkSink.kt index 675ac1c3..684b4a14 100644 --- a/opendc-simulator/opendc-simulator-network/src/main/kotlin/org/opendc/simulator/network/SimNetworkSink.kt +++ b/opendc-simulator/opendc-simulator-network/src/main/kotlin/org/opendc/simulator/network/SimNetworkSink.kt @@ -22,7 +22,11 @@ package org.opendc.simulator.network -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConnection +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowSink +import org.opendc.simulator.flow.FlowSource /** * A network sink which discards all received traffic and does not generate any traffic itself. diff --git a/opendc-simulator/opendc-simulator-network/src/main/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtual.kt b/opendc-simulator/opendc-simulator-network/src/main/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtual.kt index 6667c80c..c59c44f1 100644 --- a/opendc-simulator/opendc-simulator-network/src/main/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtual.kt +++ b/opendc-simulator/opendc-simulator-network/src/main/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtual.kt @@ -22,7 +22,9 @@ package org.opendc.simulator.network -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.flow.mux.MaxMinFlowMultiplexer /** diff --git a/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkLinkTest.kt b/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkLinkTest.kt index 3480c9df..9863507d 100644 --- a/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkLinkTest.kt +++ b/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkLinkTest.kt @@ -23,7 +23,9 @@ package org.opendc.simulator.network import io.mockk.mockk -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows diff --git a/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSinkTest.kt b/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSinkTest.kt index 944c4d6a..78bd533d 100644 --- a/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSinkTest.kt +++ b/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSinkTest.kt @@ -26,11 +26,17 @@ import io.mockk.every import io.mockk.mockk import io.mockk.spyk import io.mockk.verify -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertNull +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertThrows -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowSink +import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.flow.source.FixedFlowSource import org.opendc.simulator.kotlin.runSimulation diff --git a/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtualTest.kt b/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtualTest.kt index ff6cb66e..ecf80818 100644 --- a/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtualTest.kt +++ b/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtualTest.kt @@ -27,7 +27,10 @@ import io.mockk.verify import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowSink +import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.flow.source.FixedFlowSource import org.opendc.simulator.kotlin.runSimulation diff --git a/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimPdu.kt b/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimPdu.kt index 9f88fecc..69ac97ab 100644 --- a/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimPdu.kt +++ b/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimPdu.kt @@ -22,7 +22,10 @@ package org.opendc.simulator.power -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowMapper +import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.flow.mux.FlowMultiplexer import org.opendc.simulator.flow.mux.MaxMinFlowMultiplexer diff --git a/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimUps.kt b/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimUps.kt index 46d659f8..00b2926e 100644 --- a/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimUps.kt +++ b/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimUps.kt @@ -22,7 +22,10 @@ package org.opendc.simulator.power -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowForwarder +import org.opendc.simulator.flow.FlowMapper +import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.flow.mux.MaxMinFlowMultiplexer /** diff --git a/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPowerSourceTest.kt b/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPowerSourceTest.kt index b83b6ba7..963ba710 100644 --- a/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPowerSourceTest.kt +++ b/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPowerSourceTest.kt @@ -26,7 +26,10 @@ import io.mockk.every import io.mockk.mockk import io.mockk.spyk import io.mockk.verify -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertNull +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertThrows diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableWriter.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableWriter.kt index a3122ec9..3b02794d 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableWriter.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/TableWriter.kt @@ -24,7 +24,7 @@ package org.opendc.trace import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID /** * Base class for writing workload traces. diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/internal/TableImpl.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/internal/TableImpl.kt index 1e1bf676..099c1939 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/internal/TableImpl.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/internal/TableImpl.kt @@ -26,7 +26,7 @@ import org.opendc.trace.Table import org.opendc.trace.TableColumn import org.opendc.trace.TableReader import org.opendc.trace.TableWriter -import java.util.* +import java.util.Objects /** * Internal implementation of [Table]. diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/internal/TraceImpl.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/internal/TraceImpl.kt index fd9536ab..8f9752ae 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/internal/TraceImpl.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/internal/TraceImpl.kt @@ -26,7 +26,7 @@ import org.opendc.trace.Table import org.opendc.trace.Trace import org.opendc.trace.spi.TraceFormat import java.nio.file.Path -import java.util.* +import java.util.Objects import java.util.concurrent.ConcurrentHashMap /** diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/spi/TraceFormat.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/spi/TraceFormat.kt index 26e81cf8..46ef051d 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/spi/TraceFormat.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/spi/TraceFormat.kt @@ -25,7 +25,7 @@ package org.opendc.trace.spi import org.opendc.trace.TableReader import org.opendc.trace.TableWriter import java.nio.file.Path -import java.util.* +import java.util.ServiceLoader /** * A service-provider class for parsing trace formats. diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/util/CompositeTableReader.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/util/CompositeTableReader.kt index c4854265..2fe820c4 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/util/CompositeTableReader.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/util/CompositeTableReader.kt @@ -25,7 +25,7 @@ package org.opendc.trace.util import org.opendc.trace.TableReader import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID /** * A helper class to chain multiple [TableReader]s. diff --git a/opendc-trace/opendc-trace-azure/src/jmh/kotlin/org/opendc/trace/azure/AzureTraceBenchmarks.kt b/opendc-trace/opendc-trace-azure/src/jmh/kotlin/org/opendc/trace/azure/AzureTraceBenchmarks.kt index 4fcdce30..6759f38a 100644 --- a/opendc-trace/opendc-trace-azure/src/jmh/kotlin/org/opendc/trace/azure/AzureTraceBenchmarks.kt +++ b/opendc-trace/opendc-trace-azure/src/jmh/kotlin/org/opendc/trace/azure/AzureTraceBenchmarks.kt @@ -22,9 +22,17 @@ package org.opendc.trace.azure -import org.opendc.trace.conv.* +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.TABLE_RESOURCES +import org.opendc.trace.conv.TABLE_RESOURCE_STATES import org.opendc.trace.spi.TraceFormat -import org.openjdk.jmh.annotations.* +import org.openjdk.jmh.annotations.Benchmark +import org.openjdk.jmh.annotations.Fork +import org.openjdk.jmh.annotations.Measurement +import org.openjdk.jmh.annotations.Scope +import org.openjdk.jmh.annotations.Setup +import org.openjdk.jmh.annotations.State +import org.openjdk.jmh.annotations.Warmup import org.openjdk.jmh.infra.Blackhole import java.nio.file.Path import java.util.concurrent.TimeUnit diff --git a/opendc-trace/opendc-trace-azure/src/main/kotlin/org/opendc/trace/azure/AzureResourceStateTableReader.kt b/opendc-trace/opendc-trace-azure/src/main/kotlin/org/opendc/trace/azure/AzureResourceStateTableReader.kt index c0c67329..0c60c75d 100644 --- a/opendc-trace/opendc-trace-azure/src/main/kotlin/org/opendc/trace/azure/AzureResourceStateTableReader.kt +++ b/opendc-trace/opendc-trace-azure/src/main/kotlin/org/opendc/trace/azure/AzureResourceStateTableReader.kt @@ -25,13 +25,13 @@ package org.opendc.trace.azure import com.fasterxml.jackson.core.JsonToken import com.fasterxml.jackson.dataformat.csv.CsvParser import com.fasterxml.jackson.dataformat.csv.CsvSchema -import org.opendc.trace.* +import org.opendc.trace.TableReader import org.opendc.trace.conv.RESOURCE_ID import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE_PCT import org.opendc.trace.conv.RESOURCE_STATE_TIMESTAMP import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID /** * A [TableReader] for the Azure v1 VM resource state table. diff --git a/opendc-trace/opendc-trace-azure/src/main/kotlin/org/opendc/trace/azure/AzureResourceTableReader.kt b/opendc-trace/opendc-trace-azure/src/main/kotlin/org/opendc/trace/azure/AzureResourceTableReader.kt index a8451301..c0acb67a 100644 --- a/opendc-trace/opendc-trace-azure/src/main/kotlin/org/opendc/trace/azure/AzureResourceTableReader.kt +++ b/opendc-trace/opendc-trace-azure/src/main/kotlin/org/opendc/trace/azure/AzureResourceTableReader.kt @@ -25,11 +25,15 @@ package org.opendc.trace.azure import com.fasterxml.jackson.core.JsonToken import com.fasterxml.jackson.dataformat.csv.CsvParser import com.fasterxml.jackson.dataformat.csv.CsvSchema -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableReader +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_MEM_CAPACITY +import org.opendc.trace.conv.RESOURCE_START_TIME +import org.opendc.trace.conv.RESOURCE_STOP_TIME import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID /** * A [TableReader] for the Azure v1 VM resources table. diff --git a/opendc-trace/opendc-trace-azure/src/main/kotlin/org/opendc/trace/azure/AzureTraceFormat.kt b/opendc-trace/opendc-trace-azure/src/main/kotlin/org/opendc/trace/azure/AzureTraceFormat.kt index 2294e4a4..8c87109d 100644 --- a/opendc-trace/opendc-trace-azure/src/main/kotlin/org/opendc/trace/azure/AzureTraceFormat.kt +++ b/opendc-trace/opendc-trace-azure/src/main/kotlin/org/opendc/trace/azure/AzureTraceFormat.kt @@ -24,8 +24,19 @@ package org.opendc.trace.azure import com.fasterxml.jackson.dataformat.csv.CsvFactory import com.fasterxml.jackson.dataformat.csv.CsvParser -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableColumn +import org.opendc.trace.TableColumnType +import org.opendc.trace.TableReader +import org.opendc.trace.TableWriter +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_MEM_CAPACITY +import org.opendc.trace.conv.RESOURCE_START_TIME +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE_PCT +import org.opendc.trace.conv.RESOURCE_STATE_TIMESTAMP +import org.opendc.trace.conv.RESOURCE_STOP_TIME +import org.opendc.trace.conv.TABLE_RESOURCES +import org.opendc.trace.conv.TABLE_RESOURCE_STATES import org.opendc.trace.spi.TableDetails import org.opendc.trace.spi.TraceFormat import org.opendc.trace.util.CompositeTableReader diff --git a/opendc-trace/opendc-trace-azure/src/test/kotlin/org/opendc/trace/azure/AzureTraceFormatTest.kt b/opendc-trace/opendc-trace-azure/src/test/kotlin/org/opendc/trace/azure/AzureTraceFormatTest.kt index 06ba047a..a7a18cd5 100644 --- a/opendc-trace/opendc-trace-azure/src/test/kotlin/org/opendc/trace/azure/AzureTraceFormatTest.kt +++ b/opendc-trace/opendc-trace-azure/src/test/kotlin/org/opendc/trace/azure/AzureTraceFormatTest.kt @@ -22,12 +22,24 @@ package org.opendc.trace.azure -import org.junit.jupiter.api.* -import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertDoesNotThrow +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Nested +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import org.opendc.trace.TableColumn import org.opendc.trace.TableReader -import org.opendc.trace.conv.* +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_MEM_CAPACITY +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE_PCT +import org.opendc.trace.conv.RESOURCE_STATE_TIMESTAMP +import org.opendc.trace.conv.TABLE_RESOURCES +import org.opendc.trace.conv.TABLE_RESOURCE_STATES import org.opendc.trace.testkit.TableReaderTestKit import java.nio.file.Paths diff --git a/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsExResourceStateTableReader.kt b/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsExResourceStateTableReader.kt index df7a1c91..511f02db 100644 --- a/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsExResourceStateTableReader.kt +++ b/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsExResourceStateTableReader.kt @@ -22,12 +22,23 @@ package org.opendc.trace.bitbrains -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableReader +import org.opendc.trace.conv.RESOURCE_CLUSTER_ID +import org.opendc.trace.conv.RESOURCE_CPU_CAPACITY +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_MEM_CAPACITY +import org.opendc.trace.conv.RESOURCE_STATE_CPU_DEMAND +import org.opendc.trace.conv.RESOURCE_STATE_CPU_READY_PCT +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE_PCT +import org.opendc.trace.conv.RESOURCE_STATE_DISK_READ +import org.opendc.trace.conv.RESOURCE_STATE_DISK_WRITE +import org.opendc.trace.conv.RESOURCE_STATE_TIMESTAMP import java.io.BufferedReader import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID /** * A [TableReader] for the Bitbrains resource state table. diff --git a/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsExTraceFormat.kt b/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsExTraceFormat.kt index 31c4f1e2..8abf811c 100644 --- a/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsExTraceFormat.kt +++ b/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsExTraceFormat.kt @@ -22,8 +22,23 @@ package org.opendc.trace.bitbrains -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableColumn +import org.opendc.trace.TableColumnType +import org.opendc.trace.TableReader +import org.opendc.trace.TableWriter +import org.opendc.trace.conv.RESOURCE_CLUSTER_ID +import org.opendc.trace.conv.RESOURCE_CPU_CAPACITY +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_MEM_CAPACITY +import org.opendc.trace.conv.RESOURCE_STATE_CPU_DEMAND +import org.opendc.trace.conv.RESOURCE_STATE_CPU_READY_PCT +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE_PCT +import org.opendc.trace.conv.RESOURCE_STATE_DISK_READ +import org.opendc.trace.conv.RESOURCE_STATE_DISK_WRITE +import org.opendc.trace.conv.RESOURCE_STATE_TIMESTAMP +import org.opendc.trace.conv.TABLE_RESOURCE_STATES import org.opendc.trace.spi.TableDetails import org.opendc.trace.spi.TraceFormat import org.opendc.trace.util.CompositeTableReader diff --git a/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsResourceStateTableReader.kt b/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsResourceStateTableReader.kt index 4d8cf758..65ca8a9c 100644 --- a/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsResourceStateTableReader.kt +++ b/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsResourceStateTableReader.kt @@ -26,8 +26,19 @@ import com.fasterxml.jackson.core.JsonParseException import com.fasterxml.jackson.core.JsonToken import com.fasterxml.jackson.dataformat.csv.CsvParser import com.fasterxml.jackson.dataformat.csv.CsvSchema -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableReader +import org.opendc.trace.conv.RESOURCE_CPU_CAPACITY +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_MEM_CAPACITY +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE_PCT +import org.opendc.trace.conv.RESOURCE_STATE_DISK_READ +import org.opendc.trace.conv.RESOURCE_STATE_DISK_WRITE +import org.opendc.trace.conv.RESOURCE_STATE_MEM_USAGE +import org.opendc.trace.conv.RESOURCE_STATE_NET_RX +import org.opendc.trace.conv.RESOURCE_STATE_NET_TX +import org.opendc.trace.conv.RESOURCE_STATE_TIMESTAMP import java.text.NumberFormat import java.time.Duration import java.time.Instant @@ -35,7 +46,8 @@ import java.time.LocalDateTime import java.time.ZoneOffset import java.time.format.DateTimeFormatter import java.time.format.DateTimeParseException -import java.util.* +import java.util.Locale +import java.util.UUID /** * A [TableReader] for the Bitbrains resource state table. diff --git a/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsResourceTableReader.kt b/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsResourceTableReader.kt index 7454c40f..776a8f86 100644 --- a/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsResourceTableReader.kt +++ b/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsResourceTableReader.kt @@ -23,12 +23,12 @@ package org.opendc.trace.bitbrains import com.fasterxml.jackson.dataformat.csv.CsvFactory -import org.opendc.trace.* +import org.opendc.trace.TableReader import org.opendc.trace.conv.RESOURCE_ID import java.nio.file.Path import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID /** * A [TableReader] for the Bitbrains resource table. diff --git a/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsTraceFormat.kt b/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsTraceFormat.kt index f3030893..57fc90e5 100644 --- a/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsTraceFormat.kt +++ b/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsTraceFormat.kt @@ -24,8 +24,24 @@ package org.opendc.trace.bitbrains import com.fasterxml.jackson.dataformat.csv.CsvFactory import com.fasterxml.jackson.dataformat.csv.CsvParser -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableColumn +import org.opendc.trace.TableColumnType +import org.opendc.trace.TableReader +import org.opendc.trace.TableWriter +import org.opendc.trace.conv.RESOURCE_CPU_CAPACITY +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_MEM_CAPACITY +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE_PCT +import org.opendc.trace.conv.RESOURCE_STATE_DISK_READ +import org.opendc.trace.conv.RESOURCE_STATE_DISK_WRITE +import org.opendc.trace.conv.RESOURCE_STATE_MEM_USAGE +import org.opendc.trace.conv.RESOURCE_STATE_NET_RX +import org.opendc.trace.conv.RESOURCE_STATE_NET_TX +import org.opendc.trace.conv.RESOURCE_STATE_TIMESTAMP +import org.opendc.trace.conv.TABLE_RESOURCES +import org.opendc.trace.conv.TABLE_RESOURCE_STATES import org.opendc.trace.spi.TableDetails import org.opendc.trace.spi.TraceFormat import org.opendc.trace.util.CompositeTableReader diff --git a/opendc-trace/opendc-trace-bitbrains/src/test/kotlin/org/opendc/trace/bitbrains/BitbrainsExTraceFormatTest.kt b/opendc-trace/opendc-trace-bitbrains/src/test/kotlin/org/opendc/trace/bitbrains/BitbrainsExTraceFormatTest.kt index dbb75c50..e8c7094b 100644 --- a/opendc-trace/opendc-trace-bitbrains/src/test/kotlin/org/opendc/trace/bitbrains/BitbrainsExTraceFormatTest.kt +++ b/opendc-trace/opendc-trace-bitbrains/src/test/kotlin/org/opendc/trace/bitbrains/BitbrainsExTraceFormatTest.kt @@ -22,9 +22,15 @@ package org.opendc.trace.bitbrains -import org.junit.jupiter.api.* -import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertDoesNotThrow +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Nested +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import org.opendc.trace.TableColumn import org.opendc.trace.TableReader import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE diff --git a/opendc-trace/opendc-trace-bitbrains/src/test/kotlin/org/opendc/trace/bitbrains/BitbrainsTraceFormatTest.kt b/opendc-trace/opendc-trace-bitbrains/src/test/kotlin/org/opendc/trace/bitbrains/BitbrainsTraceFormatTest.kt index 712e1fcb..edab8747 100644 --- a/opendc-trace/opendc-trace-bitbrains/src/test/kotlin/org/opendc/trace/bitbrains/BitbrainsTraceFormatTest.kt +++ b/opendc-trace/opendc-trace-bitbrains/src/test/kotlin/org/opendc/trace/bitbrains/BitbrainsTraceFormatTest.kt @@ -22,12 +22,23 @@ package org.opendc.trace.bitbrains -import org.junit.jupiter.api.* -import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertDoesNotThrow +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Nested +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import org.opendc.trace.TableColumn import org.opendc.trace.TableReader -import org.opendc.trace.conv.* +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE +import org.opendc.trace.conv.RESOURCE_STATE_TIMESTAMP +import org.opendc.trace.conv.TABLE_RESOURCES +import org.opendc.trace.conv.TABLE_RESOURCE_STATES import org.opendc.trace.testkit.TableReaderTestKit import java.nio.file.Paths diff --git a/opendc-trace/opendc-trace-calcite/src/main/kotlin/org/opendc/trace/calcite/TraceTable.kt b/opendc-trace/opendc-trace-calcite/src/main/kotlin/org/opendc/trace/calcite/TraceTable.kt index dfcc22a3..2dd02710 100644 --- a/opendc-trace/opendc-trace-calcite/src/main/kotlin/org/opendc/trace/calcite/TraceTable.kt +++ b/opendc-trace/opendc-trace-calcite/src/main/kotlin/org/opendc/trace/calcite/TraceTable.kt @@ -25,7 +25,11 @@ package org.opendc.trace.calcite import org.apache.calcite.DataContext import org.apache.calcite.adapter.java.AbstractQueryableTable import org.apache.calcite.adapter.java.JavaTypeFactory -import org.apache.calcite.linq4j.* +import org.apache.calcite.linq4j.AbstractEnumerable +import org.apache.calcite.linq4j.Enumerable +import org.apache.calcite.linq4j.Enumerator +import org.apache.calcite.linq4j.QueryProvider +import org.apache.calcite.linq4j.Queryable import org.apache.calcite.plan.RelOptCluster import org.apache.calcite.plan.RelOptTable import org.apache.calcite.prepare.Prepare.CatalogReader @@ -35,14 +39,16 @@ import org.apache.calcite.rel.logical.LogicalTableModify import org.apache.calcite.rel.type.RelDataType import org.apache.calcite.rel.type.RelDataTypeFactory import org.apache.calcite.rex.RexNode -import org.apache.calcite.schema.* +import org.apache.calcite.schema.ModifiableTable +import org.apache.calcite.schema.ProjectableFilterableTable +import org.apache.calcite.schema.SchemaPlus import org.apache.calcite.schema.impl.AbstractTableQueryable import org.apache.calcite.sql.type.SqlTypeName import org.opendc.trace.TableColumnType import java.nio.ByteBuffer import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID import java.util.concurrent.atomic.AtomicBoolean /** diff --git a/opendc-trace/opendc-trace-calcite/src/main/kotlin/org/opendc/trace/calcite/TraceTableModify.kt b/opendc-trace/opendc-trace-calcite/src/main/kotlin/org/opendc/trace/calcite/TraceTableModify.kt index 64dc0cea..902a5db4 100644 --- a/opendc-trace/opendc-trace-calcite/src/main/kotlin/org/opendc/trace/calcite/TraceTableModify.kt +++ b/opendc-trace/opendc-trace-calcite/src/main/kotlin/org/opendc/trace/calcite/TraceTableModify.kt @@ -22,14 +22,22 @@ package org.opendc.trace.calcite -import org.apache.calcite.adapter.enumerable.* +import org.apache.calcite.adapter.enumerable.EnumerableRel import org.apache.calcite.adapter.enumerable.EnumerableRel.Prefer +import org.apache.calcite.adapter.enumerable.EnumerableRelImplementor +import org.apache.calcite.adapter.enumerable.EnumerableTableScan +import org.apache.calcite.adapter.enumerable.JavaRowFormat +import org.apache.calcite.adapter.enumerable.PhysTypeImpl import org.apache.calcite.adapter.java.JavaTypeFactory import org.apache.calcite.linq4j.Enumerable import org.apache.calcite.linq4j.tree.BlockBuilder import org.apache.calcite.linq4j.tree.Expressions import org.apache.calcite.linq4j.tree.Types -import org.apache.calcite.plan.* +import org.apache.calcite.plan.RelOptCluster +import org.apache.calcite.plan.RelOptCost +import org.apache.calcite.plan.RelOptPlanner +import org.apache.calcite.plan.RelOptTable +import org.apache.calcite.plan.RelTraitSet import org.apache.calcite.prepare.Prepare import org.apache.calcite.rel.RelNode import org.apache.calcite.rel.core.TableModify diff --git a/opendc-trace/opendc-trace-calcite/src/test/kotlin/org/opendc/trace/calcite/CalciteTest.kt b/opendc-trace/opendc-trace-calcite/src/test/kotlin/org/opendc/trace/calcite/CalciteTest.kt index d8729034..77346e74 100644 --- a/opendc-trace/opendc-trace-calcite/src/test/kotlin/org/opendc/trace/calcite/CalciteTest.kt +++ b/opendc-trace/opendc-trace-calcite/src/test/kotlin/org/opendc/trace/calcite/CalciteTest.kt @@ -25,7 +25,11 @@ package org.opendc.trace.calcite import io.mockk.every import io.mockk.mockk import org.apache.calcite.jdbc.CalciteConnection -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertArrayEquals +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.opendc.trace.TableColumn import org.opendc.trace.TableColumnType @@ -40,7 +44,8 @@ import java.sql.Statement import java.sql.Timestamp import java.time.Duration import java.time.Instant -import java.util.* +import java.util.Properties +import java.util.UUID /** * Smoke test for Apache Calcite integration. diff --git a/opendc-trace/opendc-trace-calcite/src/test/kotlin/org/opendc/trace/calcite/TraceSchemaFactoryTest.kt b/opendc-trace/opendc-trace-calcite/src/test/kotlin/org/opendc/trace/calcite/TraceSchemaFactoryTest.kt index 0a552e74..eb4bc769 100644 --- a/opendc-trace/opendc-trace-calcite/src/test/kotlin/org/opendc/trace/calcite/TraceSchemaFactoryTest.kt +++ b/opendc-trace/opendc-trace-calcite/src/test/kotlin/org/opendc/trace/calcite/TraceSchemaFactoryTest.kt @@ -22,12 +22,14 @@ package org.opendc.trace.calcite -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import java.sql.DriverManager import java.sql.Timestamp -import java.util.* +import java.util.Properties /** * Test suite for [TraceSchemaFactory]. diff --git a/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTaskTableReader.kt b/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTaskTableReader.kt index f9a171e9..78ce6ad4 100644 --- a/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTaskTableReader.kt +++ b/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTaskTableReader.kt @@ -25,12 +25,19 @@ package org.opendc.trace.gwf import com.fasterxml.jackson.core.JsonToken import com.fasterxml.jackson.dataformat.csv.CsvParser import com.fasterxml.jackson.dataformat.csv.CsvSchema -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableColumnType +import org.opendc.trace.TableReader +import org.opendc.trace.conv.TASK_ALLOC_NCPUS +import org.opendc.trace.conv.TASK_ID +import org.opendc.trace.conv.TASK_PARENTS +import org.opendc.trace.conv.TASK_REQ_NCPUS +import org.opendc.trace.conv.TASK_RUNTIME +import org.opendc.trace.conv.TASK_SUBMIT_TIME +import org.opendc.trace.conv.TASK_WORKFLOW_ID import org.opendc.trace.util.convertTo import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID import java.util.regex.Pattern /** diff --git a/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt b/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt index ca63b624..c7fbd4b5 100644 --- a/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt +++ b/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt @@ -24,8 +24,18 @@ package org.opendc.trace.gwf import com.fasterxml.jackson.dataformat.csv.CsvFactory import com.fasterxml.jackson.dataformat.csv.CsvParser -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableColumn +import org.opendc.trace.TableColumnType +import org.opendc.trace.TableReader +import org.opendc.trace.TableWriter +import org.opendc.trace.conv.TABLE_TASKS +import org.opendc.trace.conv.TASK_ALLOC_NCPUS +import org.opendc.trace.conv.TASK_ID +import org.opendc.trace.conv.TASK_PARENTS +import org.opendc.trace.conv.TASK_REQ_NCPUS +import org.opendc.trace.conv.TASK_RUNTIME +import org.opendc.trace.conv.TASK_SUBMIT_TIME +import org.opendc.trace.conv.TASK_WORKFLOW_ID import org.opendc.trace.spi.TableDetails import org.opendc.trace.spi.TraceFormat import java.nio.file.Path diff --git a/opendc-trace/opendc-trace-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt b/opendc-trace/opendc-trace-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt index a8c3a715..9c97547a 100644 --- a/opendc-trace/opendc-trace-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt +++ b/opendc-trace/opendc-trace-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt @@ -22,11 +22,23 @@ package org.opendc.trace.gwf -import org.junit.jupiter.api.* -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertDoesNotThrow +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Nested +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import org.opendc.trace.TableColumn import org.opendc.trace.TableReader -import org.opendc.trace.conv.* +import org.opendc.trace.conv.TABLE_TASKS +import org.opendc.trace.conv.TASK_ID +import org.opendc.trace.conv.TASK_PARENTS +import org.opendc.trace.conv.TASK_RUNTIME +import org.opendc.trace.conv.TASK_SUBMIT_TIME +import org.opendc.trace.conv.TASK_WORKFLOW_ID import org.opendc.trace.testkit.TableReaderTestKit import java.nio.file.Paths import java.time.Duration diff --git a/opendc-trace/opendc-trace-opendc/src/jmh/kotlin/org/opendc/trace/opendc/OdcVmTraceBenchmarks.kt b/opendc-trace/opendc-trace-opendc/src/jmh/kotlin/org/opendc/trace/opendc/OdcVmTraceBenchmarks.kt index b9b22931..e504cf2f 100644 --- a/opendc-trace/opendc-trace-opendc/src/jmh/kotlin/org/opendc/trace/opendc/OdcVmTraceBenchmarks.kt +++ b/opendc-trace/opendc-trace-opendc/src/jmh/kotlin/org/opendc/trace/opendc/OdcVmTraceBenchmarks.kt @@ -22,9 +22,19 @@ package org.opendc.trace.opendc -import org.opendc.trace.conv.* +import org.opendc.trace.conv.INTERFERENCE_GROUP_SCORE +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.TABLE_INTERFERENCE_GROUPS +import org.opendc.trace.conv.TABLE_RESOURCES +import org.opendc.trace.conv.TABLE_RESOURCE_STATES import org.opendc.trace.spi.TraceFormat -import org.openjdk.jmh.annotations.* +import org.openjdk.jmh.annotations.Benchmark +import org.openjdk.jmh.annotations.Fork +import org.openjdk.jmh.annotations.Measurement +import org.openjdk.jmh.annotations.Scope +import org.openjdk.jmh.annotations.Setup +import org.openjdk.jmh.annotations.State +import org.openjdk.jmh.annotations.Warmup import org.openjdk.jmh.infra.Blackhole import java.nio.file.Path import java.util.concurrent.TimeUnit diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmInterferenceJsonTableReader.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmInterferenceJsonTableReader.kt index d4858f23..3e1fca06 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmInterferenceJsonTableReader.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmInterferenceJsonTableReader.kt @@ -25,14 +25,15 @@ package org.opendc.trace.opendc import com.fasterxml.jackson.core.JsonParseException import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.core.JsonToken -import org.opendc.trace.* +import org.opendc.trace.TableColumnType +import org.opendc.trace.TableReader import org.opendc.trace.conv.INTERFERENCE_GROUP_MEMBERS import org.opendc.trace.conv.INTERFERENCE_GROUP_SCORE import org.opendc.trace.conv.INTERFERENCE_GROUP_TARGET import org.opendc.trace.util.convertTo import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID /** * A [TableReader] implementation for the OpenDC VM interference JSON format. diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmInterferenceJsonTableWriter.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmInterferenceJsonTableWriter.kt index d5e8a0b6..c6905c5b 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmInterferenceJsonTableWriter.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmInterferenceJsonTableWriter.kt @@ -23,13 +23,13 @@ package org.opendc.trace.opendc import com.fasterxml.jackson.core.JsonGenerator -import org.opendc.trace.* +import org.opendc.trace.TableWriter import org.opendc.trace.conv.INTERFERENCE_GROUP_MEMBERS import org.opendc.trace.conv.INTERFERENCE_GROUP_SCORE import org.opendc.trace.conv.INTERFERENCE_GROUP_TARGET import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID /** * A [TableWriter] implementation for the OpenDC VM interference JSON format. diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmResourceStateTableReader.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmResourceStateTableReader.kt index b256047f..ff9a98d7 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmResourceStateTableReader.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmResourceStateTableReader.kt @@ -22,13 +22,17 @@ package org.opendc.trace.opendc -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableReader +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE +import org.opendc.trace.conv.RESOURCE_STATE_DURATION +import org.opendc.trace.conv.RESOURCE_STATE_TIMESTAMP import org.opendc.trace.opendc.parquet.ResourceState import org.opendc.trace.util.parquet.LocalParquetReader import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID /** * A [TableReader] implementation for the OpenDC virtual machine trace format. diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmResourceStateTableWriter.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmResourceStateTableWriter.kt index 30375de0..cf0a401b 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmResourceStateTableWriter.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmResourceStateTableWriter.kt @@ -23,12 +23,16 @@ package org.opendc.trace.opendc import org.apache.parquet.hadoop.ParquetWriter -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableWriter +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE +import org.opendc.trace.conv.RESOURCE_STATE_DURATION +import org.opendc.trace.conv.RESOURCE_STATE_TIMESTAMP import org.opendc.trace.opendc.parquet.ResourceState import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID /** * A [TableWriter] implementation for the OpenDC virtual machine trace format. diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmResourceTableReader.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmResourceTableReader.kt index 76fdbca8..d4613158 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmResourceTableReader.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmResourceTableReader.kt @@ -22,13 +22,18 @@ package org.opendc.trace.opendc -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableReader +import org.opendc.trace.conv.RESOURCE_CPU_CAPACITY +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_MEM_CAPACITY +import org.opendc.trace.conv.RESOURCE_START_TIME +import org.opendc.trace.conv.RESOURCE_STOP_TIME import org.opendc.trace.opendc.parquet.Resource import org.opendc.trace.util.parquet.LocalParquetReader import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID /** * A [TableReader] implementation for the "resources table" in the OpenDC virtual machine trace format. diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmResourceTableWriter.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmResourceTableWriter.kt index 8117c3cd..73a03891 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmResourceTableWriter.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmResourceTableWriter.kt @@ -23,12 +23,17 @@ package org.opendc.trace.opendc import org.apache.parquet.hadoop.ParquetWriter -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableWriter +import org.opendc.trace.conv.RESOURCE_CPU_CAPACITY +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_MEM_CAPACITY +import org.opendc.trace.conv.RESOURCE_START_TIME +import org.opendc.trace.conv.RESOURCE_STOP_TIME import org.opendc.trace.opendc.parquet.Resource import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID /** * A [TableWriter] implementation for the OpenDC virtual machine trace format. diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmTraceFormat.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmTraceFormat.kt index 2c5f892b..07a26fb5 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmTraceFormat.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmTraceFormat.kt @@ -27,8 +27,25 @@ import com.fasterxml.jackson.core.JsonFactory import org.apache.parquet.column.ParquetProperties import org.apache.parquet.hadoop.ParquetFileWriter import org.apache.parquet.hadoop.metadata.CompressionCodecName -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableColumn +import org.opendc.trace.TableColumnType +import org.opendc.trace.TableReader +import org.opendc.trace.TableWriter +import org.opendc.trace.conv.INTERFERENCE_GROUP_MEMBERS +import org.opendc.trace.conv.INTERFERENCE_GROUP_SCORE +import org.opendc.trace.conv.INTERFERENCE_GROUP_TARGET +import org.opendc.trace.conv.RESOURCE_CPU_CAPACITY +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_MEM_CAPACITY +import org.opendc.trace.conv.RESOURCE_START_TIME +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE +import org.opendc.trace.conv.RESOURCE_STATE_DURATION +import org.opendc.trace.conv.RESOURCE_STATE_TIMESTAMP +import org.opendc.trace.conv.RESOURCE_STOP_TIME +import org.opendc.trace.conv.TABLE_INTERFERENCE_GROUPS +import org.opendc.trace.conv.TABLE_RESOURCES +import org.opendc.trace.conv.TABLE_RESOURCE_STATES import org.opendc.trace.opendc.parquet.ResourceReadSupport import org.opendc.trace.opendc.parquet.ResourceStateReadSupport import org.opendc.trace.opendc.parquet.ResourceStateWriteSupport diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceReadSupport.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceReadSupport.kt index 8a8ed790..aafa23a4 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceReadSupport.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceReadSupport.kt @@ -26,9 +26,17 @@ import org.apache.hadoop.conf.Configuration import org.apache.parquet.hadoop.api.InitContext import org.apache.parquet.hadoop.api.ReadSupport import org.apache.parquet.io.api.RecordMaterializer -import org.apache.parquet.schema.* +import org.apache.parquet.schema.LogicalTypeAnnotation +import org.apache.parquet.schema.MessageType +import org.apache.parquet.schema.PrimitiveType +import org.apache.parquet.schema.Types import org.opendc.trace.TableColumn -import org.opendc.trace.conv.* +import org.opendc.trace.conv.RESOURCE_CPU_CAPACITY +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_MEM_CAPACITY +import org.opendc.trace.conv.RESOURCE_START_TIME +import org.opendc.trace.conv.RESOURCE_STOP_TIME /** * A [ReadSupport] instance for [Resource] objects. diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceRecordMaterializer.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceRecordMaterializer.kt index 3adb0709..936a684a 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceRecordMaterializer.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceRecordMaterializer.kt @@ -22,7 +22,11 @@ package org.opendc.trace.opendc.parquet -import org.apache.parquet.io.api.* +import org.apache.parquet.io.api.Binary +import org.apache.parquet.io.api.Converter +import org.apache.parquet.io.api.GroupConverter +import org.apache.parquet.io.api.PrimitiveConverter +import org.apache.parquet.io.api.RecordMaterializer import org.apache.parquet.schema.MessageType import java.time.Instant diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceStateReadSupport.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceStateReadSupport.kt index 78adc649..282501f3 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceStateReadSupport.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceStateReadSupport.kt @@ -26,9 +26,16 @@ import org.apache.hadoop.conf.Configuration import org.apache.parquet.hadoop.api.InitContext import org.apache.parquet.hadoop.api.ReadSupport import org.apache.parquet.io.api.RecordMaterializer -import org.apache.parquet.schema.* +import org.apache.parquet.schema.LogicalTypeAnnotation +import org.apache.parquet.schema.MessageType +import org.apache.parquet.schema.PrimitiveType +import org.apache.parquet.schema.Types import org.opendc.trace.TableColumn -import org.opendc.trace.conv.* +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE +import org.opendc.trace.conv.RESOURCE_STATE_DURATION +import org.opendc.trace.conv.RESOURCE_STATE_TIMESTAMP /** * A [ReadSupport] instance for [ResourceState] objects. diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceStateRecordMaterializer.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceStateRecordMaterializer.kt index f8b0c3c2..a813a5af 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceStateRecordMaterializer.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceStateRecordMaterializer.kt @@ -22,7 +22,11 @@ package org.opendc.trace.opendc.parquet -import org.apache.parquet.io.api.* +import org.apache.parquet.io.api.Binary +import org.apache.parquet.io.api.Converter +import org.apache.parquet.io.api.GroupConverter +import org.apache.parquet.io.api.PrimitiveConverter +import org.apache.parquet.io.api.RecordMaterializer import org.apache.parquet.schema.MessageType import java.time.Duration import java.time.Instant diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceStateWriteSupport.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceStateWriteSupport.kt index e2f3df31..0bbec4d2 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceStateWriteSupport.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceStateWriteSupport.kt @@ -26,7 +26,10 @@ import org.apache.hadoop.conf.Configuration import org.apache.parquet.hadoop.api.WriteSupport import org.apache.parquet.io.api.Binary import org.apache.parquet.io.api.RecordConsumer -import org.apache.parquet.schema.* +import org.apache.parquet.schema.LogicalTypeAnnotation +import org.apache.parquet.schema.MessageType +import org.apache.parquet.schema.PrimitiveType +import org.apache.parquet.schema.Types /** * Support for writing [Resource] instances to Parquet format. diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceWriteSupport.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceWriteSupport.kt index 14cadabb..790ff4e8 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceWriteSupport.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceWriteSupport.kt @@ -26,7 +26,10 @@ import org.apache.hadoop.conf.Configuration import org.apache.parquet.hadoop.api.WriteSupport import org.apache.parquet.io.api.Binary import org.apache.parquet.io.api.RecordConsumer -import org.apache.parquet.schema.* +import org.apache.parquet.schema.LogicalTypeAnnotation +import org.apache.parquet.schema.MessageType +import org.apache.parquet.schema.PrimitiveType +import org.apache.parquet.schema.Types import kotlin.math.roundToLong /** diff --git a/opendc-trace/opendc-trace-opendc/src/test/kotlin/org/opendc/trace/opendc/OdcVmTraceFormatTest.kt b/opendc-trace/opendc-trace-opendc/src/test/kotlin/org/opendc/trace/opendc/OdcVmTraceFormatTest.kt index 9fdffb2b..ad87b085 100644 --- a/opendc-trace/opendc-trace-opendc/src/test/kotlin/org/opendc/trace/opendc/OdcVmTraceFormatTest.kt +++ b/opendc-trace/opendc-trace-opendc/src/test/kotlin/org/opendc/trace/opendc/OdcVmTraceFormatTest.kt @@ -22,7 +22,10 @@ package org.opendc.trace.opendc -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Nested @@ -34,7 +37,20 @@ import org.junit.jupiter.params.provider.ValueSource import org.opendc.trace.TableColumn import org.opendc.trace.TableReader import org.opendc.trace.TableWriter -import org.opendc.trace.conv.* +import org.opendc.trace.conv.INTERFERENCE_GROUP_MEMBERS +import org.opendc.trace.conv.INTERFERENCE_GROUP_SCORE +import org.opendc.trace.conv.INTERFERENCE_GROUP_TARGET +import org.opendc.trace.conv.RESOURCE_CPU_CAPACITY +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_MEM_CAPACITY +import org.opendc.trace.conv.RESOURCE_START_TIME +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE +import org.opendc.trace.conv.RESOURCE_STATE_TIMESTAMP +import org.opendc.trace.conv.RESOURCE_STOP_TIME +import org.opendc.trace.conv.TABLE_INTERFERENCE_GROUPS +import org.opendc.trace.conv.TABLE_RESOURCES +import org.opendc.trace.conv.TABLE_RESOURCE_STATES import org.opendc.trace.testkit.TableReaderTestKit import org.opendc.trace.testkit.TableWriterTestKit import java.nio.file.Files diff --git a/opendc-trace/opendc-trace-parquet/src/test/kotlin/org/opendc/trace/util/parquet/ParquetTest.kt b/opendc-trace/opendc-trace-parquet/src/test/kotlin/org/opendc/trace/util/parquet/ParquetTest.kt index 29fcac96..b6c5a423 100644 --- a/opendc-trace/opendc-trace-parquet/src/test/kotlin/org/opendc/trace/util/parquet/ParquetTest.kt +++ b/opendc-trace/opendc-trace-parquet/src/test/kotlin/org/opendc/trace/util/parquet/ParquetTest.kt @@ -35,8 +35,11 @@ import org.apache.parquet.schema.MessageType import org.apache.parquet.schema.PrimitiveType import org.apache.parquet.schema.Type import org.apache.parquet.schema.Types -import org.junit.jupiter.api.* +import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import java.nio.file.FileAlreadyExistsException import java.nio.file.Files import java.nio.file.NoSuchFileException diff --git a/opendc-trace/opendc-trace-swf/src/main/kotlin/org/opendc/trace/swf/SwfTaskTableReader.kt b/opendc-trace/opendc-trace-swf/src/main/kotlin/org/opendc/trace/swf/SwfTaskTableReader.kt index b2734fe7..2465fb47 100644 --- a/opendc-trace/opendc-trace-swf/src/main/kotlin/org/opendc/trace/swf/SwfTaskTableReader.kt +++ b/opendc-trace/opendc-trace-swf/src/main/kotlin/org/opendc/trace/swf/SwfTaskTableReader.kt @@ -22,12 +22,21 @@ package org.opendc.trace.swf -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableReader +import org.opendc.trace.conv.TASK_ALLOC_NCPUS +import org.opendc.trace.conv.TASK_GROUP_ID +import org.opendc.trace.conv.TASK_ID +import org.opendc.trace.conv.TASK_PARENTS +import org.opendc.trace.conv.TASK_REQ_NCPUS +import org.opendc.trace.conv.TASK_RUNTIME +import org.opendc.trace.conv.TASK_STATUS +import org.opendc.trace.conv.TASK_SUBMIT_TIME +import org.opendc.trace.conv.TASK_USER_ID +import org.opendc.trace.conv.TASK_WAIT_TIME import java.io.BufferedReader import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID /** * A [TableReader] implementation for the SWF format. diff --git a/opendc-trace/opendc-trace-swf/src/main/kotlin/org/opendc/trace/swf/SwfTraceFormat.kt b/opendc-trace/opendc-trace-swf/src/main/kotlin/org/opendc/trace/swf/SwfTraceFormat.kt index 575a1740..c51805d7 100644 --- a/opendc-trace/opendc-trace-swf/src/main/kotlin/org/opendc/trace/swf/SwfTraceFormat.kt +++ b/opendc-trace/opendc-trace-swf/src/main/kotlin/org/opendc/trace/swf/SwfTraceFormat.kt @@ -22,8 +22,21 @@ package org.opendc.trace.swf -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableColumn +import org.opendc.trace.TableColumnType +import org.opendc.trace.TableReader +import org.opendc.trace.TableWriter +import org.opendc.trace.conv.TABLE_TASKS +import org.opendc.trace.conv.TASK_ALLOC_NCPUS +import org.opendc.trace.conv.TASK_GROUP_ID +import org.opendc.trace.conv.TASK_ID +import org.opendc.trace.conv.TASK_PARENTS +import org.opendc.trace.conv.TASK_REQ_NCPUS +import org.opendc.trace.conv.TASK_RUNTIME +import org.opendc.trace.conv.TASK_STATUS +import org.opendc.trace.conv.TASK_SUBMIT_TIME +import org.opendc.trace.conv.TASK_USER_ID +import org.opendc.trace.conv.TASK_WAIT_TIME import org.opendc.trace.spi.TableDetails import org.opendc.trace.spi.TraceFormat import java.nio.file.Path diff --git a/opendc-trace/opendc-trace-swf/src/test/kotlin/org/opendc/trace/swf/SwfTraceFormatTest.kt b/opendc-trace/opendc-trace-swf/src/test/kotlin/org/opendc/trace/swf/SwfTraceFormatTest.kt index 06a500d8..436f2572 100644 --- a/opendc-trace/opendc-trace-swf/src/test/kotlin/org/opendc/trace/swf/SwfTraceFormatTest.kt +++ b/opendc-trace/opendc-trace-swf/src/test/kotlin/org/opendc/trace/swf/SwfTraceFormatTest.kt @@ -22,8 +22,15 @@ package org.opendc.trace.swf -import org.junit.jupiter.api.* -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertDoesNotThrow +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Nested +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import org.opendc.trace.TableColumn import org.opendc.trace.TableReader import org.opendc.trace.conv.TABLE_TASKS diff --git a/opendc-trace/opendc-trace-testkit/src/main/kotlin/org/opendc/trace/testkit/TableReaderTestKit.kt b/opendc-trace/opendc-trace-testkit/src/main/kotlin/org/opendc/trace/testkit/TableReaderTestKit.kt index 291ca2b1..dc0f3198 100644 --- a/opendc-trace/opendc-trace-testkit/src/main/kotlin/org/opendc/trace/testkit/TableReaderTestKit.kt +++ b/opendc-trace/opendc-trace-testkit/src/main/kotlin/org/opendc/trace/testkit/TableReaderTestKit.kt @@ -22,11 +22,15 @@ package org.opendc.trace.testkit -import org.junit.jupiter.api.* -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.AfterEach +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertNotEquals import org.junit.jupiter.api.Assumptions.assumeTrue +import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertAll import org.junit.jupiter.api.assertDoesNotThrow +import org.junit.jupiter.api.assertThrows import org.opendc.trace.TableColumn import org.opendc.trace.TableColumnType import org.opendc.trace.TableReader diff --git a/opendc-trace/opendc-trace-testkit/src/main/kotlin/org/opendc/trace/testkit/TableWriterTestKit.kt b/opendc-trace/opendc-trace-testkit/src/main/kotlin/org/opendc/trace/testkit/TableWriterTestKit.kt index fab992f0..34bcbaf3 100644 --- a/opendc-trace/opendc-trace-testkit/src/main/kotlin/org/opendc/trace/testkit/TableWriterTestKit.kt +++ b/opendc-trace/opendc-trace-testkit/src/main/kotlin/org/opendc/trace/testkit/TableWriterTestKit.kt @@ -23,7 +23,8 @@ package org.opendc.trace.testkit import org.junit.jupiter.api.AfterEach -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertNotEquals import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertAll import org.junit.jupiter.api.assertThrows @@ -32,7 +33,7 @@ import org.opendc.trace.TableColumnType import org.opendc.trace.TableWriter import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID /** * A test suite for implementations of the [TableWriter] interface. diff --git a/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/ConvertCommand.kt b/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/ConvertCommand.kt index b6d661e0..13e05a0b 100644 --- a/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/ConvertCommand.kt +++ b/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/ConvertCommand.kt @@ -28,15 +28,34 @@ import com.github.ajalt.clikt.parameters.groups.OptionGroup import com.github.ajalt.clikt.parameters.groups.cooccurring import com.github.ajalt.clikt.parameters.groups.defaultByName import com.github.ajalt.clikt.parameters.groups.groupChoice -import com.github.ajalt.clikt.parameters.options.* -import com.github.ajalt.clikt.parameters.types.* +import com.github.ajalt.clikt.parameters.options.default +import com.github.ajalt.clikt.parameters.options.defaultLazy +import com.github.ajalt.clikt.parameters.options.option +import com.github.ajalt.clikt.parameters.options.required +import com.github.ajalt.clikt.parameters.types.double +import com.github.ajalt.clikt.parameters.types.file +import com.github.ajalt.clikt.parameters.types.long +import com.github.ajalt.clikt.parameters.types.restrictTo import mu.KotlinLogging -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableWriter +import org.opendc.trace.Trace +import org.opendc.trace.conv.RESOURCE_CPU_CAPACITY +import org.opendc.trace.conv.RESOURCE_CPU_COUNT +import org.opendc.trace.conv.RESOURCE_ID +import org.opendc.trace.conv.RESOURCE_MEM_CAPACITY +import org.opendc.trace.conv.RESOURCE_START_TIME +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE +import org.opendc.trace.conv.RESOURCE_STATE_CPU_USAGE_PCT +import org.opendc.trace.conv.RESOURCE_STATE_DURATION +import org.opendc.trace.conv.RESOURCE_STATE_MEM_USAGE +import org.opendc.trace.conv.RESOURCE_STATE_TIMESTAMP +import org.opendc.trace.conv.RESOURCE_STOP_TIME +import org.opendc.trace.conv.TABLE_RESOURCES +import org.opendc.trace.conv.TABLE_RESOURCE_STATES import java.io.File import java.time.Duration import java.time.Instant -import java.util.* +import java.util.Random import kotlin.collections.HashMap import kotlin.math.abs import kotlin.math.max diff --git a/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/QueryCommand.kt b/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/QueryCommand.kt index b0f95de2..b79a9f13 100644 --- a/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/QueryCommand.kt +++ b/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/QueryCommand.kt @@ -40,7 +40,7 @@ import java.nio.charset.StandardCharsets import java.sql.DriverManager import java.sql.ResultSet import java.sql.ResultSetMetaData -import java.util.* +import java.util.Properties /** * A [CliktCommand] that allows users to query workload traces using SQL. diff --git a/opendc-trace/opendc-trace-wfformat/src/main/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReader.kt b/opendc-trace/opendc-trace-wfformat/src/main/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReader.kt index ca1a29d0..e0cbd305 100644 --- a/opendc-trace/opendc-trace-wfformat/src/main/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReader.kt +++ b/opendc-trace/opendc-trace-wfformat/src/main/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReader.kt @@ -25,12 +25,18 @@ package org.opendc.trace.wfformat import com.fasterxml.jackson.core.JsonParseException import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.core.JsonToken -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableColumnType +import org.opendc.trace.TableReader +import org.opendc.trace.conv.TASK_CHILDREN +import org.opendc.trace.conv.TASK_ID +import org.opendc.trace.conv.TASK_PARENTS +import org.opendc.trace.conv.TASK_REQ_NCPUS +import org.opendc.trace.conv.TASK_RUNTIME +import org.opendc.trace.conv.TASK_WORKFLOW_ID import org.opendc.trace.util.convertTo import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID import kotlin.math.roundToInt /** diff --git a/opendc-trace/opendc-trace-wfformat/src/main/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormat.kt b/opendc-trace/opendc-trace-wfformat/src/main/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormat.kt index 154fa061..35fb883a 100644 --- a/opendc-trace/opendc-trace-wfformat/src/main/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormat.kt +++ b/opendc-trace/opendc-trace-wfformat/src/main/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormat.kt @@ -23,8 +23,17 @@ package org.opendc.trace.wfformat import com.fasterxml.jackson.core.JsonFactory -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableColumn +import org.opendc.trace.TableColumnType +import org.opendc.trace.TableReader +import org.opendc.trace.TableWriter +import org.opendc.trace.conv.TABLE_TASKS +import org.opendc.trace.conv.TASK_CHILDREN +import org.opendc.trace.conv.TASK_ID +import org.opendc.trace.conv.TASK_PARENTS +import org.opendc.trace.conv.TASK_REQ_NCPUS +import org.opendc.trace.conv.TASK_RUNTIME +import org.opendc.trace.conv.TASK_WORKFLOW_ID import org.opendc.trace.spi.TableDetails import org.opendc.trace.spi.TraceFormat import java.nio.file.Path diff --git a/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReaderTest.kt b/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReaderTest.kt index 9d9735b1..0560d642 100644 --- a/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReaderTest.kt +++ b/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReaderTest.kt @@ -24,7 +24,9 @@ package org.opendc.trace.wfformat import com.fasterxml.jackson.core.JsonFactory import com.fasterxml.jackson.core.JsonParseException -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertThrows diff --git a/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt b/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt index 40506d59..80a9d80e 100644 --- a/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt +++ b/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt @@ -22,13 +22,22 @@ package org.opendc.trace.wfformat -import org.junit.jupiter.api.* -import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Nested +import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertDoesNotThrow +import org.junit.jupiter.api.assertThrows import org.opendc.trace.TableColumn import org.opendc.trace.TableReader -import org.opendc.trace.conv.* +import org.opendc.trace.conv.TABLE_TASKS +import org.opendc.trace.conv.TASK_ID +import org.opendc.trace.conv.TASK_PARENTS +import org.opendc.trace.conv.TASK_RUNTIME +import org.opendc.trace.conv.TASK_WORKFLOW_ID import org.opendc.trace.testkit.TableReaderTestKit import java.nio.file.Paths @@ -49,7 +58,7 @@ class WfFormatTraceFormatTest { @Test fun testTableExists() { val path = Paths.get("src/test/resources/trace.json") - Assertions.assertDoesNotThrow { format.getDetails(path, TABLE_TASKS) } + assertDoesNotThrow { format.getDetails(path, TABLE_TASKS) } } @Test diff --git a/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/WtfTaskTableReader.kt b/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/WtfTaskTableReader.kt index 7d2005b2..73c1b8a9 100644 --- a/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/WtfTaskTableReader.kt +++ b/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/WtfTaskTableReader.kt @@ -22,14 +22,24 @@ package org.opendc.trace.wtf -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableColumnType +import org.opendc.trace.TableReader +import org.opendc.trace.conv.TASK_CHILDREN +import org.opendc.trace.conv.TASK_GROUP_ID +import org.opendc.trace.conv.TASK_ID +import org.opendc.trace.conv.TASK_PARENTS +import org.opendc.trace.conv.TASK_REQ_NCPUS +import org.opendc.trace.conv.TASK_RUNTIME +import org.opendc.trace.conv.TASK_SUBMIT_TIME +import org.opendc.trace.conv.TASK_USER_ID +import org.opendc.trace.conv.TASK_WAIT_TIME +import org.opendc.trace.conv.TASK_WORKFLOW_ID import org.opendc.trace.util.convertTo import org.opendc.trace.util.parquet.LocalParquetReader import org.opendc.trace.wtf.parquet.Task import java.time.Duration import java.time.Instant -import java.util.* +import java.util.UUID /** * A [TableReader] implementation for the WTF format. diff --git a/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/WtfTraceFormat.kt b/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/WtfTraceFormat.kt index c8408626..bf834778 100644 --- a/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/WtfTraceFormat.kt +++ b/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/WtfTraceFormat.kt @@ -22,8 +22,21 @@ package org.opendc.trace.wtf -import org.opendc.trace.* -import org.opendc.trace.conv.* +import org.opendc.trace.TableColumn +import org.opendc.trace.TableColumnType +import org.opendc.trace.TableReader +import org.opendc.trace.TableWriter +import org.opendc.trace.conv.TABLE_TASKS +import org.opendc.trace.conv.TASK_CHILDREN +import org.opendc.trace.conv.TASK_GROUP_ID +import org.opendc.trace.conv.TASK_ID +import org.opendc.trace.conv.TASK_PARENTS +import org.opendc.trace.conv.TASK_REQ_NCPUS +import org.opendc.trace.conv.TASK_RUNTIME +import org.opendc.trace.conv.TASK_SUBMIT_TIME +import org.opendc.trace.conv.TASK_USER_ID +import org.opendc.trace.conv.TASK_WAIT_TIME +import org.opendc.trace.conv.TASK_WORKFLOW_ID import org.opendc.trace.spi.TableDetails import org.opendc.trace.spi.TraceFormat import org.opendc.trace.util.parquet.LocalParquetReader diff --git a/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/parquet/TaskReadSupport.kt b/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/parquet/TaskReadSupport.kt index a6087d9f..47d26ec5 100644 --- a/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/parquet/TaskReadSupport.kt +++ b/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/parquet/TaskReadSupport.kt @@ -26,8 +26,21 @@ import org.apache.hadoop.conf.Configuration import org.apache.parquet.hadoop.api.InitContext import org.apache.parquet.hadoop.api.ReadSupport import org.apache.parquet.io.api.RecordMaterializer -import org.apache.parquet.schema.* -import org.opendc.trace.conv.* +import org.apache.parquet.schema.LogicalTypeAnnotation +import org.apache.parquet.schema.MessageType +import org.apache.parquet.schema.PrimitiveType +import org.apache.parquet.schema.Type +import org.apache.parquet.schema.Types +import org.opendc.trace.conv.TASK_CHILDREN +import org.opendc.trace.conv.TASK_GROUP_ID +import org.opendc.trace.conv.TASK_ID +import org.opendc.trace.conv.TASK_PARENTS +import org.opendc.trace.conv.TASK_REQ_NCPUS +import org.opendc.trace.conv.TASK_RUNTIME +import org.opendc.trace.conv.TASK_SUBMIT_TIME +import org.opendc.trace.conv.TASK_USER_ID +import org.opendc.trace.conv.TASK_WAIT_TIME +import org.opendc.trace.conv.TASK_WORKFLOW_ID /** * A [ReadSupport] instance for [Task] objects. diff --git a/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/parquet/TaskRecordMaterializer.kt b/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/parquet/TaskRecordMaterializer.kt index 08da5eaf..f188a3ff 100644 --- a/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/parquet/TaskRecordMaterializer.kt +++ b/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/parquet/TaskRecordMaterializer.kt @@ -22,7 +22,10 @@ package org.opendc.trace.wtf.parquet -import org.apache.parquet.io.api.* +import org.apache.parquet.io.api.Converter +import org.apache.parquet.io.api.GroupConverter +import org.apache.parquet.io.api.PrimitiveConverter +import org.apache.parquet.io.api.RecordMaterializer import org.apache.parquet.schema.MessageType import java.time.Duration import java.time.Instant diff --git a/opendc-trace/opendc-trace-wtf/src/test/kotlin/org/opendc/trace/wtf/WtfTraceFormatTest.kt b/opendc-trace/opendc-trace-wtf/src/test/kotlin/org/opendc/trace/wtf/WtfTraceFormatTest.kt index f6b821c2..16462217 100644 --- a/opendc-trace/opendc-trace-wtf/src/test/kotlin/org/opendc/trace/wtf/WtfTraceFormatTest.kt +++ b/opendc-trace/opendc-trace-wtf/src/test/kotlin/org/opendc/trace/wtf/WtfTraceFormatTest.kt @@ -22,12 +22,23 @@ package org.opendc.trace.wtf -import org.junit.jupiter.api.* -import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertDoesNotThrow +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Nested +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import org.opendc.trace.TableColumn import org.opendc.trace.TableReader -import org.opendc.trace.conv.* +import org.opendc.trace.conv.TABLE_TASKS +import org.opendc.trace.conv.TASK_ID +import org.opendc.trace.conv.TASK_PARENTS +import org.opendc.trace.conv.TASK_RUNTIME +import org.opendc.trace.conv.TASK_SUBMIT_TIME +import org.opendc.trace.conv.TASK_WORKFLOW_ID import org.opendc.trace.testkit.TableReaderTestKit import java.nio.file.Paths import java.time.Duration diff --git a/opendc-web/opendc-web-client/src/main/kotlin/org/opendc/web/client/ProjectResource.kt b/opendc-web/opendc-web-client/src/main/kotlin/org/opendc/web/client/ProjectResource.kt index 12635b89..579d0d66 100644 --- a/opendc-web/opendc-web-client/src/main/kotlin/org/opendc/web/client/ProjectResource.kt +++ b/opendc-web/opendc-web-client/src/main/kotlin/org/opendc/web/client/ProjectResource.kt @@ -22,7 +22,9 @@ package org.opendc.web.client -import org.opendc.web.client.internal.* +import org.opendc.web.client.internal.delete +import org.opendc.web.client.internal.get +import org.opendc.web.client.internal.post import org.opendc.web.client.transport.TransportClient import org.opendc.web.proto.user.Project diff --git a/opendc-web/opendc-web-client/src/main/kotlin/org/opendc/web/client/TraceResource.kt b/opendc-web/opendc-web-client/src/main/kotlin/org/opendc/web/client/TraceResource.kt index 8201c432..b4a8c089 100644 --- a/opendc-web/opendc-web-client/src/main/kotlin/org/opendc/web/client/TraceResource.kt +++ b/opendc-web/opendc-web-client/src/main/kotlin/org/opendc/web/client/TraceResource.kt @@ -22,7 +22,7 @@ package org.opendc.web.client -import org.opendc.web.client.internal.* +import org.opendc.web.client.internal.get import org.opendc.web.client.transport.TransportClient import org.opendc.web.proto.Trace diff --git a/opendc-web/opendc-web-client/src/main/kotlin/org/opendc/web/client/runner/JobResource.kt b/opendc-web/opendc-web-client/src/main/kotlin/org/opendc/web/client/runner/JobResource.kt index 372a92d7..ad3f1c9b 100644 --- a/opendc-web/opendc-web-client/src/main/kotlin/org/opendc/web/client/runner/JobResource.kt +++ b/opendc-web/opendc-web-client/src/main/kotlin/org/opendc/web/client/runner/JobResource.kt @@ -22,7 +22,8 @@ package org.opendc.web.client.runner -import org.opendc.web.client.internal.* +import org.opendc.web.client.internal.get +import org.opendc.web.client.internal.post import org.opendc.web.client.transport.TransportClient import org.opendc.web.proto.runner.Job diff --git a/opendc-web/opendc-web-client/src/main/kotlin/org/opendc/web/client/runner/OpenDCRunnerClient.kt b/opendc-web/opendc-web-client/src/main/kotlin/org/opendc/web/client/runner/OpenDCRunnerClient.kt index e2112b8c..98785a55 100644 --- a/opendc-web/opendc-web-client/src/main/kotlin/org/opendc/web/client/runner/OpenDCRunnerClient.kt +++ b/opendc-web/opendc-web-client/src/main/kotlin/org/opendc/web/client/runner/OpenDCRunnerClient.kt @@ -22,7 +22,8 @@ package org.opendc.web.client.runner -import org.opendc.web.client.* +import org.opendc.web.client.SchedulerResource +import org.opendc.web.client.TraceResource import org.opendc.web.client.auth.AuthController import org.opendc.web.client.transport.HttpTransportClient import org.opendc.web.client.transport.TransportClient diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Scenario.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Scenario.kt index c5e609ec..aeffc4d7 100644 --- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Scenario.kt +++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Scenario.kt @@ -23,7 +23,8 @@ package org.opendc.web.proto.runner import org.eclipse.microprofile.openapi.annotations.media.Schema -import org.opendc.web.proto.* +import org.opendc.web.proto.OperationalPhenomena +import org.opendc.web.proto.Workload /** * A [Scenario] that is exposed to an OpenDC runner. diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Topology.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Topology.kt index ea576e71..4bffdee9 100644 --- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Topology.kt +++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Topology.kt @@ -23,7 +23,7 @@ package org.opendc.web.proto.runner import org.eclipse.microprofile.openapi.annotations.media.Schema -import org.opendc.web.proto.* +import org.opendc.web.proto.Room import java.time.Instant /** 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 4cfbdd7c..56fecf78 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 @@ -23,7 +23,11 @@ package org.opendc.web.runner import com.github.ajalt.clikt.core.CliktCommand -import com.github.ajalt.clikt.parameters.options.* +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.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 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 d340d31c..b0f99084 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 @@ -24,8 +24,16 @@ package org.opendc.web.runner import mu.KotlinLogging import org.opendc.compute.service.ComputeService -import org.opendc.experiments.compute.* +import org.opendc.experiments.compute.ComputeWorkloadLoader +import org.opendc.experiments.compute.createComputeScheduler +import org.opendc.experiments.compute.grid5000 +import org.opendc.experiments.compute.registerComputeMonitor +import org.opendc.experiments.compute.replay +import org.opendc.experiments.compute.sampleByLoad +import org.opendc.experiments.compute.setupComputeService +import org.opendc.experiments.compute.setupHosts import org.opendc.experiments.compute.topology.HostSpec +import org.opendc.experiments.compute.trace import org.opendc.experiments.provisioner.Provisioner import org.opendc.simulator.compute.model.MachineModel import org.opendc.simulator.compute.model.MemoryUnit @@ -40,9 +48,16 @@ import org.opendc.web.proto.runner.Topology import org.opendc.web.runner.internal.WebComputeMonitor import java.io.File import java.time.Duration -import java.util.* -import java.util.concurrent.* +import java.util.Random +import java.util.UUID +import java.util.concurrent.Executors +import java.util.concurrent.ForkJoinPool import java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory +import java.util.concurrent.ForkJoinWorkerThread +import java.util.concurrent.RecursiveAction +import java.util.concurrent.RecursiveTask +import java.util.concurrent.ScheduledExecutorService +import java.util.concurrent.TimeUnit /** * Class to execute the pending jobs via the OpenDC web API. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Job.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Job.kt index 024e7b89..c07e07f0 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Job.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Job.kt @@ -27,7 +27,17 @@ import org.hibernate.annotations.TypeDef import org.opendc.web.proto.JobState import org.opendc.web.server.util.hibernate.json.JsonType import java.time.Instant -import javax.persistence.* +import javax.persistence.Column +import javax.persistence.Entity +import javax.persistence.FetchType +import javax.persistence.GeneratedValue +import javax.persistence.GenerationType +import javax.persistence.Id +import javax.persistence.JoinColumn +import javax.persistence.NamedQueries +import javax.persistence.NamedQuery +import javax.persistence.OneToOne +import javax.persistence.Table /** * A simulation job to be run by the simulator. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Portfolio.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Portfolio.kt index 3e3f76a0..5b686d5f 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Portfolio.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Portfolio.kt @@ -26,7 +26,21 @@ import org.hibernate.annotations.Type import org.hibernate.annotations.TypeDef import org.opendc.web.proto.Targets import org.opendc.web.server.util.hibernate.json.JsonType -import javax.persistence.* +import javax.persistence.CascadeType +import javax.persistence.Column +import javax.persistence.Entity +import javax.persistence.GeneratedValue +import javax.persistence.GenerationType +import javax.persistence.Id +import javax.persistence.Index +import javax.persistence.JoinColumn +import javax.persistence.ManyToOne +import javax.persistence.NamedQueries +import javax.persistence.NamedQuery +import javax.persistence.OneToMany +import javax.persistence.OrderBy +import javax.persistence.Table +import javax.persistence.UniqueConstraint /** * A portfolio is the composition of multiple scenarios. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Project.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Project.kt index aa98b677..5eb925ea 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Project.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Project.kt @@ -23,7 +23,17 @@ package org.opendc.web.server.model import java.time.Instant -import javax.persistence.* +import javax.persistence.CascadeType +import javax.persistence.Column +import javax.persistence.Entity +import javax.persistence.GeneratedValue +import javax.persistence.GenerationType +import javax.persistence.Id +import javax.persistence.NamedQueries +import javax.persistence.NamedQuery +import javax.persistence.OneToMany +import javax.persistence.OrderBy +import javax.persistence.Table /** * A project in OpenDC encapsulates all the datacenter designs and simulation runs for a set of users. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/ProjectAuthorization.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/ProjectAuthorization.kt index a353186e..791725cd 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/ProjectAuthorization.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/ProjectAuthorization.kt @@ -23,7 +23,13 @@ package org.opendc.web.server.model import org.opendc.web.proto.user.ProjectRole -import javax.persistence.* +import javax.persistence.Column +import javax.persistence.EmbeddedId +import javax.persistence.Entity +import javax.persistence.JoinColumn +import javax.persistence.ManyToOne +import javax.persistence.MapsId +import javax.persistence.Table /** * An authorization for some user to participate in a project. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Scenario.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Scenario.kt index e40cff47..a7258e7b 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Scenario.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Scenario.kt @@ -26,7 +26,21 @@ import org.hibernate.annotations.Type import org.hibernate.annotations.TypeDef import org.opendc.web.proto.OperationalPhenomena import org.opendc.web.server.util.hibernate.json.JsonType -import javax.persistence.* +import javax.persistence.CascadeType +import javax.persistence.Column +import javax.persistence.Embedded +import javax.persistence.Entity +import javax.persistence.GeneratedValue +import javax.persistence.GenerationType +import javax.persistence.Id +import javax.persistence.Index +import javax.persistence.JoinColumn +import javax.persistence.ManyToOne +import javax.persistence.NamedQueries +import javax.persistence.NamedQuery +import javax.persistence.OneToOne +import javax.persistence.Table +import javax.persistence.UniqueConstraint /** * A single scenario to be explored by the simulator. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Topology.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Topology.kt index a190b1ee..26368455 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Topology.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Topology.kt @@ -27,7 +27,18 @@ import org.hibernate.annotations.TypeDef import org.opendc.web.proto.Room import org.opendc.web.server.util.hibernate.json.JsonType import java.time.Instant -import javax.persistence.* +import javax.persistence.Column +import javax.persistence.Entity +import javax.persistence.GeneratedValue +import javax.persistence.GenerationType +import javax.persistence.Id +import javax.persistence.Index +import javax.persistence.JoinColumn +import javax.persistence.ManyToOne +import javax.persistence.NamedQueries +import javax.persistence.NamedQuery +import javax.persistence.Table +import javax.persistence.UniqueConstraint /** * A datacenter design in OpenDC. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Trace.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Trace.kt index 8aaac613..0fc79ca8 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Trace.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Trace.kt @@ -22,7 +22,12 @@ package org.opendc.web.server.model -import javax.persistence.* +import javax.persistence.Column +import javax.persistence.Entity +import javax.persistence.Id +import javax.persistence.NamedQueries +import javax.persistence.NamedQuery +import javax.persistence.Table /** * A workload trace available for simulation. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/TraceResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/TraceResource.kt index f46f7f91..a33bd8f1 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/TraceResource.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/TraceResource.kt @@ -25,7 +25,10 @@ package org.opendc.web.server.rest import org.opendc.web.proto.Trace import org.opendc.web.server.service.TraceService import javax.inject.Inject -import javax.ws.rs.* +import javax.ws.rs.GET +import javax.ws.rs.Path +import javax.ws.rs.PathParam +import javax.ws.rs.WebApplicationException /** * A resource representing the workload traces available in the OpenDC instance. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/runner/JobResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/runner/JobResource.kt index 351a2237..4aa2f6a1 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/runner/JobResource.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/runner/JobResource.kt @@ -28,7 +28,11 @@ import javax.annotation.security.RolesAllowed import javax.inject.Inject import javax.transaction.Transactional import javax.validation.Valid -import javax.ws.rs.* +import javax.ws.rs.GET +import javax.ws.rs.POST +import javax.ws.rs.Path +import javax.ws.rs.PathParam +import javax.ws.rs.WebApplicationException /** * A resource representing the available simulation jobs. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioResource.kt index 2a9d6f1b..da565fe4 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioResource.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioResource.kt @@ -29,7 +29,12 @@ import javax.annotation.security.RolesAllowed import javax.inject.Inject import javax.transaction.Transactional import javax.validation.Valid -import javax.ws.rs.* +import javax.ws.rs.DELETE +import javax.ws.rs.GET +import javax.ws.rs.POST +import javax.ws.rs.Path +import javax.ws.rs.PathParam +import javax.ws.rs.WebApplicationException /** * A resource representing the portfolios of a project. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResource.kt index f2372bde..515f6be6 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResource.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResource.kt @@ -29,7 +29,11 @@ import javax.annotation.security.RolesAllowed import javax.inject.Inject import javax.transaction.Transactional import javax.validation.Valid -import javax.ws.rs.* +import javax.ws.rs.GET +import javax.ws.rs.POST +import javax.ws.rs.Path +import javax.ws.rs.PathParam +import javax.ws.rs.WebApplicationException /** * A resource representing the scenarios of a portfolio. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/ProjectResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/ProjectResource.kt index f3d96f55..817f53a5 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/ProjectResource.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/ProjectResource.kt @@ -29,7 +29,12 @@ import javax.annotation.security.RolesAllowed import javax.inject.Inject import javax.transaction.Transactional import javax.validation.Valid -import javax.ws.rs.* +import javax.ws.rs.DELETE +import javax.ws.rs.GET +import javax.ws.rs.POST +import javax.ws.rs.Path +import javax.ws.rs.PathParam +import javax.ws.rs.WebApplicationException /** * A resource representing the created projects. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/ScenarioResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/ScenarioResource.kt index 24cdcb6a..56bb4290 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/ScenarioResource.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/ScenarioResource.kt @@ -28,7 +28,11 @@ import org.opendc.web.server.service.ScenarioService import javax.annotation.security.RolesAllowed import javax.inject.Inject import javax.transaction.Transactional -import javax.ws.rs.* +import javax.ws.rs.DELETE +import javax.ws.rs.GET +import javax.ws.rs.Path +import javax.ws.rs.PathParam +import javax.ws.rs.WebApplicationException /** * A resource representing the scenarios of a portfolio. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/TopologyResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/TopologyResource.kt index 40b3741c..8eef66c8 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/TopologyResource.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/TopologyResource.kt @@ -29,7 +29,13 @@ import javax.annotation.security.RolesAllowed import javax.inject.Inject import javax.transaction.Transactional import javax.validation.Valid -import javax.ws.rs.* +import javax.ws.rs.DELETE +import javax.ws.rs.GET +import javax.ws.rs.POST +import javax.ws.rs.PUT +import javax.ws.rs.Path +import javax.ws.rs.PathParam +import javax.ws.rs.WebApplicationException /** * A resource representing the constructed datacenter topologies. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/PortfolioService.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/PortfolioService.kt index 0d380190..c83b7a54 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/PortfolioService.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/PortfolioService.kt @@ -23,7 +23,6 @@ package org.opendc.web.server.service import org.opendc.web.proto.user.Portfolio -import org.opendc.web.server.model.* import org.opendc.web.server.repository.PortfolioRepository import org.opendc.web.server.repository.ProjectRepository import java.time.Instant diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ProjectService.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ProjectService.kt index 44348195..2fc5a054 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ProjectService.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ProjectService.kt @@ -22,13 +22,15 @@ package org.opendc.web.server.service -import org.opendc.web.proto.user.Project import org.opendc.web.proto.user.ProjectRole -import org.opendc.web.server.model.* +import org.opendc.web.server.model.Project +import org.opendc.web.server.model.ProjectAuthorization +import org.opendc.web.server.model.ProjectAuthorizationKey import org.opendc.web.server.repository.ProjectRepository import java.time.Instant import javax.enterprise.context.ApplicationScoped import javax.inject.Inject +import org.opendc.web.proto.user.Project as ProjectDto /** * Service for managing [Project]s. @@ -38,21 +40,21 @@ class ProjectService @Inject constructor(private val repository: ProjectReposito /** * List all projects for the user with the specified [userId]. */ - fun findWithUser(userId: String): List { + fun findWithUser(userId: String): List { return repository.findAll(userId).map { it.toUserDto() } } /** * Obtain the project with the specified [id] for the user with the specified [userId]. */ - fun findWithUser(userId: String, id: Long): Project? { + fun findWithUser(userId: String, id: Long): ProjectDto? { return repository.findOne(userId, id)?.toUserDto() } /** * Create a new [Project] for the user with the specified [userId]. */ - fun createForUser(userId: String, name: String): Project { + fun createForUser(userId: String, name: String): ProjectDto { val now = Instant.now() val entity = Project(0, name, now) repository.save(entity) @@ -71,7 +73,7 @@ class ProjectService @Inject constructor(private val repository: ProjectReposito * @param userId The user that invokes the action. * @param id The identifier of the project. */ - fun deleteWithUser(userId: String, id: Long): Project? { + fun deleteWithUser(userId: String, id: Long): ProjectDto? { val auth = repository.findOne(userId, id) ?: return null if (!auth.role.canDelete) { diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ScenarioService.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ScenarioService.kt index 5b56068d..1929f44b 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ScenarioService.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ScenarioService.kt @@ -22,12 +22,18 @@ package org.opendc.web.server.service -import org.opendc.web.proto.user.Scenario -import org.opendc.web.server.model.* -import org.opendc.web.server.repository.* +import org.opendc.web.server.model.Job +import org.opendc.web.server.model.Scenario +import org.opendc.web.server.model.Workload +import org.opendc.web.server.repository.PortfolioRepository +import org.opendc.web.server.repository.ProjectRepository +import org.opendc.web.server.repository.ScenarioRepository +import org.opendc.web.server.repository.TopologyRepository +import org.opendc.web.server.repository.TraceRepository import java.time.Instant import javax.enterprise.context.ApplicationScoped import javax.inject.Inject +import org.opendc.web.proto.user.Scenario as ScenarioDto /** * Service for managing [Scenario]s. @@ -43,7 +49,7 @@ class ScenarioService @Inject constructor( /** * List all [Scenario]s that belong a certain portfolio. */ - fun findAll(userId: String, projectId: Long, number: Int): List { + fun findAll(userId: String, projectId: Long, number: Int): List { // User must have access to project val auth = projectRepository.findOne(userId, projectId) ?: return emptyList() val project = auth.toUserDto() @@ -53,7 +59,7 @@ class ScenarioService @Inject constructor( /** * Obtain a [Scenario] by identifier. */ - fun findOne(userId: String, projectId: Long, number: Int): Scenario? { + fun findOne(userId: String, projectId: Long, number: Int): ScenarioDto? { // User must have access to project val auth = projectRepository.findOne(userId, projectId) ?: return null val project = auth.toUserDto() @@ -63,7 +69,7 @@ class ScenarioService @Inject constructor( /** * Delete the specified scenario. */ - fun delete(userId: String, projectId: Long, number: Int): Scenario? { + fun delete(userId: String, projectId: Long, number: Int): ScenarioDto? { // User must have access to project val auth = projectRepository.findOne(userId, projectId) @@ -82,7 +88,7 @@ class ScenarioService @Inject constructor( /** * Construct a new [Scenario] with the specified data. */ - fun create(userId: String, projectId: Long, portfolioNumber: Int, request: Scenario.Create): Scenario? { + fun create(userId: String, projectId: Long, portfolioNumber: Int, request: ScenarioDto.Create): ScenarioDto? { // User must have access to project val auth = projectRepository.findOne(userId, projectId) diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/UserConversions.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/UserConversions.kt index ee78d103..e28d9c0f 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/UserConversions.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/UserConversions.kt @@ -23,7 +23,13 @@ package org.opendc.web.server.service import org.opendc.web.proto.user.Project -import org.opendc.web.server.model.* +import org.opendc.web.server.model.Job +import org.opendc.web.server.model.Portfolio +import org.opendc.web.server.model.ProjectAuthorization +import org.opendc.web.server.model.Scenario +import org.opendc.web.server.model.Topology +import org.opendc.web.server.model.Trace +import org.opendc.web.server.model.Workload /** * Conversions into DTOs provided to users. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt index 216c465f..cc8dad48 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt @@ -27,7 +27,10 @@ import org.hibernate.type.descriptor.WrapperOptions import org.hibernate.type.descriptor.java.JavaTypeDescriptor import org.hibernate.type.descriptor.sql.BasicBinder import java.io.UnsupportedEncodingException -import java.sql.* +import java.sql.CallableStatement +import java.sql.PreparedStatement +import java.sql.ResultSet +import java.sql.Types /** * A [AbstractJsonSqlTypeDescriptor] that stores the JSON as UTF-8 encoded bytes. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonSqlTypeDescriptor.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonSqlTypeDescriptor.kt index f5069c4c..bd22ffbe 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonSqlTypeDescriptor.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonSqlTypeDescriptor.kt @@ -32,7 +32,10 @@ import org.hibernate.type.descriptor.java.JavaTypeDescriptor import org.hibernate.type.descriptor.sql.BasicBinder import org.hibernate.type.descriptor.sql.BasicExtractor import org.hibernate.type.descriptor.sql.SqlTypeDescriptor -import java.sql.* +import java.sql.CallableStatement +import java.sql.PreparedStatement +import java.sql.ResultSet +import java.sql.Types /** * A [SqlTypeDescriptor] that automatically selects the correct implementation for the database dialect. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonStringSqlTypeDescriptor.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonStringSqlTypeDescriptor.kt index 3d10cb0e..63f32849 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonStringSqlTypeDescriptor.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonStringSqlTypeDescriptor.kt @@ -4,7 +4,10 @@ import org.hibernate.type.descriptor.ValueBinder import org.hibernate.type.descriptor.WrapperOptions import org.hibernate.type.descriptor.java.JavaTypeDescriptor import org.hibernate.type.descriptor.sql.BasicBinder -import java.sql.* +import java.sql.CallableStatement +import java.sql.PreparedStatement +import java.sql.ResultSet +import java.sql.Types /** * A [AbstractJsonSqlTypeDescriptor] that stores the JSON as string (VARCHAR). diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonType.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonType.kt index 98663640..9ee21a4c 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonType.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonType.kt @@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper import org.hibernate.type.AbstractSingleColumnStandardBasicType import org.hibernate.type.BasicType import org.hibernate.usertype.DynamicParameterizedType -import java.util.* +import java.util.Properties import javax.enterprise.inject.spi.CDI /** diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonTypeDescriptor.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonTypeDescriptor.kt index 6c6078dd..9407f940 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonTypeDescriptor.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonTypeDescriptor.kt @@ -40,7 +40,8 @@ import java.io.InputStream import java.lang.reflect.Type import java.sql.Blob import java.sql.SQLException -import java.util.* +import java.util.Objects +import java.util.Properties /** * An [AbstractTypeDescriptor] implementation for Hibernate JSON type. diff --git a/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/runner/JobResourceTest.kt b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/runner/JobResourceTest.kt index c96788b0..71aaa8a4 100644 --- a/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/runner/JobResourceTest.kt +++ b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/runner/JobResourceTest.kt @@ -35,8 +35,11 @@ import io.restassured.module.kotlin.extensions.When import org.hamcrest.Matchers.equalTo import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.opendc.web.proto.* +import org.opendc.web.proto.JobState +import org.opendc.web.proto.OperationalPhenomena import org.opendc.web.proto.Targets +import org.opendc.web.proto.Trace +import org.opendc.web.proto.Workload import org.opendc.web.proto.runner.Job import org.opendc.web.proto.runner.Portfolio import org.opendc.web.proto.runner.Scenario diff --git a/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResourceTest.kt b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResourceTest.kt index 13c47d19..676a43dc 100644 --- a/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResourceTest.kt +++ b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResourceTest.kt @@ -35,8 +35,17 @@ import io.restassured.module.kotlin.extensions.When import org.hamcrest.Matchers import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.opendc.web.proto.* -import org.opendc.web.proto.user.* +import org.opendc.web.proto.JobState +import org.opendc.web.proto.OperationalPhenomena +import org.opendc.web.proto.Targets +import org.opendc.web.proto.Trace +import org.opendc.web.proto.Workload +import org.opendc.web.proto.user.Job +import org.opendc.web.proto.user.Portfolio +import org.opendc.web.proto.user.Project +import org.opendc.web.proto.user.ProjectRole +import org.opendc.web.proto.user.Scenario +import org.opendc.web.proto.user.Topology import org.opendc.web.server.service.ScenarioService import java.time.Instant diff --git a/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/ScenarioResourceTest.kt b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/ScenarioResourceTest.kt index 1d63679e..2e080971 100644 --- a/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/ScenarioResourceTest.kt +++ b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/user/ScenarioResourceTest.kt @@ -35,8 +35,17 @@ import io.restassured.module.kotlin.extensions.When import org.hamcrest.Matchers import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.opendc.web.proto.* -import org.opendc.web.proto.user.* +import org.opendc.web.proto.JobState +import org.opendc.web.proto.OperationalPhenomena +import org.opendc.web.proto.Targets +import org.opendc.web.proto.Trace +import org.opendc.web.proto.Workload +import org.opendc.web.proto.user.Job +import org.opendc.web.proto.user.Portfolio +import org.opendc.web.proto.user.Project +import org.opendc.web.proto.user.ProjectRole +import org.opendc.web.proto.user.Scenario +import org.opendc.web.proto.user.Topology import org.opendc.web.server.service.ScenarioService import java.time.Instant diff --git a/opendc-workflow/opendc-workflow-api/src/main/kotlin/org/opendc/workflow/api/Job.kt b/opendc-workflow/opendc-workflow-api/src/main/kotlin/org/opendc/workflow/api/Job.kt index 5e8b0b9e..b59ad6da 100644 --- a/opendc-workflow/opendc-workflow-api/src/main/kotlin/org/opendc/workflow/api/Job.kt +++ b/opendc-workflow/opendc-workflow-api/src/main/kotlin/org/opendc/workflow/api/Job.kt @@ -22,7 +22,7 @@ package org.opendc.workflow.api -import java.util.* +import java.util.UUID /** * A workload that represents a directed acyclic graph (DAG) of tasks with control and data dependencies between tasks. diff --git a/opendc-workflow/opendc-workflow-api/src/main/kotlin/org/opendc/workflow/api/Task.kt b/opendc-workflow/opendc-workflow-api/src/main/kotlin/org/opendc/workflow/api/Task.kt index d91f9879..f805c210 100644 --- a/opendc-workflow/opendc-workflow-api/src/main/kotlin/org/opendc/workflow/api/Task.kt +++ b/opendc-workflow/opendc-workflow-api/src/main/kotlin/org/opendc/workflow/api/Task.kt @@ -22,14 +22,13 @@ package org.opendc.workflow.api -import java.util.* +import java.util.UUID /** * A stage of a [Job]. * * @property uid A unique identified of this task. * @property name The name of this task. - * @property image The application image to run as part of this workflow task. * @property dependencies The dependencies of this task in order for it to execute. * @property metadata Additional metadata for this task. */ diff --git a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/internal/WorkflowServiceImpl.kt b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/internal/WorkflowServiceImpl.kt index 899810a2..b1780896 100644 --- a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/internal/WorkflowServiceImpl.kt +++ b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/internal/WorkflowServiceImpl.kt @@ -22,12 +22,19 @@ package org.opendc.workflow.service.internal -import kotlinx.coroutines.* +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.cancel +import kotlinx.coroutines.launch +import kotlinx.coroutines.suspendCancellableCoroutine import org.opendc.common.util.Pacer -import org.opendc.compute.api.* +import org.opendc.compute.api.ComputeClient +import org.opendc.compute.api.Image +import org.opendc.compute.api.Server +import org.opendc.compute.api.ServerState +import org.opendc.compute.api.ServerWatcher import org.opendc.workflow.api.Job import org.opendc.workflow.api.WORKFLOW_TASK_CORES -import org.opendc.workflow.service.* +import org.opendc.workflow.service.WorkflowService import org.opendc.workflow.service.scheduler.job.JobAdmissionPolicy import org.opendc.workflow.service.scheduler.job.JobOrderPolicy import org.opendc.workflow.service.scheduler.task.TaskEligibilityPolicy @@ -35,7 +42,8 @@ import org.opendc.workflow.service.scheduler.task.TaskOrderPolicy import org.opendc.workflow.service.scheduler.telemetry.SchedulerStats import java.time.Clock import java.time.Duration -import java.util.* +import java.util.PriorityQueue +import java.util.Queue import kotlin.coroutines.CoroutineContext import kotlin.coroutines.resume @@ -56,7 +64,7 @@ public class WorkflowServiceImpl( /** * The [CoroutineScope] of the service bounded by the lifecycle of the service. */ - private val scope = CoroutineScope(context + Job()) + private val scope = CoroutineScope(context + kotlinx.coroutines.Job()) /** * The incoming jobs ready to be processed by the scheduler. diff --git a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/job/RandomJobOrderPolicy.kt b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/job/RandomJobOrderPolicy.kt index 1b359125..4f8dc05b 100644 --- a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/job/RandomJobOrderPolicy.kt +++ b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/job/RandomJobOrderPolicy.kt @@ -26,7 +26,7 @@ import org.opendc.workflow.api.Job import org.opendc.workflow.service.internal.JobState import org.opendc.workflow.service.internal.WorkflowSchedulerListener import org.opendc.workflow.service.internal.WorkflowServiceImpl -import java.util.* +import java.util.Random import kotlin.collections.HashMap /** diff --git a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/DurationTaskOrderPolicy.kt b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/DurationTaskOrderPolicy.kt index d9fde53a..a2ca2086 100644 --- a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/DurationTaskOrderPolicy.kt +++ b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/DurationTaskOrderPolicy.kt @@ -26,7 +26,7 @@ import org.opendc.workflow.api.WORKFLOW_TASK_DEADLINE import org.opendc.workflow.service.internal.TaskState import org.opendc.workflow.service.internal.WorkflowSchedulerListener import org.opendc.workflow.service.internal.WorkflowServiceImpl -import java.util.* +import java.util.UUID import kotlin.collections.HashMap import kotlin.collections.getValue import kotlin.collections.set diff --git a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/RandomTaskEligibilityPolicy.kt b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/RandomTaskEligibilityPolicy.kt index a01439c2..e675d836 100644 --- a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/RandomTaskEligibilityPolicy.kt +++ b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/RandomTaskEligibilityPolicy.kt @@ -24,7 +24,7 @@ package org.opendc.workflow.service.scheduler.task import org.opendc.workflow.service.internal.TaskState import org.opendc.workflow.service.internal.WorkflowServiceImpl -import java.util.* +import java.util.Random /** * A [TaskEligibilityPolicy] that randomly accepts tasks in the system with some [probability]. diff --git a/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceTest.kt b/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceTest.kt index e37f489d..096a7ebd 100644 --- a/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceTest.kt +++ b/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceTest.kt @@ -37,7 +37,10 @@ import org.opendc.experiments.compute.setupHosts import org.opendc.experiments.compute.topology.HostSpec import org.opendc.experiments.provisioner.Provisioner import org.opendc.experiments.provisioner.ProvisioningContext -import org.opendc.experiments.workflow.* +import org.opendc.experiments.workflow.WorkflowSchedulerSpec +import org.opendc.experiments.workflow.replay +import org.opendc.experiments.workflow.setupWorkflowService +import org.opendc.experiments.workflow.toJobs import org.opendc.simulator.compute.model.MachineModel import org.opendc.simulator.compute.model.MemoryUnit import org.opendc.simulator.compute.model.ProcessingNode @@ -53,7 +56,7 @@ import org.opendc.workflow.service.scheduler.task.NullTaskEligibilityPolicy import org.opendc.workflow.service.scheduler.task.SubmissionTimeTaskOrderPolicy import java.nio.file.Paths import java.time.Duration -import java.util.* +import java.util.UUID /** * Integration test suite for the [WorkflowService]. -- cgit v1.2.3 From 47357afd16f928260db34d4dd3e686fb9ee7c5ff Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 6 Oct 2022 13:13:10 +0200 Subject: build: Switch to Spotless for formatting This change updates the build configuration to use Spotless for code formating of both Kotlin and Java. --- buildSrc/build.gradle.kts | 2 +- .../src/main/kotlin/java-conventions.gradle.kts | 1 + .../src/main/kotlin/kotlin-conventions.gradle.kts | 8 +- buildSrc/src/main/kotlin/license.kt | 22 ++++ .../src/main/kotlin/quarkus-conventions.gradle.kts | 10 -- .../main/kotlin/spotless-conventions.gradle.kts | 59 +++++++++++ gradle/libs.versions.toml | 4 +- .../org/opendc/common/util/TimerSchedulerTest.kt | 1 - .../kotlin/org/opendc/compute/api/ServerState.kt | 2 +- .../org/opendc/compute/service/ComputeService.kt | 2 +- .../org/opendc/compute/service/driver/HostState.kt | 2 +- .../service/driver/telemetry/HostSystemStats.kt | 2 +- .../service/scheduler/weights/HostWeigher.kt | 2 +- .../service/scheduler/FilterSchedulerTest.kt | 32 +++--- .../org/opendc/compute/simulator/SimHostTest.kt | 2 +- .../org/opendc/experiments/ServiceRegistryTest.kt | 2 +- .../org/opendc/experiments/capelin/CapelinCli.kt | 3 +- .../opendc/experiments/capelin/CapelinRunner.kt | 5 +- .../capelin/topology/TopologyFactories.kt | 1 + .../experiments/capelin/CapelinIntegrationTest.kt | 12 +-- .../experiments/compute/ComputeSchedulers.kt | 1 + .../org/opendc/experiments/compute/ComputeSteps.kt | 1 + .../experiments/compute/ComputeWorkloadLoader.kt | 2 - .../opendc/experiments/compute/ComputeWorkloads.kt | 1 + .../opendc/experiments/compute/FailureModels.kt | 1 + .../org/opendc/experiments/compute/TraceHelpers.kt | 1 + .../export/parquet/ParquetHostDataWriter.kt | 2 +- .../export/parquet/ParquetServiceDataWriter.kt | 2 +- .../faas/FaaSServiceProvisioningStep.kt | 5 +- .../org/opendc/experiments/faas/FaaSSteps.kt | 1 + .../org/opendc/experiments/faas/TraceHelpers.kt | 1 + .../org/opendc/experiments/faas/FaaSExperiment.kt | 2 +- .../opendc/experiments/tf20/core/SimTFDevice.kt | 3 +- .../experiments/tf20/keras/layer/conv/Conv2D.kt | 2 +- .../tf20/keras/layer/core/ActivationLayer.kt | 2 +- .../org/opendc/experiments/tf20/TensorFlowTest.kt | 28 ++++- .../opendc/experiments/workflow/TraceHelpers.kt | 8 +- .../experiments/workflow/WorkflowSchedulerSpec.kt | 2 +- .../workflow/WorkflowServiceProvisioningStep.kt | 2 +- .../opendc/experiments/workflow/WorkflowSteps.kt | 1 + .../opendc/faas/simulator/SimFaaSServiceTest.kt | 2 +- .../simulator/compute/SimMachineBenchmarks.kt | 4 +- .../simulator/compute/SimBareMetalMachine.kt | 2 +- .../org/opendc/simulator/compute/device/SimPsu.kt | 2 +- .../simulator/compute/kernel/SimHypervisor.kt | 1 + .../kernel/interference/VmInterferenceModel.kt | 5 +- .../compute/power/AsymptoticPowerModel.kt | 7 +- .../compute/power/InterpolationPowerModel.kt | 5 +- .../simulator/compute/power/MsePowerModel.kt | 2 +- .../compute/power/ZeroIdlePowerDecorator.kt | 5 +- .../opendc/simulator/compute/workload/SimTrace.kt | 2 +- .../opendc/simulator/compute/device/SimPsuTest.kt | 2 +- .../compute/kernel/SimFairShareHypervisorTest.kt | 6 +- .../compute/kernel/SimSpaceSharedHypervisorTest.kt | 2 +- .../compute/power/PStatePowerDriverTest.kt | 8 +- .../simulator/compute/power/PowerModelTest.kt | 4 +- .../org/opendc/simulator/SimulationScheduler.java | 5 +- .../main/java/org/opendc/simulator/TaskQueue.java | 10 +- .../kotlin/org/opendc/simulator/TaskQueueTest.kt | 16 +-- .../org/opendc/simulator/flow/FlowForwarder.kt | 5 +- .../flow/internal/FlowConsumerContextImpl.kt | 20 ++-- .../simulator/flow/mux/MaxMinFlowMultiplexer.kt | 8 +- .../flow/mux/ForwardingFlowMultiplexerTest.kt | 2 +- .../flow/mux/MaxMinFlowMultiplexerTest.kt | 4 +- .../kotlin/org/opendc/simulator/power/SimPdu.kt | 2 +- .../kotlin/org/opendc/simulator/power/SimUps.kt | 2 +- .../opendc/trace/conv/InterferenceGroupColumns.kt | 1 + .../org/opendc/trace/conv/ResourceColumns.kt | 1 + .../org/opendc/trace/conv/ResourceStateColumns.kt | 1 + .../main/kotlin/org/opendc/trace/conv/Tables.kt | 1 + .../kotlin/org/opendc/trace/conv/TaskColumns.kt | 1 + .../org/opendc/trace/util/TableColumnConversion.kt | 1 + .../org/opendc/trace/azure/AzureTraceFormat.kt | 4 +- .../org/opendc/trace/azure/AzureTraceFormatTest.kt | 2 +- .../trace/bitbrains/BitbrainsExTraceFormat.kt | 2 +- .../opendc/trace/bitbrains/BitbrainsTraceFormat.kt | 4 +- .../org/opendc/trace/calcite/TraceTableModify.kt | 2 +- .../kotlin/org/opendc/trace/calcite/CalciteTest.kt | 8 +- .../opendc/trace/calcite/TraceSchemaFactoryTest.kt | 2 +- .../kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt | 2 +- .../org/opendc/trace/gwf/GwfTraceFormatTest.kt | 4 +- .../org/opendc/trace/opendc/OdcVmTraceFormat.kt | 11 +- .../trace/opendc/parquet/ResourceReadSupport.kt | 6 +- .../opendc/parquet/ResourceStateReadSupport.kt | 2 +- .../trace/opendc/parquet/ResourceWriteSupport.kt | 2 +- .../opendc/trace/opendc/OdcVmTraceFormatTest.kt | 6 +- .../trace/util/parquet/LocalParquetReader.kt | 10 +- .../org/opendc/trace/swf/SwfTraceFormatTest.kt | 2 +- .../org/opendc/trace/testkit/TableReaderTestKit.kt | 2 +- .../org/opendc/trace/testkit/TableWriterTestKit.kt | 2 +- .../org/opendc/trace/tools/ConvertCommand.kt | 2 +- .../kotlin/org/opendc/trace/tools/QueryCommand.kt | 2 +- .../kotlin/org/opendc/trace/tools/TraceTools.kt | 1 + .../trace/wfformat/WfFormatTraceFormatTest.kt | 4 +- .../opendc/trace/wtf/parquet/TaskReadSupport.kt | 2 +- .../org/opendc/trace/wtf/WtfTraceFormatTest.kt | 4 +- .../src/main/kotlin/org/opendc/web/proto/Room.kt | 2 +- .../main/kotlin/org/opendc/web/proto/RoomTile.kt | 2 +- .../src/main/kotlin/org/opendc/web/proto/Trace.kt | 2 +- .../org/opendc/web/proto/runner/Portfolio.kt | 2 +- .../kotlin/org/opendc/web/proto/runner/Topology.kt | 2 +- .../kotlin/org/opendc/web/proto/user/Portfolio.kt | 2 +- .../org/opendc/web/proto/user/ProjectRole.kt | 2 +- .../kotlin/org/opendc/web/proto/user/Scenario.kt | 2 +- .../kotlin/org/opendc/web/proto/user/Topology.kt | 4 +- .../runner/deployment/OpenDCRunnerProcessor.java | 39 ++++--- .../web/runner/runtime/OpenDCRunnerRecorder.java | 23 ++--- .../runner/runtime/OpenDCRunnerRuntimeConfig.java | 1 - .../src/cli/kotlin/org/opendc/web/runner/Main.kt | 2 +- .../kotlin/org/opendc/web/runner/OpenDCRunner.kt | 7 +- .../web/runner/internal/WebComputeMonitor.kt | 6 +- .../org/opendc/web/server/model/Portfolio.kt | 2 +- .../kotlin/org/opendc/web/server/model/Project.kt | 2 +- .../kotlin/org/opendc/web/server/model/Scenario.kt | 2 +- .../kotlin/org/opendc/web/server/model/Trace.kt | 4 +- .../web/server/rest/user/PortfolioResource.kt | 2 +- .../server/rest/user/PortfolioScenarioResource.kt | 2 +- .../opendc/web/server/service/ScenarioService.kt | 2 +- .../hibernate/json/JsonBinarySqlTypeDescriptor.kt | 22 ++++ .../hibernate/json/JsonBytesSqlTypeDescriptor.kt | 10 +- .../hibernate/json/JsonStringSqlTypeDescriptor.kt | 22 ++++ .../web/server/rest/runner/JobResourceTest.kt | 2 +- .../web/ui/deployment/AuthConfiguration.java | 1 - .../opendc/web/ui/deployment/OpenDCUiConfig.java | 1 - .../web/ui/deployment/OpenDCUiProcessor.java | 115 +++++++++++---------- .../ui/deployment/OpenDCUiRoutingBuildItem.java | 3 +- .../opendc/web/ui/runtime/OpenDCUiRecorder.java | 43 +++----- opendc-web/opendc-web-ui/build.gradle.kts | 4 +- .../kotlin/org/opendc/workflow/api/Metadata.kt | 4 +- .../scheduler/job/LimitJobAdmissionPolicy.kt | 5 +- .../task/BalancingTaskEligibilityPolicy.kt | 5 +- .../task/LimitPerJobTaskEligibilityPolicy.kt | 5 +- .../scheduler/task/LimitTaskEligibilityPolicy.kt | 5 +- .../scheduler/task/RandomTaskEligibilityPolicy.kt | 4 +- .../opendc/workflow/service/WorkflowServiceTest.kt | 2 +- 135 files changed, 496 insertions(+), 340 deletions(-) create mode 100644 buildSrc/src/main/kotlin/license.kt create mode 100644 buildSrc/src/main/kotlin/spotless-conventions.gradle.kts diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 42cbf842..7bd67f72 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -34,7 +34,7 @@ dependencies { implementation(libs.kotlin.gradle) implementation(libs.kotlin.allopen) implementation(libs.kotlin.noarg) - implementation(libs.ktlint.gradle) + implementation(libs.spotless.gradle) implementation(libs.jmh.gradle) implementation(libs.dokka.gradle) diff --git a/buildSrc/src/main/kotlin/java-conventions.gradle.kts b/buildSrc/src/main/kotlin/java-conventions.gradle.kts index d4cc667a..a639a9e1 100644 --- a/buildSrc/src/main/kotlin/java-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/java-conventions.gradle.kts @@ -22,6 +22,7 @@ plugins { `java-library` + id("spotless-conventions") } /* Project configuration */ diff --git a/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts b/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts index 8fb46f5d..5ccc06a4 100644 --- a/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts @@ -25,7 +25,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { id("java-conventions") kotlin("jvm") - id("org.jlleitschuh.gradle.ktlint") + id("spotless-conventions") } /* Project configuration */ @@ -34,9 +34,3 @@ tasks.withType().configureEach { kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn" kotlinOptions.freeCompilerArgs += "-Xjvm-default=all" } - -configure { - // Higher versions currently have issues with formatting where wildcard imports are automatically removed, - // even when in use. - version.set("0.42.1") -} diff --git a/buildSrc/src/main/kotlin/license.kt b/buildSrc/src/main/kotlin/license.kt new file mode 100644 index 00000000..4e90fd4e --- /dev/null +++ b/buildSrc/src/main/kotlin/license.kt @@ -0,0 +1,22 @@ +/* + * Copyright (c) $YEAR 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + diff --git a/buildSrc/src/main/kotlin/quarkus-conventions.gradle.kts b/buildSrc/src/main/kotlin/quarkus-conventions.gradle.kts index 75c4a454..f1adb182 100644 --- a/buildSrc/src/main/kotlin/quarkus-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/quarkus-conventions.gradle.kts @@ -76,13 +76,3 @@ configurations.create("coverageDataElementsForQuarkus") { } } } - -/* Fix for Quarkus/ktlint-gradle incompatibilities */ -tasks.named("runKtlintCheckOverMainSourceSet") { - mustRunAfter(tasks.quarkusGenerateCode) - mustRunAfter(tasks.quarkusGenerateCodeDev) -} - -tasks.named("runKtlintCheckOverTestSourceSet") { - mustRunAfter(tasks.quarkusGenerateCodeTests) -} diff --git a/buildSrc/src/main/kotlin/spotless-conventions.gradle.kts b/buildSrc/src/main/kotlin/spotless-conventions.gradle.kts new file mode 100644 index 00000000..11131cc8 --- /dev/null +++ b/buildSrc/src/main/kotlin/spotless-conventions.gradle.kts @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +plugins { + id("com.diffplug.spotless") +} + +spotless { + pluginManager.withPlugin("java") { + java { + importOrder() + removeUnusedImports() + + palantirJavaFormat() + + trimTrailingWhitespace() + endWithNewline() + + licenseHeaderFile(rootProject.file("buildSrc/src/main/kotlin/license.kt")) + } + } + + pluginManager.withPlugin("org.jetbrains.kotlin.jvm") { + kotlin { + ktlint() + .setUseExperimental(false) + trimTrailingWhitespace() + endWithNewline() + + licenseHeaderFile(rootProject.file("buildSrc/src/main/kotlin/license.kt")) + } + } + + kotlinGradle { + ktlint() + + trimTrailingWhitespace() + endWithNewline() + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c53c16c6..ac1ce5e9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,7 +14,6 @@ junit-jupiter = "5.9.1" kotlin = "1.7.20" kotlin-logging = "3.0.0" kotlinx-coroutines = "1.6.4" -ktlint-gradle = "11.0.0" log4j = "2.19.0" microprofile-openapi = "3.0" microprofile-config = "3.0.1" @@ -25,6 +24,7 @@ quarkus = "2.13.1.Final" quarkus-junit5-mockk = "1.1.1" sentry = "6.4.3" slf4j = "2.0.3" +spotless = "6.11.0" [libraries] # Kotlin @@ -104,5 +104,5 @@ microprofile-config = { module = "org.eclipse.microprofile.config:microprofile-c 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" } -ktlint-gradle = { module = "org.jlleitschuh.gradle:ktlint-gradle", version.ref = "ktlint-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" } diff --git a/opendc-common/src/test/kotlin/org/opendc/common/util/TimerSchedulerTest.kt b/opendc-common/src/test/kotlin/org/opendc/common/util/TimerSchedulerTest.kt index f3d2b23d..22a26111 100644 --- a/opendc-common/src/test/kotlin/org/opendc/common/util/TimerSchedulerTest.kt +++ b/opendc-common/src/test/kotlin/org/opendc/common/util/TimerSchedulerTest.kt @@ -100,7 +100,6 @@ internal class TimerSchedulerTest { scheduler.startSingleTimer(0, 1000) { fail() } scheduler.startSingleTimer(0, 200) { - assertEquals(200, clock.millis()) } } diff --git a/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ServerState.kt b/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ServerState.kt index a4d7d7d7..2b5aebb1 100644 --- a/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ServerState.kt +++ b/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ServerState.kt @@ -49,5 +49,5 @@ public enum class ServerState { /** * The server has been deleted and cannot be started later on. */ - DELETED, + DELETED } diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/ComputeService.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/ComputeService.kt index 28ef7c40..85222c10 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/ComputeService.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/ComputeService.kt @@ -89,7 +89,7 @@ public interface ComputeService : AutoCloseable { context: CoroutineContext, clock: Clock, scheduler: ComputeScheduler, - schedulingQuantum: Duration = Duration.ofMinutes(5), + schedulingQuantum: Duration = Duration.ofMinutes(5) ): ComputeService { return ComputeServiceImpl(context, clock, scheduler, schedulingQuantum) } diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostState.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostState.kt index ca6c625c..544b6530 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostState.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/HostState.kt @@ -39,5 +39,5 @@ public enum class HostState { /** * The host is in an error state and unable to host any guests. */ - ERROR, + ERROR } diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/HostSystemStats.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/HostSystemStats.kt index 9d34a5ce..56bd017d 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/HostSystemStats.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/driver/telemetry/HostSystemStats.kt @@ -47,5 +47,5 @@ public data class HostSystemStats( val guestsTerminated: Int, val guestsRunning: Int, val guestsError: Int, - val guestsInvalid: Int, + val guestsInvalid: Int ) diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/HostWeigher.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/HostWeigher.kt index aca8c4e6..aa8a9d53 100644 --- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/HostWeigher.kt +++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/scheduler/weights/HostWeigher.kt @@ -70,6 +70,6 @@ public interface HostWeigher { public val weights: DoubleArray, public val min: Double, public val max: Double, - public val multiplier: Double, + public val multiplier: Double ) } diff --git a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/scheduler/FilterSchedulerTest.kt b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/scheduler/FilterSchedulerTest.kt index 8ecf7f87..4608bf37 100644 --- a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/scheduler/FilterSchedulerTest.kt +++ b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/scheduler/FilterSchedulerTest.kt @@ -74,7 +74,7 @@ internal class FilterSchedulerTest { fun testNoHosts() { val scheduler = FilterScheduler( filters = emptyList(), - weighers = emptyList(), + weighers = emptyList() ) val server = mockk() @@ -88,7 +88,7 @@ internal class FilterSchedulerTest { fun testNoFiltersAndSchedulers() { val scheduler = FilterScheduler( filters = emptyList(), - weighers = emptyList(), + weighers = emptyList() ) val hostA = mockk() @@ -144,7 +144,7 @@ internal class FilterSchedulerTest { fun testHostIsDown() { val scheduler = FilterScheduler( filters = listOf(ComputeFilter()), - weighers = emptyList(), + weighers = emptyList() ) val host = mockk() @@ -163,7 +163,7 @@ internal class FilterSchedulerTest { fun testHostIsUp() { val scheduler = FilterScheduler( filters = listOf(ComputeFilter()), - weighers = emptyList(), + weighers = emptyList() ) val host = mockk() @@ -182,7 +182,7 @@ internal class FilterSchedulerTest { fun testRamFilter() { val scheduler = FilterScheduler( filters = listOf(RamFilter(1.0)), - weighers = emptyList(), + weighers = emptyList() ) val hostA = mockk() @@ -209,7 +209,7 @@ internal class FilterSchedulerTest { fun testRamFilterOvercommit() { val scheduler = FilterScheduler( filters = listOf(RamFilter(1.5)), - weighers = emptyList(), + weighers = emptyList() ) val host = mockk() @@ -230,7 +230,7 @@ internal class FilterSchedulerTest { fun testVCpuFilter() { val scheduler = FilterScheduler( filters = listOf(VCpuFilter(1.0)), - weighers = emptyList(), + weighers = emptyList() ) val hostA = mockk() @@ -257,7 +257,7 @@ internal class FilterSchedulerTest { fun testVCpuFilterOvercommit() { val scheduler = FilterScheduler( filters = listOf(VCpuFilter(16.0)), - weighers = emptyList(), + weighers = emptyList() ) val host = mockk() @@ -278,7 +278,7 @@ internal class FilterSchedulerTest { fun testVCpuCapacityFilter() { val scheduler = FilterScheduler( filters = listOf(VCpuCapacityFilter()), - weighers = emptyList(), + weighers = emptyList() ) val hostA = mockk() @@ -306,7 +306,7 @@ internal class FilterSchedulerTest { fun testInstanceCountFilter() { val scheduler = FilterScheduler( filters = listOf(InstanceCountFilter(limit = 2)), - weighers = emptyList(), + weighers = emptyList() ) val hostA = mockk() @@ -333,7 +333,7 @@ internal class FilterSchedulerTest { fun testAffinityFilter() { val scheduler = FilterScheduler( filters = listOf(SameHostFilter()), - weighers = emptyList(), + weighers = emptyList() ) val serverA = mockk() @@ -372,7 +372,7 @@ internal class FilterSchedulerTest { fun testAntiAffinityFilter() { val scheduler = FilterScheduler( filters = listOf(DifferentHostFilter()), - weighers = emptyList(), + weighers = emptyList() ) val serverA = mockk() @@ -411,7 +411,7 @@ internal class FilterSchedulerTest { fun testRamWeigher() { val scheduler = FilterScheduler( filters = emptyList(), - weighers = listOf(RamWeigher(1.5)), + weighers = listOf(RamWeigher(1.5)) ) val hostA = mockk() @@ -438,7 +438,7 @@ internal class FilterSchedulerTest { fun testCoreRamWeigher() { val scheduler = FilterScheduler( filters = emptyList(), - weighers = listOf(CoreRamWeigher(1.5)), + weighers = listOf(CoreRamWeigher(1.5)) ) val hostA = mockk() @@ -465,7 +465,7 @@ internal class FilterSchedulerTest { fun testVCpuWeigher() { val scheduler = FilterScheduler( filters = emptyList(), - weighers = listOf(VCpuWeigher(16.0)), + weighers = listOf(VCpuWeigher(16.0)) ) val hostA = mockk() @@ -492,7 +492,7 @@ internal class FilterSchedulerTest { fun testInstanceCountWeigher() { val scheduler = FilterScheduler( filters = emptyList(), - weighers = listOf(InstanceCountWeigher(multiplier = -1.0)), + weighers = listOf(InstanceCountWeigher(multiplier = -1.0)) ) val hostA = mockk() diff --git a/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt b/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt index 7092d57e..6be1f3c0 100644 --- a/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt +++ b/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt @@ -225,7 +225,7 @@ internal class SimHostTest { { assertEquals(900001, sysStats.uptime.toMillis(), "Uptime does not match") }, { assertEquals(300000, sysStats.downtime.toMillis(), "Downtime does not match") }, { assertEquals(900001, guestSysStats.uptime.toMillis(), "Guest uptime does not match") }, - { assertEquals(300000, guestSysStats.downtime.toMillis(), "Guest downtime does not match") }, + { assertEquals(300000, guestSysStats.downtime.toMillis(), "Guest downtime does not match") } ) } diff --git a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/ServiceRegistryTest.kt b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/ServiceRegistryTest.kt index 67dbaba9..f649b810 100644 --- a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/ServiceRegistryTest.kt +++ b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/ServiceRegistryTest.kt @@ -94,7 +94,7 @@ class ServiceRegistryTest { assertAll( { assertNull(registry.resolve("opendc.org", String::class.java)) }, - { assertNull(registry.resolve("opendc.org", Int::class.java)) }, + { assertNull(registry.resolve("opendc.org", Int::class.java)) } ) } diff --git a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/CapelinCli.kt b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/CapelinCli.kt index 35a51de5..402d1f3b 100644 --- a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/CapelinCli.kt +++ b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/CapelinCli.kt @@ -21,6 +21,7 @@ */ @file:JvmName("CapelinCli") + package org.opendc.experiments.capelin import com.github.ajalt.clikt.core.CliktCommand @@ -113,7 +114,7 @@ internal class CapelinCommand : CliktCommand(name = "capelin") { "hor-ver" to { HorVerPortfolio() }, "more-hpc" to { MoreHpcPortfolio() }, "more-velocity" to { MoreVelocityPortfolio() }, - "op-phen" to { OperationalPhenomenaPortfolio() }, + "op-phen" to { OperationalPhenomenaPortfolio() } ) /** diff --git a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/CapelinRunner.kt b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/CapelinRunner.kt index 44079cc2..2c3573dc 100644 --- a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/CapelinRunner.kt +++ b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/CapelinRunner.kt @@ -90,10 +90,11 @@ public class CapelinRunner( val vms = scenario.workload.source.resolve(workloadLoader, Random(seed)) val operationalPhenomena = scenario.operationalPhenomena val failureModel = - if (operationalPhenomena.failureFrequency > 0) + if (operationalPhenomena.failureFrequency > 0) { grid5000(Duration.ofSeconds((operationalPhenomena.failureFrequency * 60).roundToLong())) - else + } else { null + } service.replay(clock, vms, seed, failureModel = failureModel, interference = operationalPhenomena.hasInterference) } diff --git a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt index c78925a1..08d4a7e0 100644 --- a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt +++ b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt @@ -21,6 +21,7 @@ */ @file:JvmName("TopologyFactories") + package org.opendc.experiments.capelin.topology import org.opendc.experiments.compute.topology.HostSpec diff --git a/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt b/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt index b39f68fd..70363b6c 100644 --- a/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt +++ b/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt @@ -98,7 +98,7 @@ class CapelinIntegrationTest { provisioner.runSteps( setupComputeService(serviceDomain = "compute.opendc.org", { computeScheduler }), registerComputeMonitor(serviceDomain = "compute.opendc.org", monitor), - setupHosts(serviceDomain = "compute.opendc.org", topology), + setupHosts(serviceDomain = "compute.opendc.org", topology) ) val service = provisioner.registry.resolve("compute.opendc.org", ComputeService::class.java)!! @@ -124,7 +124,7 @@ class CapelinIntegrationTest { { assertEquals(66977508, monitor.activeTime) { "Incorrect active time" } }, { assertEquals(3160381, monitor.stealTime) { "Incorrect steal time" } }, { assertEquals(0, monitor.lostTime) { "Incorrect lost time" } }, - { assertEquals(5.840939264814157E9, monitor.energyUsage, 0.01) { "Incorrect power draw" } }, + { assertEquals(5.840939264814157E9, monitor.energyUsage, 0.01) { "Incorrect power draw" } } ) } @@ -142,7 +142,7 @@ class CapelinIntegrationTest { provisioner.runSteps( setupComputeService(serviceDomain = "compute.opendc.org", { computeScheduler }), registerComputeMonitor(serviceDomain = "compute.opendc.org", monitor), - setupHosts(serviceDomain = "compute.opendc.org", topology), + setupHosts(serviceDomain = "compute.opendc.org", topology) ) val service = provisioner.registry.resolve("compute.opendc.org", ComputeService::class.java)!! @@ -181,7 +181,7 @@ class CapelinIntegrationTest { provisioner.runSteps( setupComputeService(serviceDomain = "compute.opendc.org", { computeScheduler }), registerComputeMonitor(serviceDomain = "compute.opendc.org", monitor), - setupHosts(serviceDomain = "compute.opendc.org", topology), + setupHosts(serviceDomain = "compute.opendc.org", topology) ) val service = provisioner.registry.resolve("compute.opendc.org", ComputeService::class.java)!! @@ -220,7 +220,7 @@ class CapelinIntegrationTest { provisioner.runSteps( setupComputeService(serviceDomain = "compute.opendc.org", { computeScheduler }), registerComputeMonitor(serviceDomain = "compute.opendc.org", monitor), - setupHosts(serviceDomain = "compute.opendc.org", topology), + setupHosts(serviceDomain = "compute.opendc.org", topology) ) val service = provisioner.registry.resolve("compute.opendc.org", ComputeService::class.java)!! @@ -233,7 +233,7 @@ class CapelinIntegrationTest { { assertEquals(8539158, monitor.activeTime) { "Active time incorrect" } }, { assertEquals(0, monitor.stealTime) { "Steal time incorrect" } }, { assertEquals(0, monitor.lostTime) { "Lost time incorrect" } }, - { assertEquals(2328039558, monitor.uptime) { "Uptime incorrect" } }, + { assertEquals(2328039558, monitor.uptime) { "Uptime incorrect" } } ) } diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeSchedulers.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeSchedulers.kt index 9ed2e564..bbc70489 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeSchedulers.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeSchedulers.kt @@ -21,6 +21,7 @@ */ @file:JvmName("ComputeSchedulers") + package org.opendc.experiments.compute import org.opendc.compute.service.scheduler.ComputeScheduler diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeSteps.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeSteps.kt index 3ae4b0df..690156e2 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeSteps.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeSteps.kt @@ -21,6 +21,7 @@ */ @file:JvmName("ComputeSteps") + package org.opendc.experiments.compute import org.opendc.compute.service.ComputeService diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeWorkloadLoader.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeWorkloadLoader.kt index daf6b505..9aa544cb 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeWorkloadLoader.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeWorkloadLoader.kt @@ -116,7 +116,6 @@ public class ComputeWorkloadLoader(private val baseDir: File) { return try { while (reader.nextRow()) { - val id = reader.getString(idCol)!! if (!fragments.containsKey(id)) { continue @@ -195,7 +194,6 @@ public class ComputeWorkloadLoader(private val baseDir: File) { val ref = cache.compute(name) { key, oldVal -> val inst = oldVal?.get() if (inst == null) { - val path = baseDir.resolve(key) logger.info { "Loading trace $key at $path" } diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeWorkloads.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeWorkloads.kt index 732f761e..4b3a6089 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeWorkloads.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeWorkloads.kt @@ -21,6 +21,7 @@ */ @file:JvmName("ComputeWorkloads") + package org.opendc.experiments.compute import org.opendc.experiments.compute.internal.CompositeComputeWorkload diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/FailureModels.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/FailureModels.kt index 7480e116..ff747066 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/FailureModels.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/FailureModels.kt @@ -21,6 +21,7 @@ */ @file:JvmName("FailureModels") + package org.opendc.experiments.compute import org.apache.commons.math3.distribution.LogNormalDistribution diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/TraceHelpers.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/TraceHelpers.kt index 9562baf5..e98636fa 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/TraceHelpers.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/TraceHelpers.kt @@ -21,6 +21,7 @@ */ @file:JvmName("TraceHelpers") + package org.opendc.experiments.compute import kotlinx.coroutines.coroutineScope diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetHostDataWriter.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetHostDataWriter.kt index df0163d2..979aebeb 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetHostDataWriter.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetHostDataWriter.kt @@ -206,7 +206,7 @@ public class ParquetHostDataWriter(path: File, bufferSize: Int) : .named("guests_error"), Types .required(PrimitiveType.PrimitiveTypeName.INT32) - .named("guests_invalid"), + .named("guests_invalid") ) .named("host") } diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetServiceDataWriter.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetServiceDataWriter.kt index 6f1d5ad5..39bc2d11 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetServiceDataWriter.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/export/parquet/ParquetServiceDataWriter.kt @@ -124,7 +124,7 @@ public class ParquetServiceDataWriter(path: File, bufferSize: Int) : .named("attempts_failure"), Types .required(PrimitiveType.PrimitiveTypeName.INT32) - .named("attempts_error"), + .named("attempts_error") ) .named("service") } diff --git a/opendc-experiments/opendc-experiments-faas/src/main/kotlin/org/opendc/experiments/faas/FaaSServiceProvisioningStep.kt b/opendc-experiments/opendc-experiments-faas/src/main/kotlin/org/opendc/experiments/faas/FaaSServiceProvisioningStep.kt index 301ea8c3..3b4200c8 100644 --- a/opendc-experiments/opendc-experiments-faas/src/main/kotlin/org/opendc/experiments/faas/FaaSServiceProvisioningStep.kt +++ b/opendc-experiments/opendc-experiments-faas/src/main/kotlin/org/opendc/experiments/faas/FaaSServiceProvisioningStep.kt @@ -51,10 +51,11 @@ public class FaaSServiceProvisioningStep internal constructor( private val coldStartModel: ColdStartModel? ) : ProvisioningStep { override fun apply(ctx: ProvisioningContext): AutoCloseable { - val delayInjector = if (coldStartModel != null) + val delayInjector = if (coldStartModel != null) { StochasticDelayInjector(coldStartModel, Random(ctx.seeder.nextLong())) - else + } else { ZeroDelayInjector + } val deployer = SimFunctionDeployer(ctx.coroutineContext, ctx.clock, machineModel, delayInjector) val service = FaaSService( ctx.coroutineContext, diff --git a/opendc-experiments/opendc-experiments-faas/src/main/kotlin/org/opendc/experiments/faas/FaaSSteps.kt b/opendc-experiments/opendc-experiments-faas/src/main/kotlin/org/opendc/experiments/faas/FaaSSteps.kt index 40e5627b..53cd9c3e 100644 --- a/opendc-experiments/opendc-experiments-faas/src/main/kotlin/org/opendc/experiments/faas/FaaSSteps.kt +++ b/opendc-experiments/opendc-experiments-faas/src/main/kotlin/org/opendc/experiments/faas/FaaSSteps.kt @@ -21,6 +21,7 @@ */ @file:JvmName("FaaSSteps") + package org.opendc.experiments.faas import org.opendc.experiments.provisioner.ProvisioningContext diff --git a/opendc-experiments/opendc-experiments-faas/src/main/kotlin/org/opendc/experiments/faas/TraceHelpers.kt b/opendc-experiments/opendc-experiments-faas/src/main/kotlin/org/opendc/experiments/faas/TraceHelpers.kt index cf278606..c4001e2e 100644 --- a/opendc-experiments/opendc-experiments-faas/src/main/kotlin/org/opendc/experiments/faas/TraceHelpers.kt +++ b/opendc-experiments/opendc-experiments-faas/src/main/kotlin/org/opendc/experiments/faas/TraceHelpers.kt @@ -21,6 +21,7 @@ */ @file:JvmName("TraceHelpers") + package org.opendc.experiments.faas import kotlinx.coroutines.coroutineScope diff --git a/opendc-experiments/opendc-experiments-faas/src/test/kotlin/org/opendc/experiments/faas/FaaSExperiment.kt b/opendc-experiments/opendc-experiments-faas/src/test/kotlin/org/opendc/experiments/faas/FaaSExperiment.kt index 6f212825..2342c3f6 100644 --- a/opendc-experiments/opendc-experiments-faas/src/test/kotlin/org/opendc/experiments/faas/FaaSExperiment.kt +++ b/opendc-experiments/opendc-experiments-faas/src/test/kotlin/org/opendc/experiments/faas/FaaSExperiment.kt @@ -70,7 +70,7 @@ class FaaSExperiment { assertAll( { assertEquals(14, stats.totalInvocations) }, { assertEquals(2, stats.timelyInvocations) }, - { assertEquals(12, stats.delayedInvocations) }, + { assertEquals(12, stats.delayedInvocations) } ) } } diff --git a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt index 9b50758b..c71c4520 100644 --- a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt +++ b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt @@ -71,7 +71,8 @@ public class SimTFDevice( * The [SimMachine] representing the device. */ private val machine = SimBareMetalMachine( - FlowEngine(scope.coroutineContext, clock), MachineModel(listOf(pu), listOf(memory)), + FlowEngine(scope.coroutineContext, clock), + MachineModel(listOf(pu), listOf(memory)), SimplePowerDriver(powerModel) ) diff --git a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/keras/layer/conv/Conv2D.kt b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/keras/layer/conv/Conv2D.kt index bf4725b7..74124bbd 100644 --- a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/keras/layer/conv/Conv2D.kt +++ b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/keras/layer/conv/Conv2D.kt @@ -39,7 +39,7 @@ public class Conv2D( public val strides: LongArray = LongArray(4), // [1, stride_h, stride_w, 1] public val activation: Activation = Activation.Relu, public val padding: ConvPadding = ConvPadding.VALID, - name: String = "", + name: String = "" ) : Layer(name) { private var padHeight: Double = 0.0 diff --git a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/keras/layer/core/ActivationLayer.kt b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/keras/layer/core/ActivationLayer.kt index fd25cea6..60b0f754 100644 --- a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/keras/layer/core/ActivationLayer.kt +++ b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/keras/layer/core/ActivationLayer.kt @@ -31,7 +31,7 @@ import org.opendc.experiments.tf20.keras.shape.TensorShape */ public class ActivationLayer( public val activation: Activation = Activation.Relu, - name: String = "", + name: String = "" ) : Layer(name) { override fun build(inputShape: TensorShape) { diff --git a/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/TensorFlowTest.kt b/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/TensorFlowTest.kt index f5d35fa4..c4698058 100644 --- a/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/TensorFlowTest.kt +++ b/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/TensorFlowTest.kt @@ -46,7 +46,12 @@ class TensorFlowTest { val def = MLEnvironmentReader().readEnvironment(envInput).first() val device = SimTFDevice( - def.uid, def.meta["gpu"] as Boolean, coroutineContext, clock, def.model.cpus[0], def.model.memory[0], + def.uid, + def.meta["gpu"] as Boolean, + coroutineContext, + clock, + def.model.cpus[0], + def.model.memory[0], LinearPowerModel(250.0, 60.0) ) val strategy = OneDeviceStrategy(device) @@ -76,7 +81,12 @@ class TensorFlowTest { val def = MLEnvironmentReader().readEnvironment(envInput).first() val device = SimTFDevice( - def.uid, def.meta["gpu"] as Boolean, coroutineContext, clock, def.model.cpus[0], def.model.memory[0], + def.uid, + def.meta["gpu"] as Boolean, + coroutineContext, + clock, + def.model.cpus[0], + def.model.memory[0], LinearPowerModel(250.0, 60.0) ) val strategy = OneDeviceStrategy(device) @@ -106,12 +116,22 @@ class TensorFlowTest { val def = MLEnvironmentReader().readEnvironment(envInput).first() val deviceA = SimTFDevice( - def.uid, def.meta["gpu"] as Boolean, coroutineContext, clock, def.model.cpus[0], def.model.memory[0], + def.uid, + def.meta["gpu"] as Boolean, + coroutineContext, + clock, + def.model.cpus[0], + def.model.memory[0], LinearPowerModel(250.0, 60.0) ) val deviceB = SimTFDevice( - UUID.randomUUID(), def.meta["gpu"] as Boolean, coroutineContext, clock, def.model.cpus[0], def.model.memory[0], + UUID.randomUUID(), + def.meta["gpu"] as Boolean, + coroutineContext, + clock, + def.model.cpus[0], + def.model.memory[0], LinearPowerModel(250.0, 60.0) ) diff --git a/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt b/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt index d1009d44..2ae69949 100644 --- a/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt +++ b/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt @@ -21,6 +21,7 @@ */ @file:JvmName("TraceHelpers") + package org.opendc.experiments.workflow import kotlinx.coroutines.coroutineScope @@ -65,10 +66,11 @@ public fun Trace.toJobs(): List { val workflow = jobs.computeIfAbsent(workflowId) { id -> Job(UUID(0L, id), "", HashSet(), HashMap()) } val id = reader.getString(TASK_ID)!!.toLong() - val grantedCpus = if (reader.resolve(TASK_ALLOC_NCPUS) != 0) + val grantedCpus = if (reader.resolve(TASK_ALLOC_NCPUS) != 0) { reader.getInt(TASK_ALLOC_NCPUS) - else + } else { reader.getInt(TASK_REQ_NCPUS) + } val submitTime = reader.getInstant(TASK_SUBMIT_TIME)!! val runtime = reader.getDuration(TASK_RUNTIME)!! val flops: Long = 4000 * runtime.seconds * grantedCpus @@ -81,7 +83,7 @@ public fun Trace.toJobs(): List { "workload" to workload, WORKFLOW_TASK_CORES to grantedCpus, WORKFLOW_TASK_DEADLINE to runtime.toMillis() - ), + ) ) tasks[id] = task diff --git a/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/WorkflowSchedulerSpec.kt b/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/WorkflowSchedulerSpec.kt index cb8056a7..8bd087e7 100644 --- a/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/WorkflowSchedulerSpec.kt +++ b/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/WorkflowSchedulerSpec.kt @@ -36,5 +36,5 @@ public data class WorkflowSchedulerSpec( val jobAdmissionPolicy: JobAdmissionPolicy, val jobOrderPolicy: JobOrderPolicy, val taskEligibilityPolicy: TaskEligibilityPolicy, - val taskOrderPolicy: TaskOrderPolicy, + val taskOrderPolicy: TaskOrderPolicy ) diff --git a/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/WorkflowServiceProvisioningStep.kt b/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/WorkflowServiceProvisioningStep.kt index a2d6a172..5cee9abf 100644 --- a/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/WorkflowServiceProvisioningStep.kt +++ b/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/WorkflowServiceProvisioningStep.kt @@ -54,7 +54,7 @@ public class WorkflowServiceProvisioningStep internal constructor( jobAdmissionPolicy = scheduler.jobAdmissionPolicy, jobOrderPolicy = scheduler.jobOrderPolicy, taskEligibilityPolicy = scheduler.taskEligibilityPolicy, - taskOrderPolicy = scheduler.taskOrderPolicy, + taskOrderPolicy = scheduler.taskOrderPolicy ) ctx.registry.register(serviceDomain, WorkflowService::class.java, service) diff --git a/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/WorkflowSteps.kt b/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/WorkflowSteps.kt index 7aae3a9f..87c743f0 100644 --- a/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/WorkflowSteps.kt +++ b/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/WorkflowSteps.kt @@ -21,6 +21,7 @@ */ @file:JvmName("WorkflowSteps") + package org.opendc.experiments.workflow import org.opendc.experiments.provisioner.ProvisioningStep diff --git a/opendc-faas/opendc-faas-simulator/src/test/kotlin/org/opendc/faas/simulator/SimFaaSServiceTest.kt b/opendc-faas/opendc-faas-simulator/src/test/kotlin/org/opendc/faas/simulator/SimFaaSServiceTest.kt index 6513296d..9970d93a 100644 --- a/opendc-faas/opendc-faas-simulator/src/test/kotlin/org/opendc/faas/simulator/SimFaaSServiceTest.kt +++ b/opendc-faas/opendc-faas-simulator/src/test/kotlin/org/opendc/faas/simulator/SimFaaSServiceTest.kt @@ -101,7 +101,7 @@ internal class SimFaaSServiceTest { { assertEquals(1, funcStats.delayedInvocations) }, { assertEquals(0, funcStats.failedInvocations) }, { assertEquals(100.0, funcStats.waitTime.mean) }, - { assertEquals(1285.0, funcStats.activeTime.mean) }, + { assertEquals(1285.0, funcStats.activeTime.mean) } ) } } diff --git a/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt b/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt index 651c3b63..220b97cc 100644 --- a/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt +++ b/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt @@ -79,7 +79,9 @@ class SimMachineBenchmarks { return runSimulation { val engine = FlowEngine(coroutineContext, clock) val machine = SimBareMetalMachine( - engine, machineModel, SimplePowerDriver(ConstantPowerModel(0.0)) + engine, + machineModel, + SimplePowerDriver(ConstantPowerModel(0.0)) ) return@runSimulation machine.runWorkload(SimTraceWorkload(trace)) } diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt index ee56c8c8..4c824440 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt @@ -46,7 +46,7 @@ public class SimBareMetalMachine( engine: FlowEngine, model: MachineModel, powerDriver: PowerDriver, - public val psu: SimPsu = SimPsu(500.0, mapOf(1.0 to 1.0)), + public val psu: SimPsu = SimPsu(500.0, mapOf(1.0 to 1.0)) ) : SimAbstractMachine(engine, model) { /** * The current power usage of the machine (without PSU loss) in W. diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt index 243790b9..3d3703ae 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt @@ -36,7 +36,7 @@ import java.util.TreeMap */ public class SimPsu( private val ratedOutputPower: Double, - energyEfficiency: Map, + energyEfficiency: Map ) : SimPowerInlet() { /** * The power draw of the machine at this instant. diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt index 20d946a4..e1486d71 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt @@ -211,6 +211,7 @@ public class SimHypervisor( */ override val counters: SimHypervisorCounters get() = _counters + @JvmField val _counters = VmCountersImpl(cpus, null) /** diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt index 36fad4c3..238bffc0 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt @@ -129,10 +129,11 @@ public class VmInterferenceModel private constructor( } cmp = scores[l].compareTo(scores[r]) // Higher penalty first (this means lower performance score first) - if (cmp != 0) + if (cmp != 0) { cmp - else + } else { l.compareTo(r) + } } ) diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt index 62b85e12..46c397fe 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt @@ -39,15 +39,16 @@ public class AsymptoticPowerModel( private val maxPower: Double, private val idlePower: Double, private val asymUtil: Double, - private val isDvfsEnabled: Boolean, + private val isDvfsEnabled: Boolean ) : PowerModel { private val factor: Double = (maxPower - idlePower) / 100 public override fun computePower(utilization: Double): Double = - if (isDvfsEnabled) + if (isDvfsEnabled) { idlePower + (factor * 100) / 2 * (1 + utilization.pow(3) - E.pow(-utilization.pow(3) / asymUtil)) - else + } else { idlePower + (factor * 100) / 2 * (1 + utilization - E.pow(-utilization / asymUtil)) + } override fun toString(): String = "AsymptoticPowerModel[max=$maxPower,idle=$idlePower,asymptotic=$asymUtil]" } diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/InterpolationPowerModel.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/InterpolationPowerModel.kt index 2694700c..b17b87a9 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/InterpolationPowerModel.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/InterpolationPowerModel.kt @@ -44,10 +44,11 @@ public class InterpolationPowerModel(private val powerValues: List) : Po val powerCil: Double = getAveragePowerValue(utilizationCil) val delta = (powerCil - powerFlr) / 10 - return if (utilization % 0.1 == 0.0) + return if (utilization % 0.1 == 0.0) { getAveragePowerValue((clampedUtilization * 10).toInt()) - else + } else { powerFlr + delta * (clampedUtilization - utilizationFlr.toDouble() / 10) * 100 + } } override fun toString(): String = "InterpolationPowerModel[entries=${powerValues.size}]" diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt index 612ce2fc..e9e72da8 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt @@ -37,7 +37,7 @@ import kotlin.math.pow public class MsePowerModel( private val maxPower: Double, private val idlePower: Double, - private val calibrationParam: Double, + private val calibrationParam: Double ) : PowerModel { private val factor: Double = (maxPower - idlePower) / 100 diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/ZeroIdlePowerDecorator.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/ZeroIdlePowerDecorator.kt index 886227e1..05ab4631 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/ZeroIdlePowerDecorator.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/ZeroIdlePowerDecorator.kt @@ -29,10 +29,11 @@ package org.opendc.simulator.compute.power */ public class ZeroIdlePowerDecorator(private val delegate: PowerModel) : PowerModel { override fun computePower(utilization: Double): Double { - return if (utilization == 0.0) + return if (utilization == 0.0) { 0.0 - else + } else { delegate.computePower(utilization) + } } override fun toString(): String = "ZeroIdlePowerDecorator[delegate=$delegate]" diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt index e66227b5..db6a4629 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt @@ -39,7 +39,7 @@ public class SimTrace( private val usageCol: DoubleArray, private val deadlineCol: LongArray, private val coresCol: IntArray, - private val size: Int, + private val size: Int ) { init { require(size >= 0) { "Invalid trace size" } diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/device/SimPsuTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/device/SimPsuTest.kt index 5481cad2..0a6cb29f 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/device/SimPsuTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/device/SimPsuTest.kt @@ -75,7 +75,7 @@ internal class SimPsuTest { val energyEfficiency = sortedMapOf( 0.3 to 0.9, 0.7 to 0.92, - 1.0 to 0.94, + 1.0 to 0.94 ) val engine = FlowEngine(coroutineContext, clock) diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt index 9ff492cc..6b498119 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt @@ -76,7 +76,7 @@ internal class SimFairShareHypervisorTest { SimTraceFragment(duration * 1000, duration * 1000, 3500.0, 1), SimTraceFragment(duration * 2000, duration * 1000, 0.0, 1), SimTraceFragment(duration * 3000, duration * 1000, 183.0, 1) - ), + ) ) val engine = FlowEngine(coroutineContext, clock) @@ -116,7 +116,7 @@ internal class SimFairShareHypervisorTest { SimTraceFragment(duration * 1000, duration * 1000, 3500.0, 1), SimTraceFragment(duration * 2000, duration * 1000, 0.0, 1), SimTraceFragment(duration * 3000, duration * 1000, 183.0, 1) - ), + ) ) val workloadB = SimTraceWorkload( @@ -206,7 +206,7 @@ internal class SimFairShareHypervisorTest { SimTraceFragment(duration * 1000, duration * 1000, 28.0, 1), SimTraceFragment(duration * 2000, duration * 1000, 3500.0, 1), SimTraceFragment(duration * 3000, duration * 1000, 183.0, 1) - ), + ) ) val workloadB = SimTraceWorkload( diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt index 7a8da325..57fe3766 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt @@ -78,7 +78,7 @@ internal class SimSpaceSharedHypervisorTest { SimTraceFragment(duration * 1000, duration * 1000, 3500.0, 1), SimTraceFragment(duration * 2000, duration * 1000, 0.0, 1), SimTraceFragment(duration * 3000, duration * 1000, 183.0, 1) - ), + ) ) val engine = FlowEngine(coroutineContext, clock) diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PStatePowerDriverTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PStatePowerDriverTest.kt index f557c8d3..3c0a55a6 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PStatePowerDriverTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PStatePowerDriverTest.kt @@ -41,7 +41,7 @@ internal class PStatePowerDriverTest { sortedMapOf( 2800.0 to ConstantPowerModel(200.0), 3300.0 to ConstantPowerModel(300.0), - 3600.0 to ConstantPowerModel(350.0), + 3600.0 to ConstantPowerModel(350.0) ) ) @@ -61,7 +61,7 @@ internal class PStatePowerDriverTest { sortedMapOf( 2800.0 to ConstantPowerModel(200.0), 3300.0 to ConstantPowerModel(300.0), - 3600.0 to ConstantPowerModel(350.0), + 3600.0 to ConstantPowerModel(350.0) ) ) @@ -86,7 +86,7 @@ internal class PStatePowerDriverTest { sortedMapOf( 2800.0 to ConstantPowerModel(200.0), 3300.0 to ConstantPowerModel(300.0), - 3600.0 to ConstantPowerModel(350.0), + 3600.0 to ConstantPowerModel(350.0) ) ) @@ -106,7 +106,7 @@ internal class PStatePowerDriverTest { sortedMapOf( 2800.0 to LinearPowerModel(200.0, 100.0), 3300.0 to LinearPowerModel(250.0, 150.0), - 4000.0 to LinearPowerModel(300.0, 200.0), + 4000.0 to LinearPowerModel(300.0, 200.0) ) ) diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt index 7852534a..67532d5b 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt @@ -72,7 +72,7 @@ internal class PowerModelTest { { assertEquals(189.0, powerModel.computePower(0.8)) }, { assertEquals(189.0 + 0.7 * 10 * (205 - 189) / 10, powerModel.computePower(0.87)) }, { assertEquals(205.0, powerModel.computePower(0.9)) }, - { assertEquals(222.0, powerModel.computePower(1.0)) }, + { assertEquals(222.0, powerModel.computePower(1.0)) } ) } @@ -87,7 +87,7 @@ internal class PowerModelTest { Arguments.of(SqrtPowerModel(350.0, 200.0), 342.302), Arguments.of(MsePowerModel(350.0, 200.0, 1.4), 340.571), Arguments.of(AsymptoticPowerModel(350.0, 200.0, 0.3, false), 338.765), - Arguments.of(AsymptoticPowerModel(350.0, 200.0, 0.3, true), 323.072), + Arguments.of(AsymptoticPowerModel(350.0, 200.0, 0.3, true), 323.072) ) } } diff --git a/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/SimulationScheduler.java b/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/SimulationScheduler.java index a70c1cda..305bdf5e 100644 --- a/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/SimulationScheduler.java +++ b/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/SimulationScheduler.java @@ -67,7 +67,7 @@ public final class SimulationScheduler implements Executor { * @param initialTimeMs The initial virtual time of the scheduler in milliseconds since epoch. */ public SimulationScheduler(long initialTimeMs) { - this.currentTime = initialTimeMs; + this.currentTime = initialTimeMs; } /** @@ -104,7 +104,8 @@ public final class SimulationScheduler implements Executor { */ public int schedule(long delayMs, Runnable task) { if (delayMs < 0) { - throw new IllegalArgumentException("Attempted scheduling an event earlier in time (delay " + delayMs + " ms)"); + throw new IllegalArgumentException( + "Attempted scheduling an event earlier in time (delay " + delayMs + " ms)"); } long target = currentTime + delayMs; diff --git a/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/TaskQueue.java b/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/TaskQueue.java index 7d867b5d..f677e74e 100644 --- a/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/TaskQueue.java +++ b/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/TaskQueue.java @@ -193,7 +193,8 @@ final class TaskQueue { /** * Sift up an entry in the heap. */ - private static void siftUp(long[] deadlines, int[] ids, Runnable[] tasks, int k, long deadline, int id, Runnable task) { + private static void siftUp( + long[] deadlines, int[] ids, Runnable[] tasks, int k, long deadline, int id, Runnable task) { while (k > 0) { int parent = (k - 1) >>> 1; long parentDeadline = deadlines[parent]; @@ -218,11 +219,12 @@ final class TaskQueue { /** * Sift down an entry in the heap. */ - private static void siftDown(long[] deadlines, int[] ids, Runnable[] tasks, int k, int n, long deadline, int id, Runnable task) { - int half = n >>> 1; // loop while a non-leaf + private static void siftDown( + long[] deadlines, int[] ids, Runnable[] tasks, int k, int n, long deadline, int id, Runnable task) { + int half = n >>> 1; // loop while a non-leaf while (k < half) { - int child = (k << 1) + 1; // assume left child is least + int child = (k << 1) + 1; // assume left child is least long childDeadline = deadlines[child]; int childId = ids[child]; diff --git a/opendc-simulator/opendc-simulator-core/src/test/kotlin/org/opendc/simulator/TaskQueueTest.kt b/opendc-simulator/opendc-simulator-core/src/test/kotlin/org/opendc/simulator/TaskQueueTest.kt index f1559ce3..56dd83aa 100644 --- a/opendc-simulator/opendc-simulator-core/src/test/kotlin/org/opendc/simulator/TaskQueueTest.kt +++ b/opendc-simulator/opendc-simulator-core/src/test/kotlin/org/opendc/simulator/TaskQueueTest.kt @@ -47,7 +47,7 @@ class TaskQueueTest { fun testPollEmpty() { assertAll( { assertEquals(Long.MAX_VALUE, queue.peekDeadline()) }, - { assertNull(queue.poll()) }, + { assertNull(queue.poll()) } ) } @@ -63,7 +63,7 @@ class TaskQueueTest { assertAll( { assertEquals(100, queue.peekDeadline()) }, { assertEquals(entry, queue.poll()) }, - { assertNull(queue.poll()) }, + { assertNull(queue.poll()) } ) } @@ -86,7 +86,7 @@ class TaskQueueTest { { assertEquals(entryB, queue.poll()) }, { assertEquals(entryC, queue.poll()) }, { assertEquals(entryA, queue.poll()) }, - { assertNull(queue.poll()) }, + { assertNull(queue.poll()) } ) } @@ -109,7 +109,7 @@ class TaskQueueTest { { assertEquals(entryA, queue.poll()) }, { assertEquals(entryB, queue.poll()) }, { assertEquals(entryC, queue.poll()) }, - { assertNull(queue.poll()) }, + { assertNull(queue.poll()) } ) } @@ -136,7 +136,7 @@ class TaskQueueTest { { assertEquals(entryD, queue.poll()) }, { assertEquals(entryC, queue.poll()) }, { assertEquals(entryA, queue.poll()) }, - { assertNull(queue.poll()) }, + { assertNull(queue.poll()) } ) } @@ -160,7 +160,7 @@ class TaskQueueTest { { assertEquals(20, queue.peekDeadline()) }, { assertEquals(entryB, queue.poll()) }, { assertEquals(entryC, queue.poll()) }, - { assertNull(queue.poll()) }, + { assertNull(queue.poll()) } ) } @@ -184,7 +184,7 @@ class TaskQueueTest { { assertEquals(58, queue.peekDeadline()) }, { assertEquals(entryC, queue.poll()) }, { assertEquals(entryA, queue.poll()) }, - { assertNull(queue.poll()) }, + { assertNull(queue.poll()) } ) } @@ -208,7 +208,7 @@ class TaskQueueTest { { assertEquals(20, queue.peekDeadline()) }, { assertEquals(entryB, queue.poll()) }, { assertEquals(entryA, queue.poll()) }, - { assertNull(queue.poll()) }, + { assertNull(queue.poll()) } ) } diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/FlowForwarder.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/FlowForwarder.kt index 6fa2971a..5202c252 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/FlowForwarder.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/FlowForwarder.kt @@ -226,10 +226,11 @@ public class FlowForwarder( * Reset the delegate. */ private fun reset() { - if (isCoupled) + if (isCoupled) { _innerCtx?.close() - else + } else { _innerCtx?.push(0.0) + } delegate = null hasDelegateStarted = false diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt index 393a2635..fba3af5f 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt @@ -87,19 +87,21 @@ internal class FlowConsumerContextImpl( get() = _flags and ConnConvergeSource == ConnConvergeSource set(value) { _flags = - if (value) + if (value) { _flags or ConnConvergeSource - else + } else { _flags and ConnConvergeSource.inv() + } } override var shouldConsumerConverge: Boolean get() = _flags and ConnConvergeConsumer == ConnConvergeConsumer set(value) { _flags = - if (value) + if (value) { _flags or ConnConvergeConsumer - else + } else { _flags and ConnConvergeConsumer.inv() + } } /** @@ -109,10 +111,11 @@ internal class FlowConsumerContextImpl( get() = _flags and ConnDisableTimers != ConnDisableTimers set(value) { _flags = - if (!value) + if (!value) { _flags or ConnDisableTimers - else + } else { _flags and ConnDisableTimers.inv() + } } /** @@ -241,10 +244,11 @@ internal class FlowConsumerContextImpl( // IMPORTANT: Re-fetch the flags after the callback might have changed those flags = _flags - if (duration != Long.MAX_VALUE) + if (duration != Long.MAX_VALUE) { now + duration - else + } else { duration + } } else { deadline } diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt index a52a5b0e..d9c6f893 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt @@ -255,7 +255,6 @@ public class MaxMinFlowMultiplexer( * This method is invoked when one of the inputs converges. */ fun convergeInput(input: Input, now: Long) { - val lastConverge = _lastConverge val lastConvergeInput = _lastConvergeInput val parent = parent @@ -518,7 +517,7 @@ public class MaxMinFlowMultiplexer( private val engine: FlowEngine, private val scheduler: Scheduler, @JvmField val isCoupled: Boolean, - initialCapacity: Double, + initialCapacity: Double ) : FlowConsumer, FlowConsumerLogic, Comparable { /** * A flag to indicate that the consumer is active. @@ -787,10 +786,11 @@ public class MaxMinFlowMultiplexer( return if (_isActivationOutput) { // If this output is the activation output, synchronously run the scheduler and return the new deadline val deadline = scheduler.runScheduler(now) - if (deadline == Long.MAX_VALUE) + if (deadline == Long.MAX_VALUE) { deadline - else + } else { deadline - now + } } else { // Output is not the activation output, so trigger activation output and do not install timer for this // output (by returning `Long.MAX_VALUE`) diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt index 1a71580b..2409e174 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt @@ -59,7 +59,7 @@ internal class ForwardingFlowMultiplexerTest { TraceFlowSource.Fragment(duration * 1000, 3500.0), TraceFlowSource.Fragment(duration * 1000, 0.0), TraceFlowSource.Fragment(duration * 1000, 183.0) - ), + ) ) val switch = ForwardingFlowMultiplexer(engine) diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt index 34198f17..a6bf8ad8 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt @@ -73,7 +73,7 @@ internal class MaxMinFlowMultiplexerTest { TraceFlowSource.Fragment(duration * 1000, 3500.0), TraceFlowSource.Fragment(duration * 1000, 0.0), TraceFlowSource.Fragment(duration * 1000, 183.0) - ), + ) ) val switch = MaxMinFlowMultiplexer(scheduler) @@ -111,7 +111,7 @@ internal class MaxMinFlowMultiplexerTest { TraceFlowSource.Fragment(duration * 1000, 3500.0), TraceFlowSource.Fragment(duration * 1000, 0.0), TraceFlowSource.Fragment(duration * 1000, 183.0) - ), + ) ) val workloadB = TraceFlowSource( diff --git a/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimPdu.kt b/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimPdu.kt index 69ac97ab..c4076310 100644 --- a/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimPdu.kt +++ b/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimPdu.kt @@ -39,7 +39,7 @@ import org.opendc.simulator.flow.mux.MaxMinFlowMultiplexer public class SimPdu( engine: FlowEngine, private val idlePower: Double = 0.0, - private val lossCoefficient: Double = 0.0, + private val lossCoefficient: Double = 0.0 ) : SimPowerInlet() { /** * The [FlowMultiplexer] that distributes the electricity over the PDU outlets. diff --git a/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimUps.kt b/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimUps.kt index 00b2926e..0431d3cf 100644 --- a/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimUps.kt +++ b/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimUps.kt @@ -40,7 +40,7 @@ import org.opendc.simulator.flow.mux.MaxMinFlowMultiplexer public class SimUps( private val engine: FlowEngine, private val idlePower: Double = 0.0, - private val lossCoefficient: Double = 0.0, + private val lossCoefficient: Double = 0.0 ) : SimPowerOutlet() { /** * The resource aggregator used to combine the input sources. diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/InterferenceGroupColumns.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/InterferenceGroupColumns.kt index 2a80687c..fbbfdea9 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/InterferenceGroupColumns.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/InterferenceGroupColumns.kt @@ -21,6 +21,7 @@ */ @file:JvmName("InterferenceGroupColumns") + package org.opendc.trace.conv /** diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/ResourceColumns.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/ResourceColumns.kt index 9b7b8195..89f8dbc4 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/ResourceColumns.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/ResourceColumns.kt @@ -21,6 +21,7 @@ */ @file:JvmName("ResourceColumns") + package org.opendc.trace.conv /** diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/ResourceStateColumns.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/ResourceStateColumns.kt index e9dd7673..5187d501 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/ResourceStateColumns.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/ResourceStateColumns.kt @@ -21,6 +21,7 @@ */ @file:JvmName("ResourceStateColumns") + package org.opendc.trace.conv /** diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/Tables.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/Tables.kt index 669ebe58..495628da 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/Tables.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/Tables.kt @@ -21,6 +21,7 @@ */ @file:JvmName("Tables") + package org.opendc.trace.conv /** diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/TaskColumns.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/TaskColumns.kt index da5c343f..6ca87a60 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/TaskColumns.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/conv/TaskColumns.kt @@ -21,6 +21,7 @@ */ @file:JvmName("TaskColumns") + package org.opendc.trace.conv /** diff --git a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/util/TableColumnConversion.kt b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/util/TableColumnConversion.kt index 8ef080b5..26739e34 100644 --- a/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/util/TableColumnConversion.kt +++ b/opendc-trace/opendc-trace-api/src/main/kotlin/org/opendc/trace/util/TableColumnConversion.kt @@ -21,6 +21,7 @@ */ @file:JvmName("TableColumnConversions") + package org.opendc.trace.util import org.opendc.trace.TableColumnType diff --git a/opendc-trace/opendc-trace-azure/src/main/kotlin/org/opendc/trace/azure/AzureTraceFormat.kt b/opendc-trace/opendc-trace-azure/src/main/kotlin/org/opendc/trace/azure/AzureTraceFormat.kt index 8c87109d..3f64c640 100644 --- a/opendc-trace/opendc-trace-azure/src/main/kotlin/org/opendc/trace/azure/AzureTraceFormat.kt +++ b/opendc-trace/opendc-trace-azure/src/main/kotlin/org/opendc/trace/azure/AzureTraceFormat.kt @@ -77,14 +77,14 @@ public class AzureTraceFormat : TraceFormat { TableColumn(RESOURCE_START_TIME, TableColumnType.Instant), TableColumn(RESOURCE_STOP_TIME, TableColumnType.Instant), TableColumn(RESOURCE_CPU_COUNT, TableColumnType.Int), - TableColumn(RESOURCE_MEM_CAPACITY, TableColumnType.Double), + TableColumn(RESOURCE_MEM_CAPACITY, TableColumnType.Double) ) ) TABLE_RESOURCE_STATES -> TableDetails( listOf( TableColumn(RESOURCE_ID, TableColumnType.String), TableColumn(RESOURCE_STATE_TIMESTAMP, TableColumnType.Instant), - TableColumn(RESOURCE_STATE_CPU_USAGE_PCT, TableColumnType.Double), + TableColumn(RESOURCE_STATE_CPU_USAGE_PCT, TableColumnType.Double) ) ) else -> throw IllegalArgumentException("Table $table not supported") diff --git a/opendc-trace/opendc-trace-azure/src/test/kotlin/org/opendc/trace/azure/AzureTraceFormatTest.kt b/opendc-trace/opendc-trace-azure/src/test/kotlin/org/opendc/trace/azure/AzureTraceFormatTest.kt index a7a18cd5..00cdc174 100644 --- a/opendc-trace/opendc-trace-azure/src/test/kotlin/org/opendc/trace/azure/AzureTraceFormatTest.kt +++ b/opendc-trace/opendc-trace-azure/src/test/kotlin/org/opendc/trace/azure/AzureTraceFormatTest.kt @@ -78,7 +78,7 @@ class AzureTraceFormatTest { { assertTrue(reader.nextRow()) }, { assertEquals("x/XsOfHO4ocsV99i4NluqKDuxctW2MMVmwqOPAlg4wp8mqbBOe3wxBlQo0+Qx+uf", reader.getString(RESOURCE_ID)) }, { assertEquals(1, reader.getInt(RESOURCE_CPU_COUNT)) }, - { assertEquals(1750000.0, reader.getDouble(RESOURCE_MEM_CAPACITY)) }, + { assertEquals(1750000.0, reader.getDouble(RESOURCE_MEM_CAPACITY)) } ) reader.close() diff --git a/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsExTraceFormat.kt b/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsExTraceFormat.kt index 8abf811c..d364694c 100644 --- a/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsExTraceFormat.kt +++ b/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsExTraceFormat.kt @@ -79,7 +79,7 @@ public class BitbrainsExTraceFormat : TraceFormat { TableColumn(RESOURCE_STATE_CPU_READY_PCT, TableColumnType.Double), TableColumn(RESOURCE_MEM_CAPACITY, TableColumnType.Double), TableColumn(RESOURCE_STATE_DISK_READ, TableColumnType.Double), - TableColumn(RESOURCE_STATE_DISK_WRITE, TableColumnType.Double), + TableColumn(RESOURCE_STATE_DISK_WRITE, TableColumnType.Double) ) ) else -> throw IllegalArgumentException("Table $table not supported") diff --git a/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsTraceFormat.kt b/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsTraceFormat.kt index 57fc90e5..b0809735 100644 --- a/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsTraceFormat.kt +++ b/opendc-trace/opendc-trace-bitbrains/src/main/kotlin/org/opendc/trace/bitbrains/BitbrainsTraceFormat.kt @@ -93,8 +93,8 @@ public class BitbrainsTraceFormat : TraceFormat { TableColumn(RESOURCE_STATE_DISK_READ, TableColumnType.Double), TableColumn(RESOURCE_STATE_DISK_WRITE, TableColumnType.Double), TableColumn(RESOURCE_STATE_NET_RX, TableColumnType.Double), - TableColumn(RESOURCE_STATE_NET_TX, TableColumnType.Double), - ), + TableColumn(RESOURCE_STATE_NET_TX, TableColumnType.Double) + ) ) else -> throw IllegalArgumentException("Table $table not supported") } diff --git a/opendc-trace/opendc-trace-calcite/src/main/kotlin/org/opendc/trace/calcite/TraceTableModify.kt b/opendc-trace/opendc-trace-calcite/src/main/kotlin/org/opendc/trace/calcite/TraceTableModify.kt index 902a5db4..cc23854f 100644 --- a/opendc-trace/opendc-trace-calcite/src/main/kotlin/org/opendc/trace/calcite/TraceTableModify.kt +++ b/opendc-trace/opendc-trace-calcite/src/main/kotlin/org/opendc/trace/calcite/TraceTableModify.kt @@ -126,7 +126,7 @@ internal class TraceTableModify( Long::class.java, expression, INSERT_METHOD, - convertedChildExpr, + convertedChildExpr ) ) ) diff --git a/opendc-trace/opendc-trace-calcite/src/test/kotlin/org/opendc/trace/calcite/CalciteTest.kt b/opendc-trace/opendc-trace-calcite/src/test/kotlin/org/opendc/trace/calcite/CalciteTest.kt index 77346e74..64bb31c9 100644 --- a/opendc-trace/opendc-trace-calcite/src/test/kotlin/org/opendc/trace/calcite/CalciteTest.kt +++ b/opendc-trace/opendc-trace-calcite/src/test/kotlin/org/opendc/trace/calcite/CalciteTest.kt @@ -86,7 +86,7 @@ class CalciteTest { { assertEquals(300000, rs.getLong("duration")) }, { assertEquals(0.0, rs.getDouble("cpu_usage")) }, { assertTrue(rs.next()) }, - { assertEquals("1019", rs.getString("id")) }, + { assertEquals("1019", rs.getString("id")) } ) } } @@ -98,7 +98,7 @@ class CalciteTest { { assertTrue(rs.next()) }, { assertArrayEquals(arrayOf("1019", "1023", "1052"), rs.getArray("members").array as Array<*>) }, { assertEquals(0.0, rs.getDouble("target")) }, - { assertEquals(0.8830158730158756, rs.getDouble("score")) }, + { assertEquals(0.8830158730158756, rs.getDouble("score")) } ) } } @@ -109,7 +109,7 @@ class CalciteTest { assertAll( { assertTrue(rs.next()) }, { assertEquals(249.59993808, rs.getDouble("max_cpu_usage")) }, - { assertEquals(5.387240309118493, rs.getDouble("avg_cpu_usage")) }, + { assertEquals(5.387240309118493, rs.getDouble("avg_cpu_usage")) } ) } } @@ -214,7 +214,7 @@ class CalciteTest { runQuery(trace, "SELECT id FROM trace.resources") { rs -> assertAll( { assertTrue(rs.next()) }, - { assertArrayEquals(byteArrayOf(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2), rs.getBytes("id")) }, + { assertArrayEquals(byteArrayOf(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2), rs.getBytes("id")) } ) } } diff --git a/opendc-trace/opendc-trace-calcite/src/test/kotlin/org/opendc/trace/calcite/TraceSchemaFactoryTest.kt b/opendc-trace/opendc-trace-calcite/src/test/kotlin/org/opendc/trace/calcite/TraceSchemaFactoryTest.kt index eb4bc769..735cedce 100644 --- a/opendc-trace/opendc-trace-calcite/src/test/kotlin/org/opendc/trace/calcite/TraceSchemaFactoryTest.kt +++ b/opendc-trace/opendc-trace-calcite/src/test/kotlin/org/opendc/trace/calcite/TraceSchemaFactoryTest.kt @@ -48,7 +48,7 @@ class TraceSchemaFactoryTest { { assertEquals("1019", rs.getString("id")) }, { assertEquals(1, rs.getInt("cpu_count")) }, { assertEquals(Timestamp.valueOf("2013-08-12 13:40:46.0"), rs.getTimestamp("start_time")) }, - { assertEquals(181352.0, rs.getDouble("mem_capacity")) }, + { assertEquals(181352.0, rs.getDouble("mem_capacity")) } ) } finally { rs.close() diff --git a/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt b/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt index c7fbd4b5..d2ded0ee 100644 --- a/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt +++ b/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt @@ -72,7 +72,7 @@ public class GwfTraceFormat : TraceFormat { TableColumn(TASK_RUNTIME, TableColumnType.Duration), TableColumn(TASK_REQ_NCPUS, TableColumnType.Int), TableColumn(TASK_ALLOC_NCPUS, TableColumnType.Int), - TableColumn(TASK_PARENTS, TableColumnType.Set(TableColumnType.String)), + TableColumn(TASK_PARENTS, TableColumnType.Set(TableColumnType.String)) ) ) else -> throw IllegalArgumentException("Table $table not supported") diff --git a/opendc-trace/opendc-trace-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt b/opendc-trace/opendc-trace-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt index 9c97547a..c75e86df 100644 --- a/opendc-trace/opendc-trace-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt +++ b/opendc-trace/opendc-trace-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt @@ -82,7 +82,7 @@ internal class GwfTraceFormatTest { { assertEquals("1", reader.getString(TASK_ID)) }, { assertEquals(Instant.ofEpochSecond(16), reader.getInstant(TASK_SUBMIT_TIME)) }, { assertEquals(Duration.ofSeconds(11), reader.getDuration(TASK_RUNTIME)) }, - { assertEquals(emptySet(), reader.getSet(TASK_PARENTS, String::class.java)) }, + { assertEquals(emptySet(), reader.getSet(TASK_PARENTS, String::class.java)) } ) } @@ -101,7 +101,7 @@ internal class GwfTraceFormatTest { { assertEquals("7", reader.getString(TASK_ID)) }, { assertEquals(Instant.ofEpochSecond(87), reader.getInstant(TASK_SUBMIT_TIME)) }, { assertEquals(Duration.ofSeconds(11), reader.getDuration(TASK_RUNTIME)) }, - { assertEquals(setOf("4", "5", "6"), reader.getSet(TASK_PARENTS, String::class.java)) }, + { assertEquals(setOf("4", "5", "6"), reader.getSet(TASK_PARENTS, String::class.java)) } ) } diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmTraceFormat.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmTraceFormat.kt index 07a26fb5..c4790538 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmTraceFormat.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/OdcVmTraceFormat.kt @@ -95,7 +95,7 @@ public class OdcVmTraceFormat : TraceFormat { TableColumn(RESOURCE_STOP_TIME, TableColumnType.Instant), TableColumn(RESOURCE_CPU_COUNT, TableColumnType.Int), TableColumn(RESOURCE_CPU_CAPACITY, TableColumnType.Double), - TableColumn(RESOURCE_MEM_CAPACITY, TableColumnType.Double), + TableColumn(RESOURCE_MEM_CAPACITY, TableColumnType.Double) ) ) TABLE_RESOURCE_STATES -> TableDetails( @@ -104,14 +104,14 @@ public class OdcVmTraceFormat : TraceFormat { TableColumn(RESOURCE_STATE_TIMESTAMP, TableColumnType.Instant), TableColumn(RESOURCE_STATE_DURATION, TableColumnType.Duration), TableColumn(RESOURCE_CPU_COUNT, TableColumnType.Int), - TableColumn(RESOURCE_STATE_CPU_USAGE, TableColumnType.Double), + TableColumn(RESOURCE_STATE_CPU_USAGE, TableColumnType.Double) ) ) TABLE_INTERFERENCE_GROUPS -> TableDetails( listOf( TableColumn(INTERFERENCE_GROUP_MEMBERS, TableColumnType.Set(TableColumnType.String)), TableColumn(INTERFERENCE_GROUP_TARGET, TableColumnType.Double), - TableColumn(INTERFERENCE_GROUP_SCORE, TableColumnType.Double), + TableColumn(INTERFERENCE_GROUP_SCORE, TableColumnType.Double) ) ) else -> throw IllegalArgumentException("Table $table not supported") @@ -130,10 +130,11 @@ public class OdcVmTraceFormat : TraceFormat { } TABLE_INTERFERENCE_GROUPS -> { val modelPath = path.resolve("interference-model.json") - val parser = if (modelPath.exists()) + val parser = if (modelPath.exists()) { jsonFactory.createParser(modelPath.toFile()) - else + } else { jsonFactory.createParser("[]") // If model does not exist, return empty model + } OdcVmInterferenceJsonTableReader(parser) } diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceReadSupport.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceReadSupport.kt index aafa23a4..52911d5f 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceReadSupport.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceReadSupport.kt @@ -55,7 +55,7 @@ internal class ResourceReadSupport(private val projection: List?) : Read "cpu_count" to RESOURCE_CPU_COUNT, "cpu_capacity" to RESOURCE_CPU_CAPACITY, "requiredMemory" to RESOURCE_MEM_CAPACITY, - "mem_capacity" to RESOURCE_MEM_CAPACITY, + "mem_capacity" to RESOURCE_MEM_CAPACITY ) override fun init(context: InitContext): ReadContext { @@ -111,7 +111,7 @@ internal class ResourceReadSupport(private val projection: List?) : Read .named("maxCores"), Types .required(PrimitiveType.PrimitiveTypeName.INT64) - .named("requiredMemory"), + .named("requiredMemory") ) .named("resource") @@ -141,7 +141,7 @@ internal class ResourceReadSupport(private val projection: List?) : Read .named("cpu_capacity"), Types .required(PrimitiveType.PrimitiveTypeName.INT64) - .named("mem_capacity"), + .named("mem_capacity") ) .named("resource") diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceStateReadSupport.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceStateReadSupport.kt index 282501f3..56366cd8 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceStateReadSupport.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceStateReadSupport.kt @@ -52,7 +52,7 @@ internal class ResourceStateReadSupport(private val projection: List?) : "cores" to RESOURCE_CPU_COUNT, "cpu_count" to RESOURCE_CPU_COUNT, "cpuUsage" to RESOURCE_STATE_CPU_USAGE, - "cpu_usage" to RESOURCE_STATE_CPU_USAGE, + "cpu_usage" to RESOURCE_STATE_CPU_USAGE ) override fun init(context: InitContext): ReadContext { diff --git a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceWriteSupport.kt b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceWriteSupport.kt index 790ff4e8..cd428754 100644 --- a/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceWriteSupport.kt +++ b/opendc-trace/opendc-trace-opendc/src/main/kotlin/org/opendc/trace/opendc/parquet/ResourceWriteSupport.kt @@ -110,7 +110,7 @@ internal class ResourceWriteSupport : WriteSupport() { .named("cpu_capacity"), Types .required(PrimitiveType.PrimitiveTypeName.INT64) - .named("mem_capacity"), + .named("mem_capacity") ) .named("resource") } diff --git a/opendc-trace/opendc-trace-opendc/src/test/kotlin/org/opendc/trace/opendc/OdcVmTraceFormatTest.kt b/opendc-trace/opendc-trace-opendc/src/test/kotlin/org/opendc/trace/opendc/OdcVmTraceFormatTest.kt index ad87b085..d3c3b35b 100644 --- a/opendc-trace/opendc-trace-opendc/src/test/kotlin/org/opendc/trace/opendc/OdcVmTraceFormatTest.kt +++ b/opendc-trace/opendc-trace-opendc/src/test/kotlin/org/opendc/trace/opendc/OdcVmTraceFormatTest.kt @@ -131,7 +131,7 @@ internal class OdcVmTraceFormatTest { { assertEquals(1, reader.getInt(RESOURCE_CPU_COUNT)) }, { assertEquals(1024.0, reader.getDouble(RESOURCE_CPU_CAPACITY)) }, { assertEquals(1024.0, reader.getDouble(RESOURCE_MEM_CAPACITY)) }, - { assertFalse(reader.nextRow()) }, + { assertFalse(reader.nextRow()) } ) reader.close() @@ -178,7 +178,7 @@ internal class OdcVmTraceFormatTest { { assertEquals(Instant.EPOCH, reader.getInstant(RESOURCE_STATE_TIMESTAMP)) }, { assertEquals(1, reader.getInt(RESOURCE_CPU_COUNT)) }, { assertEquals(23.0, reader.getDouble(RESOURCE_STATE_CPU_USAGE)) }, - { assertFalse(reader.nextRow()) }, + { assertFalse(reader.nextRow()) } ) reader.close() @@ -247,7 +247,7 @@ internal class OdcVmTraceFormatTest { { assertEquals(setOf("a", "b", "d"), reader.getSet(INTERFERENCE_GROUP_MEMBERS, String::class.java)) }, { assertEquals(0.5, reader.getDouble(INTERFERENCE_GROUP_TARGET)) }, { assertEquals(0.9, reader.getDouble(INTERFERENCE_GROUP_SCORE)) }, - { assertFalse(reader.nextRow()) }, + { assertFalse(reader.nextRow()) } ) reader.close() diff --git a/opendc-trace/opendc-trace-parquet/src/main/kotlin/org/opendc/trace/util/parquet/LocalParquetReader.kt b/opendc-trace/opendc-trace-parquet/src/main/kotlin/org/opendc/trace/util/parquet/LocalParquetReader.kt index eef83956..031bad60 100644 --- a/opendc-trace/opendc-trace-parquet/src/main/kotlin/org/opendc/trace/util/parquet/LocalParquetReader.kt +++ b/opendc-trace/opendc-trace-parquet/src/main/kotlin/org/opendc/trace/util/parquet/LocalParquetReader.kt @@ -46,14 +46,15 @@ public class LocalParquetReader( /** * The input files to process. */ - private val filesIterator = if (path.isDirectory()) + private val filesIterator = if (path.isDirectory()) { Files.list(path) .filter { !it.isDirectory() } .sorted() .map { LocalInputFile(it) } .iterator() - else + } else { listOf(LocalInputFile(path)).iterator() + } /** * The Parquet reader to use. @@ -76,10 +77,11 @@ public class LocalParquetReader( } else { initReader() - if (reader == null) + if (reader == null) { null - else + } else { read() + } } } catch (e: InterruptedException) { throw IOException(e) diff --git a/opendc-trace/opendc-trace-swf/src/test/kotlin/org/opendc/trace/swf/SwfTraceFormatTest.kt b/opendc-trace/opendc-trace-swf/src/test/kotlin/org/opendc/trace/swf/SwfTraceFormatTest.kt index 436f2572..71d6dee3 100644 --- a/opendc-trace/opendc-trace-swf/src/test/kotlin/org/opendc/trace/swf/SwfTraceFormatTest.kt +++ b/opendc-trace/opendc-trace-swf/src/test/kotlin/org/opendc/trace/swf/SwfTraceFormatTest.kt @@ -77,7 +77,7 @@ internal class SwfTraceFormatTest { { assertEquals(306, reader.getInt(TASK_ALLOC_NCPUS)) }, { assertTrue(reader.nextRow()) }, { assertEquals("2", reader.getString(TASK_ID)) }, - { assertEquals(17, reader.getInt(TASK_ALLOC_NCPUS)) }, + { assertEquals(17, reader.getInt(TASK_ALLOC_NCPUS)) } ) reader.close() diff --git a/opendc-trace/opendc-trace-testkit/src/main/kotlin/org/opendc/trace/testkit/TableReaderTestKit.kt b/opendc-trace/opendc-trace-testkit/src/main/kotlin/org/opendc/trace/testkit/TableReaderTestKit.kt index dc0f3198..4624cba0 100644 --- a/opendc-trace/opendc-trace-testkit/src/main/kotlin/org/opendc/trace/testkit/TableReaderTestKit.kt +++ b/opendc-trace/opendc-trace-testkit/src/main/kotlin/org/opendc/trace/testkit/TableReaderTestKit.kt @@ -89,7 +89,7 @@ public abstract class TableReaderTestKit { { assertThrows { reader.getDuration(-1) } }, { assertThrows { reader.getList(-1, Any::class.java) } }, { assertThrows { reader.getSet(-1, Any::class.java) } }, - { assertThrows { reader.getMap(-1, Any::class.java, Any::class.java) } }, + { assertThrows { reader.getMap(-1, Any::class.java, Any::class.java) } } ) } diff --git a/opendc-trace/opendc-trace-testkit/src/main/kotlin/org/opendc/trace/testkit/TableWriterTestKit.kt b/opendc-trace/opendc-trace-testkit/src/main/kotlin/org/opendc/trace/testkit/TableWriterTestKit.kt index 34bcbaf3..3cd05f50 100644 --- a/opendc-trace/opendc-trace-testkit/src/main/kotlin/org/opendc/trace/testkit/TableWriterTestKit.kt +++ b/opendc-trace/opendc-trace-testkit/src/main/kotlin/org/opendc/trace/testkit/TableWriterTestKit.kt @@ -88,7 +88,7 @@ public abstract class TableWriterTestKit { { assertThrows { writer.setDuration(-1, Duration.ofMinutes(5)) } }, { assertThrows { writer.setList(-1, listOf("test")) } }, { assertThrows { writer.setSet(-1, setOf("test")) } }, - { assertThrows { writer.setMap(-1, mapOf("test" to "test")) } }, + { assertThrows { writer.setMap(-1, mapOf("test" to "test")) } } ) } diff --git a/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/ConvertCommand.kt b/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/ConvertCommand.kt index 13e05a0b..bf0e2e3b 100644 --- a/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/ConvertCommand.kt +++ b/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/ConvertCommand.kt @@ -105,7 +105,7 @@ internal class ConvertCommand : CliktCommand(name = "convert", help = "Convert b */ private val converter by option("-c", "--converter", help = "converter strategy to use").groupChoice( "default" to DefaultTraceConverter(), - "azure" to AzureTraceConverter(), + "azure" to AzureTraceConverter() ).defaultByName("default") override fun run() { diff --git a/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/QueryCommand.kt b/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/QueryCommand.kt index b79a9f13..98b4cdf5 100644 --- a/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/QueryCommand.kt +++ b/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/QueryCommand.kt @@ -121,7 +121,7 @@ internal class QueryCommand : CliktCommand(name = "query", help = "Query workloa val options = mapOf( Printer.COLUMNS to List(meta.columnCount) { meta.getColumnName(it + 1) }, - Printer.BORDER to "|", + Printer.BORDER to "|" ) val data = mutableListOf>() diff --git a/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/TraceTools.kt b/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/TraceTools.kt index b480484b..8f3dc60d 100644 --- a/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/TraceTools.kt +++ b/opendc-trace/opendc-trace-tools/src/main/kotlin/org/opendc/trace/tools/TraceTools.kt @@ -21,6 +21,7 @@ */ @file:JvmName("TraceTools") + package org.opendc.trace.tools import com.github.ajalt.clikt.core.CliktCommand diff --git a/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt b/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt index 80a9d80e..75f4b413 100644 --- a/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt +++ b/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt @@ -81,7 +81,7 @@ class WfFormatTraceFormatTest { { assertEquals("makebwaindex_mammoth_mt_krause.fasta", reader.getString(TASK_ID)) }, { assertEquals("eager-nextflow-chameleon", reader.getString(TASK_WORKFLOW_ID)) }, { assertEquals(172000, reader.getDuration(TASK_RUNTIME)?.toMillis()) }, - { assertEquals(emptySet(), reader.getSet(TASK_PARENTS, String::class.java)) }, + { assertEquals(emptySet(), reader.getSet(TASK_PARENTS, String::class.java)) } ) assertAll( @@ -89,7 +89,7 @@ class WfFormatTraceFormatTest { { assertEquals("makeseqdict_mammoth_mt_krause.fasta", reader.getString(TASK_ID)) }, { assertEquals("eager-nextflow-chameleon", reader.getString(TASK_WORKFLOW_ID)) }, { assertEquals(175000, reader.getDuration(TASK_RUNTIME)?.toMillis()) }, - { assertEquals(setOf("makebwaindex_mammoth_mt_krause.fasta"), reader.getSet(TASK_PARENTS, String::class.java)) }, + { assertEquals(setOf("makebwaindex_mammoth_mt_krause.fasta"), reader.getSet(TASK_PARENTS, String::class.java)) } ) reader.close() diff --git a/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/parquet/TaskReadSupport.kt b/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/parquet/TaskReadSupport.kt index 47d26ec5..33be38d4 100644 --- a/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/parquet/TaskReadSupport.kt +++ b/opendc-trace/opendc-trace-wtf/src/main/kotlin/org/opendc/trace/wtf/parquet/TaskReadSupport.kt @@ -139,7 +139,7 @@ internal class TaskReadSupport(private val projection: List?) : ReadSupp .named("list") ) .`as`(LogicalTypeAnnotation.listType()) - .named("parents"), + .named("parents") ) .named("task") } diff --git a/opendc-trace/opendc-trace-wtf/src/test/kotlin/org/opendc/trace/wtf/WtfTraceFormatTest.kt b/opendc-trace/opendc-trace-wtf/src/test/kotlin/org/opendc/trace/wtf/WtfTraceFormatTest.kt index 16462217..9cd9538f 100644 --- a/opendc-trace/opendc-trace-wtf/src/test/kotlin/org/opendc/trace/wtf/WtfTraceFormatTest.kt +++ b/opendc-trace/opendc-trace-wtf/src/test/kotlin/org/opendc/trace/wtf/WtfTraceFormatTest.kt @@ -89,7 +89,7 @@ class WtfTraceFormatTest { setOf("584055316413447529", "133113685133695608", "1008582348422865408"), reader.getSet(TASK_PARENTS, String::class.java) ) - }, + } ) assertAll( @@ -103,7 +103,7 @@ class WtfTraceFormatTest { setOf("584055316413447529", "133113685133695608", "1008582348422865408"), reader.getSet(TASK_PARENTS, String::class.java) ) - }, + } ) reader.close() diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Room.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Room.kt index 5b305168..c5499150 100644 --- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Room.kt +++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Room.kt @@ -29,5 +29,5 @@ public data class Room( val id: String, val name: String, val tiles: Set, - val topologyId: String? = null, + val topologyId: String? = null ) diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/RoomTile.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/RoomTile.kt index 666d66ee..53cb53cd 100644 --- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/RoomTile.kt +++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/RoomTile.kt @@ -30,5 +30,5 @@ public data class RoomTile( val positionX: Double, val positionY: Double, val rack: Rack? = null, - val roomId: String? = null, + val roomId: String? = null ) diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Trace.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Trace.kt index 2952a273..1c086cd8 100644 --- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Trace.kt +++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/Trace.kt @@ -32,5 +32,5 @@ package org.opendc.web.proto public data class Trace( val id: String, val name: String, - val type: String, + val type: String ) diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Portfolio.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Portfolio.kt index 916d8cf0..5faad5b3 100644 --- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Portfolio.kt +++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Portfolio.kt @@ -39,5 +39,5 @@ public data class Portfolio( val id: Long, val number: Int, val name: String, - val targets: Targets, + val targets: Targets ) diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Topology.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Topology.kt index 4bffdee9..bc185aea 100644 --- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Topology.kt +++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/runner/Topology.kt @@ -36,5 +36,5 @@ public data class Topology( val name: String, val rooms: List, val createdAt: Instant, - val updatedAt: Instant, + val updatedAt: Instant ) diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Portfolio.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Portfolio.kt index 6f468e79..99d0f65e 100644 --- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Portfolio.kt +++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Portfolio.kt @@ -67,6 +67,6 @@ public data class Portfolio( val id: Long, val number: Int, val name: String, - val targets: Targets, + val targets: Targets ) } diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/ProjectRole.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/ProjectRole.kt index 0f6de1fc..ea6a30ab 100644 --- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/ProjectRole.kt +++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/ProjectRole.kt @@ -39,5 +39,5 @@ public enum class ProjectRole { /** * The user owns the project (so he can delete it). */ - OWNER, + OWNER } diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Scenario.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Scenario.kt index 552a4912..ed77ef08 100644 --- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Scenario.kt +++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Scenario.kt @@ -58,7 +58,7 @@ public data class Scenario( val workload: Workload.Spec, val topology: Long, val phenomena: OperationalPhenomena, - val schedulerName: String, + val schedulerName: String ) /** diff --git a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Topology.kt b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Topology.kt index a144a2e6..73748bb9 100644 --- a/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Topology.kt +++ b/opendc-web/opendc-web-proto/src/main/kotlin/org/opendc/web/proto/user/Topology.kt @@ -37,7 +37,7 @@ public data class Topology( val name: String, val rooms: List, val createdAt: Instant, - val updatedAt: Instant, + val updatedAt: Instant ) { /** * Create a new topology for a project. @@ -70,6 +70,6 @@ public data class Topology( val number: Int, val name: String, val createdAt: Instant, - val updatedAt: Instant, + val updatedAt: Instant ) } diff --git a/opendc-web/opendc-web-runner-quarkus-deployment/src/main/java/org/opendc/web/runner/deployment/OpenDCRunnerProcessor.java b/opendc-web/opendc-web-runner-quarkus-deployment/src/main/java/org/opendc/web/runner/deployment/OpenDCRunnerProcessor.java index 94921454..85a973e7 100644 --- a/opendc-web/opendc-web-runner-quarkus-deployment/src/main/java/org/opendc/web/runner/deployment/OpenDCRunnerProcessor.java +++ b/opendc-web/opendc-web-runner-quarkus-deployment/src/main/java/org/opendc/web/runner/deployment/OpenDCRunnerProcessor.java @@ -22,6 +22,8 @@ package org.opendc.web.runner.deployment; +import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT; + import io.quarkus.arc.deployment.UnremovableBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; @@ -30,19 +32,15 @@ import io.quarkus.deployment.builditem.*; import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem; import io.quarkus.deployment.util.ServiceUtil; import io.quarkus.runtime.RuntimeValue; +import java.io.IOException; +import java.util.Set; +import java.util.function.BooleanSupplier; import org.opendc.trace.spi.TraceFormat; import org.opendc.web.runner.JobManager; import org.opendc.web.runner.OpenDCRunner; import org.opendc.web.runner.runtime.OpenDCRunnerRecorder; import org.opendc.web.runner.runtime.OpenDCRunnerRuntimeConfig; -import java.io.IOException; -import java.util.Collections; -import java.util.Set; -import java.util.function.BooleanSupplier; - -import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT; - /** * Build processor for the OpenDC web runner Quarkus extension. */ @@ -65,12 +63,11 @@ public class OpenDCRunnerProcessor { void registerTraceFormats(BuildProducer services) throws IOException { String service = "META-INF/services/" + TraceFormat.class.getName(); - Set implementations = ServiceUtil.classNamesNamedIn(Thread.currentThread().getContextClassLoader(), - service); + Set implementations = + ServiceUtil.classNamesNamedIn(Thread.currentThread().getContextClassLoader(), service); services.produce( - new ServiceProviderBuildItem(TraceFormat.class.getName(), - implementations.toArray(new String[0]))); + new ServiceProviderBuildItem(TraceFormat.class.getName(), implementations.toArray(new String[0]))); } /** @@ -86,9 +83,10 @@ public class OpenDCRunnerProcessor { */ @BuildStep(onlyIf = IsIncluded.class) @Record(RUNTIME_INIT) - ServiceStartBuildItem createRunnerService(OpenDCRunnerRecorder recorder, - OpenDCRunnerRuntimeConfig config, - BuildProducer runnerBuildItem) { + ServiceStartBuildItem createRunnerService( + OpenDCRunnerRecorder recorder, + OpenDCRunnerRuntimeConfig config, + BuildProducer runnerBuildItem) { RuntimeValue runner = recorder.createRunner(config); runnerBuildItem.produce(new OpenDCRunnerBuildItem(runner)); return new ServiceStartBuildItem("OpenDCRunnerService"); @@ -99,12 +97,13 @@ public class OpenDCRunnerProcessor { */ @BuildStep(onlyIf = IsIncluded.class) @Record(RUNTIME_INIT) - void startRunnerService(ApplicationStartBuildItem start, - OpenDCRunnerBuildItem runnerBuildItem, - OpenDCRunnerRecorder recorder, - OpenDCRunnerRuntimeConfig config, - ShutdownContextBuildItem shutdownContextBuildItem) { - recorder.startRunner(runnerBuildItem.getRunner(), config,shutdownContextBuildItem); + void startRunnerService( + ApplicationStartBuildItem start, + OpenDCRunnerBuildItem runnerBuildItem, + OpenDCRunnerRecorder recorder, + OpenDCRunnerRuntimeConfig config, + ShutdownContextBuildItem shutdownContextBuildItem) { + recorder.startRunner(runnerBuildItem.getRunner(), config, shutdownContextBuildItem); } /** diff --git a/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java b/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java index f5c056ef..76f2368f 100644 --- a/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java +++ b/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRecorder.java @@ -25,13 +25,12 @@ package org.opendc.web.runner.runtime; import io.quarkus.runtime.RuntimeValue; import io.quarkus.runtime.ShutdownContext; import io.quarkus.runtime.annotations.Recorder; +import java.io.File; +import javax.enterprise.inject.spi.CDI; import org.jboss.logging.Logger; import org.opendc.web.runner.JobManager; import org.opendc.web.runner.OpenDCRunner; -import javax.enterprise.inject.spi.CDI; -import java.io.File; - /** * Helper class for starting the OpenDC web runner. */ @@ -52,13 +51,12 @@ public class OpenDCRunnerRecorder { JobManager manager = CDI.current().select(JobManager.class).get(); OpenDCRunner runner = new OpenDCRunner( - manager, - new File(config.tracePath), - parallelism, - config.jobTimeout, - config.pollInterval, - config.heartbeatInterval - ); + manager, + new File(config.tracePath), + parallelism, + config.jobTimeout, + config.pollInterval, + config.heartbeatInterval); return new RuntimeValue<>(runner); } @@ -66,9 +64,8 @@ public class OpenDCRunnerRecorder { /** * Helper method to start the OpenDC runner service. */ - public void startRunner(RuntimeValue runner, - OpenDCRunnerRuntimeConfig config, - ShutdownContext shutdownContext) { + public void startRunner( + RuntimeValue runner, OpenDCRunnerRuntimeConfig config, ShutdownContext shutdownContext) { if (config.enable) { LOGGER.info("Starting OpenDC Runner in background (polling every " + config.pollInterval + ")"); diff --git a/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java b/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java index e9258f06..61c07e48 100644 --- a/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java +++ b/opendc-web/opendc-web-runner-quarkus/src/main/java/org/opendc/web/runner/runtime/OpenDCRunnerRuntimeConfig.java @@ -25,7 +25,6 @@ package org.opendc.web.runner.runtime; import io.quarkus.runtime.annotations.ConfigItem; import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; - import java.time.Duration; /** 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 56fecf78..299c4d09 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 @@ -109,7 +109,7 @@ class RunnerCli : CliktCommand(name = "opendc-runner") { */ private val parallelism by option( "--parallelism", - help = "maximum number of threads for simulations", + help = "maximum number of threads for simulations" ) .int() .default(Runtime.getRuntime().availableProcessors() - 1) 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 b0f99084..226bad47 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 @@ -215,7 +215,7 @@ public class OpenDCRunner( private inner class SimulationTask( private val scenario: Scenario, private val repeat: Int, - private val topology: List, + private val topology: List ) : RecursiveTask() { override fun compute(): WebComputeMonitor.Results { val monitor = WebComputeMonitor() @@ -261,10 +261,11 @@ public class OpenDCRunner( val phenomena = scenario.phenomena val failureModel = - if (phenomena.failures) + if (phenomena.failures) { grid5000(Duration.ofDays(7)) - else + } else { null + } // Run workload trace service.replay(clock, vms, seed, failureModel = failureModel, interference = phenomena.interference) diff --git a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/WebComputeMonitor.kt b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/WebComputeMonitor.kt index 76377c08..4db70d3d 100644 --- a/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/WebComputeMonitor.kt +++ b/opendc-web/opendc-web-runner/src/main/kotlin/org/opendc/web/runner/internal/WebComputeMonitor.kt @@ -66,7 +66,7 @@ internal class WebComputeMonitor : ComputeMonitor { val totalLostTime: Long = 0L, val totalPowerDraw: Double = 0.0, val totalFailureSlices: Double = 0.0, - val totalFailureVmSlices: Double = 0.0, + val totalFailureVmSlices: Double = 0.0 ) private data class HostMetrics( @@ -84,7 +84,7 @@ internal class WebComputeMonitor : ComputeMonitor { max(reader.serversPending, serviceMetrics.vmWaitingCount), max(reader.serversActive, serviceMetrics.vmActiveCount), max(0, serviceMetrics.vmInactiveCount), - max(reader.attemptsFailure, serviceMetrics.vmFailedCount), + max(reader.attemptsFailure, serviceMetrics.vmFailedCount) ) } @@ -115,7 +115,7 @@ internal class WebComputeMonitor : ComputeMonitor { serviceMetrics.vmTotalCount, serviceMetrics.vmWaitingCount, serviceMetrics.vmInactiveCount, - serviceMetrics.vmFailedCount, + serviceMetrics.vmFailedCount ) } diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Portfolio.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Portfolio.kt index 5b686d5f..09437712 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Portfolio.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Portfolio.kt @@ -87,7 +87,7 @@ class Portfolio( */ @Type(type = "json") @Column(columnDefinition = "jsonb", nullable = false, updatable = false) - val targets: Targets, + val targets: Targets ) { /** * The scenarios in this portfolio. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Project.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Project.kt index 5eb925ea..41d1a786 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Project.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Project.kt @@ -85,7 +85,7 @@ class Project( var name: String, @Column(name = "created_at", nullable = false, updatable = false) - val createdAt: Instant, + val createdAt: Instant ) { /** * The instant at which the project was updated. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Scenario.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Scenario.kt index a7258e7b..62adc9e2 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Scenario.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Scenario.kt @@ -106,7 +106,7 @@ class Scenario( val phenomena: OperationalPhenomena, @Column(name = "scheduler_name", nullable = false, updatable = false) - val schedulerName: String, + val schedulerName: String ) { /** * The [Job] associated with the scenario. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Trace.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Trace.kt index 0fc79ca8..14a88c5a 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Trace.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/model/Trace.kt @@ -43,7 +43,7 @@ import javax.persistence.Table NamedQuery( name = "Trace.findAll", query = "SELECT t FROM Trace t" - ), + ) ] ) class Trace( @@ -54,7 +54,7 @@ class Trace( val name: String, @Column(nullable = false, updatable = false) - val type: String, + val type: String ) { /** * Return a string representation of this trace. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioResource.kt index da565fe4..ebe57ae2 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioResource.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioResource.kt @@ -43,7 +43,7 @@ import javax.ws.rs.WebApplicationException @RolesAllowed("openid") class PortfolioResource @Inject constructor( private val portfolioService: PortfolioService, - private val identity: SecurityIdentity, + private val identity: SecurityIdentity ) { /** * Get all portfolios that belong to the specified project. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResource.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResource.kt index 515f6be6..82f35127 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResource.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/rest/user/PortfolioScenarioResource.kt @@ -42,7 +42,7 @@ import javax.ws.rs.WebApplicationException @RolesAllowed("openid") class PortfolioScenarioResource @Inject constructor( private val scenarioService: ScenarioService, - private val identity: SecurityIdentity, + private val identity: SecurityIdentity ) { /** * Get all scenarios that belong to the specified portfolio. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ScenarioService.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ScenarioService.kt index 1929f44b..fad4e56f 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ScenarioService.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/service/ScenarioService.kt @@ -44,7 +44,7 @@ class ScenarioService @Inject constructor( private val portfolioRepository: PortfolioRepository, private val topologyRepository: TopologyRepository, private val traceRepository: TraceRepository, - private val scenarioRepository: ScenarioRepository, + private val scenarioRepository: ScenarioRepository ) { /** * List all [Scenario]s that belong a certain portfolio. diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBinarySqlTypeDescriptor.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBinarySqlTypeDescriptor.kt index 45752d4e..df6a3013 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBinarySqlTypeDescriptor.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBinarySqlTypeDescriptor.kt @@ -1,3 +1,25 @@ +/* + * Copyright (c) 2022 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package org.opendc.web.server.util.hibernate.json import com.fasterxml.jackson.databind.JsonNode diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt index cc8dad48..4924f586 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonBytesSqlTypeDescriptor.kt @@ -77,10 +77,12 @@ internal object JsonBytesSqlTypeDescriptor : AbstractJsonSqlTypeDescriptor() { private fun fromJsonBytes(jsonBytes: ByteArray?): String? { return if (jsonBytes == null) { null - } else try { - String(jsonBytes, CHARSET) - } catch (e: UnsupportedEncodingException) { - throw IllegalStateException(e) + } else { + try { + String(jsonBytes, CHARSET) + } catch (e: UnsupportedEncodingException) { + throw IllegalStateException(e) + } } } } diff --git a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonStringSqlTypeDescriptor.kt b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonStringSqlTypeDescriptor.kt index 63f32849..6e015762 100644 --- a/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonStringSqlTypeDescriptor.kt +++ b/opendc-web/opendc-web-server/src/main/kotlin/org/opendc/web/server/util/hibernate/json/JsonStringSqlTypeDescriptor.kt @@ -1,3 +1,25 @@ +/* + * Copyright (c) 2022 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package org.opendc.web.server.util.hibernate.json import org.hibernate.type.descriptor.ValueBinder diff --git a/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/runner/JobResourceTest.kt b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/runner/JobResourceTest.kt index 71aaa8a4..9aca58e9 100644 --- a/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/runner/JobResourceTest.kt +++ b/opendc-web/opendc-web-server/src/test/kotlin/org/opendc/web/server/rest/runner/JobResourceTest.kt @@ -62,7 +62,7 @@ class JobResourceTest { private val dummyPortfolio = Portfolio(1, 1, "test", Targets(emptySet())) private val dummyTopology = Topology(1, 1, "test", emptyList(), Instant.now(), Instant.now()) private val dummyTrace = Trace("bitbrains", "Bitbrains", "vm") - private val dummyScenario = Scenario(1, 1, dummyPortfolio, "test", Workload(dummyTrace, 1.0), dummyTopology, OperationalPhenomena(false, false), "test",) + private val dummyScenario = Scenario(1, 1, dummyPortfolio, "test", Workload(dummyTrace, 1.0), dummyTopology, OperationalPhenomena(false, false), "test") private val dummyJob = Job(1, dummyScenario, JobState.PENDING, Instant.now(), Instant.now()) @BeforeEach diff --git a/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/AuthConfiguration.java b/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/AuthConfiguration.java index 2e4d9198..82e02549 100644 --- a/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/AuthConfiguration.java +++ b/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/AuthConfiguration.java @@ -24,7 +24,6 @@ package org.opendc.web.ui.deployment; import io.quarkus.runtime.annotations.ConfigGroup; import io.quarkus.runtime.annotations.ConfigItem; - import java.util.Optional; /** diff --git a/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiConfig.java b/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiConfig.java index 50c1fbe3..d630dbac 100644 --- a/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiConfig.java +++ b/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiConfig.java @@ -24,7 +24,6 @@ package org.opendc.web.ui.deployment; import io.quarkus.runtime.annotations.ConfigItem; import io.quarkus.runtime.annotations.ConfigRoot; - import java.util.Optional; /** diff --git a/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiProcessor.java b/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiProcessor.java index 54782ace..093a9bfa 100644 --- a/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiProcessor.java +++ b/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiProcessor.java @@ -41,9 +41,6 @@ import io.quarkus.vertx.http.deployment.webjar.WebJarResourcesFilter; import io.quarkus.vertx.http.deployment.webjar.WebJarResultsBuildItem; import io.vertx.core.Handler; import io.vertx.ext.web.RoutingContext; -import org.opendc.web.ui.runtime.OpenDCUiRecorder; -import org.opendc.web.ui.runtime.OpenDCUiRuntimeConfig; - import java.io.*; import java.util.ArrayList; import java.util.Iterator; @@ -51,6 +48,8 @@ import java.util.function.BooleanSupplier; import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.opendc.web.ui.runtime.OpenDCUiRecorder; +import org.opendc.web.ui.runtime.OpenDCUiRuntimeConfig; /** * Build processor for the OpenDC web UI Quarkus extension. @@ -76,25 +75,25 @@ public class OpenDCUiProcessor { * Build the WebJar that is used to serve the Next.js resources. */ @BuildStep(onlyIf = IsIncluded.class) - public WebJarBuildItem buildWebJar(OpenDCUiConfig config, - HttpRootPathBuildItem httpRootPathBuildItem) { + public WebJarBuildItem buildWebJar(OpenDCUiConfig config, HttpRootPathBuildItem httpRootPathBuildItem) { return WebJarBuildItem.builder() - .artifactKey(OPENDC_UI_WEBJAR_ARTIFACT_KEY) - .root(OPENDC_UI_WEBJAR_STATIC_RESOURCES_PATH) - .onlyCopyNonArtifactFiles(false) - .useDefaultQuarkusBranding(false) - .filter(new InsertVariablesResourcesFilter(config, httpRootPathBuildItem)) - .build(); + .artifactKey(OPENDC_UI_WEBJAR_ARTIFACT_KEY) + .root(OPENDC_UI_WEBJAR_STATIC_RESOURCES_PATH) + .onlyCopyNonArtifactFiles(false) + .useDefaultQuarkusBranding(false) + .filter(new InsertVariablesResourcesFilter(config, httpRootPathBuildItem)) + .build(); } - /** * Build the Next.js routes based on the route manifest generated by it. */ @BuildStep(onlyIf = IsIncluded.class) - public OpenDCUiRoutingBuildItem buildRoutes(CurateOutcomeBuildItem curateOutcomeBuildItem) throws IOException { + public OpenDCUiRoutingBuildItem buildRoutes(CurateOutcomeBuildItem curateOutcomeBuildItem) throws IOException { ResolvedDependency dependency = getAppArtifact(curateOutcomeBuildItem, OPENDC_UI_WEBJAR_ARTIFACT_KEY); - PathVisit visit = dependency.getContentTree().apply(OPENDC_UI_WEBJAR_STATIC_RESOURCES_PATH + "/routes-manifest.json", v -> v); + PathVisit visit = dependency + .getContentTree() + .apply(OPENDC_UI_WEBJAR_STATIC_RESOURCES_PATH + "/routes-manifest.json", v -> v); if (visit == null) { throw new FileNotFoundException("Cannot find routes-manifest.json"); @@ -103,7 +102,7 @@ public class OpenDCUiProcessor { JsonNode routeManifest = objectMapper.readTree(visit.getUrl()); var pages = new ArrayList(); - for (Iterator it = routeManifest.get("staticRoutes").elements(); it.hasNext();) { + for (Iterator it = routeManifest.get("staticRoutes").elements(); it.hasNext(); ) { JsonNode route = it.next(); String page = route.get("page").asText(); @@ -112,7 +111,7 @@ public class OpenDCUiProcessor { pages.add(new OpenDCUiRoutingBuildItem.Page(page, page)); } - for (Iterator it = routeManifest.get("dynamicRoutes").elements(); it.hasNext();) { + for (Iterator it = routeManifest.get("dynamicRoutes").elements(); it.hasNext(); ) { JsonNode route = it.next(); String page = route.get("page").asText(); @@ -122,7 +121,7 @@ public class OpenDCUiProcessor { } var redirects = new ArrayList(); - for (Iterator it = routeManifest.get("redirects").elements(); it.hasNext();) { + for (Iterator it = routeManifest.get("redirects").elements(); it.hasNext(); ) { JsonNode redirect = it.next(); if (redirect.has("internal")) { continue; @@ -148,16 +147,18 @@ public class OpenDCUiProcessor { */ @BuildStep(onlyIf = IsIncluded.class) @Record(ExecutionTime.RUNTIME_INIT) - public void registerOpenDCUiHandler(OpenDCUiRecorder recorder, - BuildProducer routes, - HttpRootPathBuildItem httpRootPathBuildItem, - WebJarResultsBuildItem webJarResultsBuildItem, - OpenDCUiRoutingBuildItem openDCUiBuildItem, - OpenDCUiRuntimeConfig runtimeConfig, - OpenDCUiConfig buildConfig, - ShutdownContextBuildItem shutdownContext) { - - WebJarResultsBuildItem.WebJarResult result = webJarResultsBuildItem.byArtifactKey(OPENDC_UI_WEBJAR_ARTIFACT_KEY); + public void registerOpenDCUiHandler( + OpenDCUiRecorder recorder, + BuildProducer routes, + HttpRootPathBuildItem httpRootPathBuildItem, + WebJarResultsBuildItem webJarResultsBuildItem, + OpenDCUiRoutingBuildItem openDCUiBuildItem, + OpenDCUiRuntimeConfig runtimeConfig, + OpenDCUiConfig buildConfig, + ShutdownContextBuildItem shutdownContext) { + + WebJarResultsBuildItem.WebJarResult result = + webJarResultsBuildItem.byArtifactKey(OPENDC_UI_WEBJAR_ARTIFACT_KEY); if (result == null) { return; } @@ -167,41 +168,41 @@ public class OpenDCUiProcessor { /* Construct dynamic routes */ for (var redirect : openDCUiBuildItem.getRedirects()) { - String destination = basePath.equals("/") ? redirect.getDestination() : basePath + redirect.getDestination(); - - routes.produce(httpRootPathBuildItem.routeBuilder() - .route(basePath + redirect.getPath()) - .handler(recorder.redirectHandler(destination, redirect.getStatusCode(), runtimeConfig)) - .build()); + String destination = + basePath.equals("/") ? redirect.getDestination() : basePath + redirect.getDestination(); + + routes.produce(httpRootPathBuildItem + .routeBuilder() + .route(basePath + redirect.getPath()) + .handler(recorder.redirectHandler(destination, redirect.getStatusCode(), runtimeConfig)) + .build()); } for (var page : openDCUiBuildItem.getPages()) { - routes.produce(httpRootPathBuildItem.routeBuilder() - .route(basePath + page.getPath()) - .handler(recorder.pageHandler(finalDestination, page.getName(), runtimeConfig)) - .build()); + routes.produce(httpRootPathBuildItem + .routeBuilder() + .route(basePath + page.getPath()) + .handler(recorder.pageHandler(finalDestination, page.getName(), runtimeConfig)) + .build()); } /* Construct static routes */ Handler staticHandler = recorder.staticHandler( - finalDestination, - basePath, - result.getWebRootConfigurations(), - runtimeConfig, - shutdownContext - ); - - routes.produce(httpRootPathBuildItem.routeBuilder() - .route(buildConfig.path) - .displayOnNotFoundPage("OpenDC UI") - .routeConfigKey("quarkus.opendc-ui.path") - .handler(staticHandler) - .build()); - - routes.produce(httpRootPathBuildItem.routeBuilder() - .route(buildConfig.path + "*") - .handler(staticHandler) - .build()); + finalDestination, basePath, result.getWebRootConfigurations(), runtimeConfig, shutdownContext); + + routes.produce(httpRootPathBuildItem + .routeBuilder() + .route(buildConfig.path) + .displayOnNotFoundPage("OpenDC UI") + .routeConfigKey("quarkus.opendc-ui.path") + .handler(staticHandler) + .build()); + + routes.produce(httpRootPathBuildItem + .routeBuilder() + .route(buildConfig.path + "*") + .handler(staticHandler) + .build()); } /** @@ -216,7 +217,6 @@ public class OpenDCUiProcessor { private final OpenDCUiConfig config; private final HttpRootPathBuildItem httpRootPathBuildItem; - public InsertVariablesResourcesFilter(OpenDCUiConfig config, HttpRootPathBuildItem httpRootPathBuildItem) { this.config = config; this.httpRootPathBuildItem = httpRootPathBuildItem; @@ -304,7 +304,8 @@ public class OpenDCUiProcessor { } private static ResolvedDependency getAppArtifact(CurateOutcomeBuildItem curateOutcomeBuildItem, GACT artifactKey) { - for (ResolvedDependency dep : curateOutcomeBuildItem.getApplicationModel().getDependencies()) { + for (ResolvedDependency dep : + curateOutcomeBuildItem.getApplicationModel().getDependencies()) { if (dep.getKey().equals(artifactKey)) { return dep; } diff --git a/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiRoutingBuildItem.java b/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiRoutingBuildItem.java index 7e0f9408..6cf44893 100644 --- a/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiRoutingBuildItem.java +++ b/opendc-web/opendc-web-ui-quarkus-deployment/src/main/java/org/opendc/web/ui/deployment/OpenDCUiRoutingBuildItem.java @@ -23,7 +23,6 @@ package org.opendc.web.ui.deployment; import io.quarkus.builder.item.SimpleBuildItem; - import java.util.List; /** @@ -57,7 +56,7 @@ public final class OpenDCUiRoutingBuildItem extends SimpleBuildItem { } public boolean hasCustom404() { - return this.custom404; + return this.custom404; } /** diff --git a/opendc-web/opendc-web-ui-quarkus/src/main/java/org/opendc/web/ui/runtime/OpenDCUiRecorder.java b/opendc-web/opendc-web-ui-quarkus/src/main/java/org/opendc/web/ui/runtime/OpenDCUiRecorder.java index 026a9039..03fedd4f 100644 --- a/opendc-web/opendc-web-ui-quarkus/src/main/java/org/opendc/web/ui/runtime/OpenDCUiRecorder.java +++ b/opendc-web/opendc-web-ui-quarkus/src/main/java/org/opendc/web/ui/runtime/OpenDCUiRecorder.java @@ -29,7 +29,6 @@ import io.quarkus.vertx.http.runtime.webjar.WebJarNotFoundHandler; import io.quarkus.vertx.http.runtime.webjar.WebJarStaticHandler; import io.vertx.core.Handler; import io.vertx.ext.web.RoutingContext; - import java.util.List; import java.util.stream.Collectors; @@ -42,16 +41,11 @@ public class OpenDCUiRecorder { * Construct a {@link Handler} for serving a page of the OpenDC web interface. */ public Handler pageHandler( - String finalDestination, - String page, - OpenDCUiRuntimeConfig runtimeConfig - ) { + String finalDestination, String page, OpenDCUiRuntimeConfig runtimeConfig) { if (runtimeConfig.enable) { String pageDirectory = finalDestination + "/pages"; return (event) -> { - event.response() - .setStatusCode(200) - .sendFile(pageDirectory + page + ".html"); + event.response().setStatusCode(200).sendFile(pageDirectory + page + ".html"); }; } @@ -62,19 +56,16 @@ public class OpenDCUiRecorder { * Construct a {@link Handler} for handling redirects in the OpenDC web interface. */ public Handler redirectHandler( - String destination, - int statusCode, - OpenDCUiRuntimeConfig runtimeConfig - ) { + String destination, int statusCode, OpenDCUiRuntimeConfig runtimeConfig) { if (runtimeConfig.enable) { return (event) -> { String query = event.request().query(); String fullDestination = query != null ? destination + "?" + query : destination; event.response() - .setStatusCode(statusCode) - .putHeader("Location", fullDestination) - .end(); + .setStatusCode(statusCode) + .putHeader("Location", fullDestination) + .end(); }; } @@ -85,19 +76,19 @@ public class OpenDCUiRecorder { * Construct a {@link Handler} for serving the static files of the OpenDC web interface. */ public Handler staticHandler( - String finalDestination, - String path, - List webRootConfigurations, - OpenDCUiRuntimeConfig runtimeConfig, - ShutdownContext shutdownContext - ) { + String finalDestination, + String path, + List webRootConfigurations, + OpenDCUiRuntimeConfig runtimeConfig, + ShutdownContext shutdownContext) { if (runtimeConfig.enable) { - var augmentedWebRootConfigurations = webRootConfigurations - .stream() - .map(c -> new FileSystemStaticHandler.StaticWebRootConfiguration(c.getFileSystem(), c.getWebRoot().isEmpty() ? "static" : c.getWebRoot() + "/static")) - .collect(Collectors.toList()); + var augmentedWebRootConfigurations = webRootConfigurations.stream() + .map(c -> new FileSystemStaticHandler.StaticWebRootConfiguration( + c.getFileSystem(), c.getWebRoot().isEmpty() ? "static" : c.getWebRoot() + "/static")) + .collect(Collectors.toList()); - WebJarStaticHandler handler = new WebJarStaticHandler(finalDestination + "/static", path, augmentedWebRootConfigurations); + WebJarStaticHandler handler = + new WebJarStaticHandler(finalDestination + "/static", path, augmentedWebRootConfigurations); shutdownContext.addShutdownTask(new ShutdownContext.CloseRunnable(handler)); return handler; } diff --git a/opendc-web/opendc-web-ui/build.gradle.kts b/opendc-web/opendc-web-ui/build.gradle.kts index f8c0a45b..5e999359 100644 --- a/opendc-web/opendc-web-ui/build.gradle.kts +++ b/opendc-web/opendc-web-ui/build.gradle.kts @@ -76,10 +76,10 @@ val buildTask = tasks.register("buildNext") { "NEXT_PUBLIC_SENTRY_DSN", "NEXT_PUBLIC_AUTH0_DOMAIN", "NEXT_PUBLIC_AUTH0_CLIENT_ID", - "NEXT_PUBLIC_AUTH0_AUDIENCE", + "NEXT_PUBLIC_AUTH0_AUDIENCE" ) for (envvar in env) { - environment.put(envvar, "%%${envvar}%%") + environment.put(envvar, "%%$envvar%%") } dependsOn(tasks.npmInstall) diff --git a/opendc-workflow/opendc-workflow-api/src/main/kotlin/org/opendc/workflow/api/Metadata.kt b/opendc-workflow/opendc-workflow-api/src/main/kotlin/org/opendc/workflow/api/Metadata.kt index db208998..a4e48b85 100644 --- a/opendc-workflow/opendc-workflow-api/src/main/kotlin/org/opendc/workflow/api/Metadata.kt +++ b/opendc-workflow/opendc-workflow-api/src/main/kotlin/org/opendc/workflow/api/Metadata.kt @@ -1,7 +1,5 @@ /* - * MIT License - * - * Copyright (c) 2020 atlarge-research + * Copyright (c) 2020 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 diff --git a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/job/LimitJobAdmissionPolicy.kt b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/job/LimitJobAdmissionPolicy.kt index 6a0bfeb9..bd416546 100644 --- a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/job/LimitJobAdmissionPolicy.kt +++ b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/job/LimitJobAdmissionPolicy.kt @@ -35,10 +35,11 @@ public data class LimitJobAdmissionPolicy(public val limit: Int) : JobAdmissionP override fun invoke( job: JobState ): JobAdmissionPolicy.Advice = - if (scheduler.activeJobs.size < limit) + if (scheduler.activeJobs.size < limit) { JobAdmissionPolicy.Advice.ADMIT - else + } else { JobAdmissionPolicy.Advice.STOP + } } override fun toString(): String = "Limit-Active($limit)" diff --git a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/BalancingTaskEligibilityPolicy.kt b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/BalancingTaskEligibilityPolicy.kt index 42804f5a..a2c11e4d 100644 --- a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/BalancingTaskEligibilityPolicy.kt +++ b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/BalancingTaskEligibilityPolicy.kt @@ -65,10 +65,11 @@ public data class BalancingTaskEligibilityPolicy(public val tolerance: Double = val activeTasks = scheduler.activeTasks.size val baseline = max(activeTasks / activeJobs.toDouble(), 1.0) val activeForJob = active[task.job]!! - return if ((activeForJob + 1) / baseline < tolerance) + return if ((activeForJob + 1) / baseline < tolerance) { TaskEligibilityPolicy.Advice.ADMIT - else + } else { TaskEligibilityPolicy.Advice.DENY + } } } diff --git a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/LimitPerJobTaskEligibilityPolicy.kt b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/LimitPerJobTaskEligibilityPolicy.kt index 229460df..b0eb3f2c 100644 --- a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/LimitPerJobTaskEligibilityPolicy.kt +++ b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/LimitPerJobTaskEligibilityPolicy.kt @@ -57,10 +57,11 @@ public data class LimitPerJobTaskEligibilityPolicy(public val limit: Int) : Task override fun invoke(task: TaskState): TaskEligibilityPolicy.Advice { val activeForJob = active[task.job]!! - return if (activeForJob <= limit) + return if (activeForJob <= limit) { TaskEligibilityPolicy.Advice.ADMIT - else + } else { TaskEligibilityPolicy.Advice.DENY + } } } diff --git a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/LimitTaskEligibilityPolicy.kt b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/LimitTaskEligibilityPolicy.kt index 57aa0d58..d2edc256 100644 --- a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/LimitTaskEligibilityPolicy.kt +++ b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/LimitTaskEligibilityPolicy.kt @@ -33,10 +33,11 @@ public data class LimitTaskEligibilityPolicy(val limit: Int) : TaskEligibilityPo override fun invoke( task: TaskState ): TaskEligibilityPolicy.Advice = - if (scheduler.activeTasks.size < limit) + if (scheduler.activeTasks.size < limit) { TaskEligibilityPolicy.Advice.ADMIT - else + } else { TaskEligibilityPolicy.Advice.STOP + } } override fun toString(): String = "Limit-Active($limit)" diff --git a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/RandomTaskEligibilityPolicy.kt b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/RandomTaskEligibilityPolicy.kt index e675d836..036f3574 100644 --- a/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/RandomTaskEligibilityPolicy.kt +++ b/opendc-workflow/opendc-workflow-service/src/main/kotlin/org/opendc/workflow/service/scheduler/task/RandomTaskEligibilityPolicy.kt @@ -34,9 +34,9 @@ public data class RandomTaskEligibilityPolicy(val probability: Double = 0.5) : T val random = Random(123) override fun invoke(task: TaskState): TaskEligibilityPolicy.Advice = - if (random.nextDouble() <= probability || scheduler.activeTasks.isEmpty()) + if (random.nextDouble() <= probability || scheduler.activeTasks.isEmpty()) { TaskEligibilityPolicy.Advice.ADMIT - else { + } else { TaskEligibilityPolicy.Advice.DENY } } diff --git a/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceTest.kt b/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceTest.kt index 096a7ebd..977f5677 100644 --- a/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceTest.kt +++ b/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceTest.kt @@ -93,7 +93,7 @@ internal class WorkflowServiceTest { jobAdmissionPolicy = NullJobAdmissionPolicy, jobOrderPolicy = SubmissionTimeJobOrderPolicy(), taskEligibilityPolicy = NullTaskEligibilityPolicy, - taskOrderPolicy = SubmissionTimeTaskOrderPolicy(), + taskOrderPolicy = SubmissionTimeTaskOrderPolicy() ) ) ) -- cgit v1.2.3