summaryrefslogtreecommitdiff
path: root/opendc-workflow/opendc-workflow-service/src/test/kotlin/org
diff options
context:
space:
mode:
authorDante Niewenhuis <d.niewenhuis@hotmail.com>2024-08-27 13:48:46 +0200
committerGitHub <noreply@github.com>2024-08-27 13:48:46 +0200
commit3363df4c72a064e590ca98f8e01832cfa4e15a3f (patch)
tree9a938700fe08ce344ff5d0d475d0b64d7233d1fc /opendc-workflow/opendc-workflow-service/src/test/kotlin/org
parentc21708013f2746807f5bdb3fc47c2b47ed15b7c8 (diff)
Renamed input files and internally server is changed to task (#246)
* Updated SimTrace to use a single ArrayDeque instead of three separate lists for deadline, cpuUsage, and coreCount * Renamed input files to tasks.parquet and fragments.parquet. Renamed server to task. OpenDC nows exports tasks.parquet instead of server.parquet
Diffstat (limited to 'opendc-workflow/opendc-workflow-service/src/test/kotlin/org')
-rw-r--r--opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceTest.kt148
1 files changed, 0 insertions, 148 deletions
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
deleted file mode 100644
index 9da664bb..00000000
--- a/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceTest.kt
+++ /dev/null
@@ -1,148 +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.
- */
-
-package org.opendc.workflow.service
-
-import org.junit.jupiter.api.Assertions.assertAll
-import org.junit.jupiter.api.Assertions.assertEquals
-import org.junit.jupiter.api.DisplayName
-import org.junit.jupiter.api.Test
-import org.opendc.compute.service.scheduler.ComputeScheduler
-import org.opendc.compute.service.scheduler.FilterScheduler
-import org.opendc.compute.service.scheduler.filters.ComputeFilter
-import org.opendc.compute.service.scheduler.filters.RamFilter
-import org.opendc.compute.service.scheduler.filters.VCpuFilter
-import org.opendc.compute.service.scheduler.weights.VCpuWeigher
-import org.opendc.compute.simulator.provisioner.Provisioner
-import org.opendc.compute.simulator.provisioner.ProvisioningContext
-import org.opendc.compute.simulator.provisioner.setupComputeService
-import org.opendc.compute.simulator.provisioner.setupHosts
-import org.opendc.compute.topology.specs.HostSpec
-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.SimPsuFactories
-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.flow2.mux.FlowMultiplexerFactory
-import org.opendc.simulator.kotlin.runSimulation
-import org.opendc.trace.Trace
-import org.opendc.workflow.service.scheduler.job.NullJobAdmissionPolicy
-import org.opendc.workflow.service.scheduler.job.SubmissionTimeJobOrderPolicy
-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.UUID
-
-/**
- * Integration test suite for the [WorkflowService].
- */
-@DisplayName("WorkflowService")
-internal class WorkflowServiceTest {
- /**
- * A large integration test where we check whether all tasks in some trace are executed correctly.
- */
- @Test
- fun testTrace() =
- runSimulation {
- val computeService = "compute.opendc.org"
- val workflowService = "workflow.opendc.org"
-
- Provisioner(dispatcher, seed = 0L).use { provisioner ->
- val scheduler: (ProvisioningContext) -> ComputeScheduler = {
- FilterScheduler(
- filters = listOf(ComputeFilter(), VCpuFilter(1.0), RamFilter(1.0)),
- weighers = listOf(VCpuWeigher(1.0, multiplier = 1.0)),
- )
- }
-
- provisioner.runSteps(
- // Configure the ComputeService that is responsible for mapping virtual machines onto physical hosts
- setupComputeService(computeService, scheduler, schedulingQuantum = Duration.ofSeconds(1)),
- setupHosts(computeService, List(4) { createHostSpec(it) }),
- // Configure the WorkflowService that is responsible for scheduling the workflow tasks onto machines
- setupWorkflowService(
- workflowService,
- computeService,
- WorkflowSchedulerSpec(
- schedulingQuantum = Duration.ofMillis(100),
- jobAdmissionPolicy = NullJobAdmissionPolicy,
- jobOrderPolicy = SubmissionTimeJobOrderPolicy(),
- taskEligibilityPolicy = NullTaskEligibilityPolicy,
- taskOrderPolicy = SubmissionTimeTaskOrderPolicy(),
- ),
- ),
- )
-
- val service = provisioner.registry.resolve(workflowService, WorkflowService::class.java)!!
-
- val trace =
- Trace.open(
- Paths.get(checkNotNull(WorkflowServiceTest::class.java.getResource("/trace.gwf")).toURI()),
- format = "gwf",
- )
- service.replay(timeSource, trace.toJobs())
-
- val metrics = service.getSchedulerStats()
-
- assertAll(
- { assertEquals(758, metrics.workflowsSubmitted, "No jobs submitted") },
- { assertEquals(0, metrics.workflowsRunning, "Not all submitted jobs started") },
- {
- assertEquals(
- metrics.workflowsSubmitted,
- metrics.workflowsFinished,
- "Not all started jobs finished",
- )
- },
- { assertEquals(0, metrics.tasksRunning, "Not all started tasks finished") },
- { assertEquals(metrics.tasksSubmitted, metrics.tasksFinished, "Not all started tasks finished") },
- { assertEquals(1468774, timeSource.millis()) { "Total duration incorrect" } },
- )
- }
- }
-
- /**
- * Construct a [HostSpec] for a simulated host.
- */
- private fun createHostSpec(uid: Int): HostSpec {
- // Machine model based on: https://www.spec.org/power_ssj2008/results/res2020q1/power_ssj2008-20191125-01012.html
- val node = ProcessingNode("AMD", "am64", "EPYC 7742", 32)
- val cpus = List(node.coreCount) { ProcessingUnit(node, it, 3400.0) }
- val memory = List(8) { MemoryUnit("Samsung", "Unknown", 2933.0, 16_000) }
-
- val machineModel = MachineModel(cpus, memory)
-
- return HostSpec(
- UUID(0, uid.toLong()),
- "host-$uid",
- emptyMap(),
- machineModel,
- SimPsuFactories.noop(),
- FlowMultiplexerFactory.forwardingMultiplexer(),
- )
- }
-}