From d6d9d37abf17071ff050e45ea37c693e659a4e98 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 28 Sep 2017 03:27:36 +0200 Subject: Implement JPA integration --- .../opendc/platform/scheduler/FifoScheduler.kt | 118 +++++++++++++++++++++ .../atlarge/opendc/platform/scheduler/Scheduler.kt | 71 +++++++++++++ .../opendc/platform/scheduler/SrtfScheduler.kt | 110 +++++++++++++++++++ .../nl/atlarge/opendc/platform/workload/Job.kt | 53 +++++++++ .../nl/atlarge/opendc/platform/workload/Task.kt | 105 ++++++++++++++++++ .../nl/atlarge/opendc/platform/workload/Trace.kt | 37 +++++++ .../nl/atlarge/opendc/platform/workload/User.kt | 45 ++++++++ .../nl/atlarge/opendc/scheduler/FifoScheduler.kt | 106 ------------------ .../nl/atlarge/opendc/scheduler/Scheduler.kt | 66 ------------ .../nl/atlarge/opendc/scheduler/SrtfScheduler.kt | 105 ------------------ .../opendc/topology/container/Datacenter.kt | 18 ++-- .../nl/atlarge/opendc/topology/container/Rack.kt | 4 +- .../nl/atlarge/opendc/topology/container/Room.kt | 7 +- .../nl/atlarge/opendc/topology/machine/Cpu.kt | 8 +- .../nl/atlarge/opendc/topology/machine/Gpu.kt | 8 +- .../nl/atlarge/opendc/topology/machine/Machine.kt | 32 ++++-- .../opendc/topology/machine/ProcessingUnit.kt | 8 +- .../nl/atlarge/opendc/topology/power/PowerUnit.kt | 5 +- .../main/kotlin/nl/atlarge/opendc/workload/Job.kt | 36 ------- .../main/kotlin/nl/atlarge/opendc/workload/Task.kt | 73 ------------- .../main/kotlin/nl/atlarge/opendc/workload/User.kt | 40 ------- 21 files changed, 581 insertions(+), 474 deletions(-) create mode 100644 opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/scheduler/FifoScheduler.kt create mode 100644 opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/scheduler/Scheduler.kt create mode 100644 opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/scheduler/SrtfScheduler.kt create mode 100644 opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/workload/Job.kt create mode 100644 opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/workload/Task.kt create mode 100644 opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/workload/Trace.kt create mode 100644 opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/workload/User.kt delete mode 100644 opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/scheduler/FifoScheduler.kt delete mode 100644 opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/scheduler/Scheduler.kt delete mode 100644 opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/scheduler/SrtfScheduler.kt delete mode 100644 opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/workload/Job.kt delete mode 100644 opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/workload/Task.kt delete mode 100644 opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/workload/User.kt (limited to 'opendc-stdlib/src/main') diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/scheduler/FifoScheduler.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/scheduler/FifoScheduler.kt new file mode 100644 index 00000000..1c3dc869 --- /dev/null +++ b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/scheduler/FifoScheduler.kt @@ -0,0 +1,118 @@ +/* + * MIT License + * + * Copyright (c) 2017 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 nl.atlarge.opendc.platform.scheduler + +import nl.atlarge.opendc.kernel.Context +import nl.atlarge.opendc.topology.Entity +import nl.atlarge.opendc.topology.machine.Machine +import nl.atlarge.opendc.platform.workload.Task +import java.util.* + +/** + * A [Scheduler] that distributes work according to the first-in-first-out principle. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +class FifoScheduler : Scheduler { + /** + * The name of this scheduler. + */ + override val name: String = "FIFO" + + /** + * The set of machines the scheduler knows of. + */ + val machines: MutableSet = HashSet() + + /** + * The queue of [Task]s that need to be scheduled. + */ + val queue: Queue = ArrayDeque() + + /** + * (Re)schedule the tasks submitted to the scheduler over the specified set of machines. + */ + override suspend fun > Context.schedule() { + if (queue.isEmpty()) { + return + } + + // The tasks that need to be rescheduled + val rescheduled = ArrayDeque() + val iterator = queue.iterator() + + machines + .forEach { machine -> + while (iterator.hasNext()) { + val task = iterator.next() + + // TODO What to do with tasks that are not ready yet to be processed + if (!task.isReady()) { + iterator.remove() + rescheduled.add(task) + continue + } else if (task.finished) { + iterator.remove() + continue + } + + machine.send(task) + break + } + } + + // Reschedule all tasks that are not ready yet + while (!rescheduled.isEmpty()) { + submit(rescheduled.poll()) + } + } + + /** + * Submit a [Task] to this scheduler. + * + * @param task The task to submit to the scheduler. + */ + override fun submit(task: Task) { + queue.add(task) + } + + /** + * Register a [Machine] to this scheduler. + * + * @param machine The machine to register. + */ + override fun register(machine: Machine) { + machines.add(machine) + } + + /** + * Deregister a [Machine] from this scheduler. + * + * @param machine The machine to deregister. + */ + override fun deregister(machine: Machine) { + machines.remove(machine) + } +} diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/scheduler/Scheduler.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/scheduler/Scheduler.kt new file mode 100644 index 00000000..bf988802 --- /dev/null +++ b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/scheduler/Scheduler.kt @@ -0,0 +1,71 @@ +/* + * MIT License + * + * Copyright (c) 2017 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 nl.atlarge.opendc.platform.scheduler + +import nl.atlarge.opendc.kernel.Context +import nl.atlarge.opendc.topology.Entity +import nl.atlarge.opendc.topology.machine.Machine +import nl.atlarge.opendc.platform.workload.Task + +/** + * A task scheduler that is coupled to an [Entity] in the topology of the cloud network. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +interface Scheduler { + /** + * The name of this scheduler. + */ + val name: String + + /** + * (Re)schedule the tasks submitted to the scheduler over the specified set of machines. + * + * This method should be invoked at some interval to allow the scheduler to reschedule existing tasks and schedule + * new tasks. + */ + suspend fun > Context.schedule() + + /** + * Submit a [Task] to this scheduler. + * + * @param task The task to submit to the scheduler. + */ + fun submit(task: Task) + + /** + * Register a [Machine] to this scheduler. + * + * @param machine The machine to register. + */ + fun register(machine: Machine) + + /** + * Deregister a [Machine] from this scheduler. + * + * @param machine The machine to deregister. + */ + fun deregister(machine: Machine) +} diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/scheduler/SrtfScheduler.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/scheduler/SrtfScheduler.kt new file mode 100644 index 00000000..b2660964 --- /dev/null +++ b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/scheduler/SrtfScheduler.kt @@ -0,0 +1,110 @@ +/* + * MIT License + * + * Copyright (c) 2017 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 nl.atlarge.opendc.platform.scheduler + +import nl.atlarge.opendc.kernel.Context +import nl.atlarge.opendc.topology.Entity +import nl.atlarge.opendc.topology.machine.Machine +import nl.atlarge.opendc.platform.workload.Task +import java.util.* + +/** + * A [Scheduler] that distributes work according to the shortest job first policy. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +class SrtfScheduler : Scheduler { + /** + * The name of this scheduler. + */ + override val name: String = "SRTF" + + /** + * The set of machines the scheduler knows of. + */ + val machines: MutableSet = HashSet() + + /** + * The set of [Task]s that need to be scheduled. + */ + val tasks: MutableSet = HashSet() + + /** + * (Re)schedule the tasks submitted to the scheduler over the specified set of machines. + */ + override suspend fun > Context.schedule() { + if (tasks.isEmpty()) { + return + } + + val iterator = tasks.sortedBy { it.remaining }.iterator() + + machines + .forEach { machine -> + while (iterator.hasNext()) { + val task = iterator.next() + + // TODO What to do with tasks that are not ready yet to be processed + if (!task.isReady()) { + submit(task) + continue + } else if (task.finished) { + tasks.remove(task) + continue + } + + machine.send(task) + break + } + } + } + + /** + * Submit a [Task] to this scheduler. + * + * @param task The task to submit to the scheduler. + */ + override fun submit(task: Task) { + tasks.add(task) + } + + /** + * Register a [Machine] to this scheduler. + * + * @param machine The machine to register. + */ + override fun register(machine: Machine) { + machines.add(machine) + } + + /** + * Deregister a [Machine] from this scheduler. + * + * @param machine The machine to deregister. + */ + override fun deregister(machine: Machine) { + machines.remove(machine) + } +} diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/workload/Job.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/workload/Job.kt new file mode 100644 index 00000000..eb173229 --- /dev/null +++ b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/workload/Job.kt @@ -0,0 +1,53 @@ +/* + * MIT License + * + * Copyright (c) 2017 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 nl.atlarge.opendc.platform.workload + +/** + * A job that is submitted to a cloud network, which consists of one or multiple [Task]s. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +interface Job { + /** + * A unique identifier of the job. + */ + val id: Int + + /** + * The owner of this job. + */ + val owner: User + + /** + * The tasks this job consists of. + */ + val tasks: Set + + /** + * A flag to indicate the job has finished. + */ + val finished: Boolean + get() = !tasks.any { !it.finished } +} diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/workload/Task.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/workload/Task.kt new file mode 100644 index 00000000..140a5d5d --- /dev/null +++ b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/workload/Task.kt @@ -0,0 +1,105 @@ +/* + * MIT License + * + * Copyright (c) 2017 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 nl.atlarge.opendc.platform.workload + +import nl.atlarge.opendc.kernel.Context +import nl.atlarge.opendc.topology.container.Datacenter +import nl.atlarge.opendc.topology.machine.Machine + +/** + * A task represents some computation that is part of a [Job]. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +interface Task { + /** + * The unique identifier of the task. + */ + val id: Int + + /** + * The amount of flops for this task. + */ + val flops: Long + + /** + * The dependencies of the task. + */ + val dependencies: Set + + /** + * A flag to indicate the task is parallelizable. + */ + val parallelizable: Boolean + + /** + * The remaining amount of flops to compute. + */ + val remaining: Long + + /** + * A flag to indicate the task has been accepted by the datacenter. + */ + val accepted: Boolean + + /** + * A flag to indicate the task has been started. + */ + val started: Boolean + + /** + * A flag to indicate whether the task is finished. + */ + val finished: Boolean + + /** + * Determine whether the task is ready to be processed. + * + * @return `true` if the task is ready to be processed, `false` otherwise. + */ + fun isReady() = dependencies.all { it.finished } + + /** + * Accept the task into the scheduling queue. + */ + fun Context.accept() + + /** + * Start a task. + */ + fun Context.start() + + /** + * Consume the given amount of flops of this task. + * + * @param flops The total amount of flops to consume. + */ + fun Context.consume(flops: Long) + + /** + * Finalise the task. + */ + fun Context.finalize() +} diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/workload/Trace.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/workload/Trace.kt new file mode 100644 index 00000000..6dd2efb8 --- /dev/null +++ b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/workload/Trace.kt @@ -0,0 +1,37 @@ +/* + * MIT License + * + * Copyright (c) 2017 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 nl.atlarge.opendc.platform.workload + +/** + * A timestamped sequence of jobs received in a cloud network. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +interface Trace { + /** + * The [Job]s in the trace. + */ + val jobs: Set +} diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/workload/User.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/workload/User.kt new file mode 100644 index 00000000..d827fee5 --- /dev/null +++ b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/platform/workload/User.kt @@ -0,0 +1,45 @@ +/* + * MIT License + * + * Copyright (c) 2017 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 nl.atlarge.opendc.platform.workload + +/** + * A user of a cloud network that provides [Job]s for the simulation. + * + * Each user in a simulation has its own logical view of the cloud network which is used to route its jobs in the + * physical network. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +interface User { + /** + * The unique identifier of the user. + */ + val id: Int + + /** + * The name of this user. + */ + val name: String +} diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/scheduler/FifoScheduler.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/scheduler/FifoScheduler.kt deleted file mode 100644 index 5382e48b..00000000 --- a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/scheduler/FifoScheduler.kt +++ /dev/null @@ -1,106 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 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 nl.atlarge.opendc.scheduler - -import nl.atlarge.opendc.kernel.Context -import nl.atlarge.opendc.topology.Entity -import nl.atlarge.opendc.topology.machine.Machine -import nl.atlarge.opendc.workload.Task -import java.util.* - -/** - * A [Scheduler] that distributes work according to the first-in-first-out principle. - * - * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) - */ -class FifoScheduler : Scheduler { - /** - * The set of machines the scheduler knows of. - */ - val machines: MutableSet = HashSet() - - /** - * The queue of [Task]s that need to be scheduled. - */ - val queue: Queue = ArrayDeque() - - /** - * (Re)schedule the tasks submitted to the scheduler over the specified set of machines. - */ - override suspend fun > Context.schedule() { - if (queue.isEmpty()) { - return - } - - val iterator = queue.iterator() - - machines - .forEach { machine -> - while (iterator.hasNext()) { - val task = iterator.next() - - // TODO What to do with tasks that are not ready yet to be processed - if (!task.isReady()) { - iterator.remove() - submit(task) - continue - } else if (task.finished) { - iterator.remove() - continue - } - - machine.send(task) - break - } - } - } - - /** - * Submit a [Task] to this scheduler. - * - * @param task The task to submit to the scheduler. - */ - override fun submit(task: Task) { - queue.add(task) - } - - /** - * Register a [Machine] to this scheduler. - * - * @param machine The machine to register. - */ - override fun register(machine: Machine) { - machines.add(machine) - } - - /** - * Deregister a [Machine] from this scheduler. - * - * @param machine The machine to deregister. - */ - override fun deregister(machine: Machine) { - machines.remove(machine) - } -} diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/scheduler/Scheduler.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/scheduler/Scheduler.kt deleted file mode 100644 index 8c96341a..00000000 --- a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/scheduler/Scheduler.kt +++ /dev/null @@ -1,66 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 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 nl.atlarge.opendc.scheduler - -import nl.atlarge.opendc.kernel.Context -import nl.atlarge.opendc.topology.Entity -import nl.atlarge.opendc.topology.machine.Machine -import nl.atlarge.opendc.workload.Task - -/** - * A task scheduler that is coupled to an [Entity] in the topology of the cloud network. - * - * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) - */ -interface Scheduler { - /** - * (Re)schedule the tasks submitted to the scheduler over the specified set of machines. - * - * This method should be invoked at some interval to allow the scheduler to reschedule existing tasks and schedule - * new tasks. - */ - suspend fun > Context.schedule() - - /** - * Submit a [Task] to this scheduler. - * - * @param task The task to submit to the scheduler. - */ - fun submit(task: Task) - - /** - * Register a [Machine] to this scheduler. - * - * @param machine The machine to register. - */ - fun register(machine: Machine) - - /** - * Deregister a [Machine] from this scheduler. - * - * @param machine The machine to deregister. - */ - fun deregister(machine: Machine) -} diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/scheduler/SrtfScheduler.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/scheduler/SrtfScheduler.kt deleted file mode 100644 index 0e94f81a..00000000 --- a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/scheduler/SrtfScheduler.kt +++ /dev/null @@ -1,105 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 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 nl.atlarge.opendc.scheduler - -import nl.atlarge.opendc.kernel.Context -import nl.atlarge.opendc.topology.Entity -import nl.atlarge.opendc.topology.machine.Machine -import nl.atlarge.opendc.workload.Task -import java.util.* - -/** - * A [Scheduler] that distributes work according to the shortest job first policy. - * - * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) - */ -class SrtfScheduler : Scheduler { - /** - * The set of machines the scheduler knows of. - */ - val machines: MutableSet = HashSet() - - /** - * The set of [Task]s that need to be scheduled. - */ - val tasks: MutableSet = HashSet() - - /** - * (Re)schedule the tasks submitted to the scheduler over the specified set of machines. - */ - override suspend fun > Context.schedule() { - if (tasks.isEmpty()) { - return - } - - val iterator = tasks.sortedBy { it.remaining }.iterator() - - machines - .forEach { machine -> - while (iterator.hasNext()) { - val task = iterator.next() - - // TODO What to do with tasks that are not ready yet to be processed - if (!task.isReady()) { - submit(task) - continue - } else if (task.finished) { - tasks.remove(task) - continue - } - - machine.send(task) - break - } - } - } - - /** - * Submit a [Task] to this scheduler. - * - * @param task The task to submit to the scheduler. - */ - override fun submit(task: Task) { - tasks.add(task) - } - - /** - * Register a [Machine] to this scheduler. - * - * @param machine The machine to register. - */ - override fun register(machine: Machine) { - machines.add(machine) - } - - /** - * Deregister a [Machine] from this scheduler. - * - * @param machine The machine to deregister. - */ - override fun deregister(machine: Machine) { - machines.remove(machine) - } -} diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/container/Datacenter.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/container/Datacenter.kt index f8954527..333609bb 100644 --- a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/container/Datacenter.kt +++ b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/container/Datacenter.kt @@ -25,14 +25,14 @@ package nl.atlarge.opendc.topology.container import mu.KotlinLogging -import nl.atlarge.opendc.extension.topology.destinations +import nl.atlarge.opendc.topology.destinations import nl.atlarge.opendc.kernel.Context import nl.atlarge.opendc.kernel.Process import nl.atlarge.opendc.kernel.time.Duration -import nl.atlarge.opendc.scheduler.Scheduler +import nl.atlarge.opendc.platform.scheduler.Scheduler import nl.atlarge.opendc.topology.Entity import nl.atlarge.opendc.topology.machine.Machine -import nl.atlarge.opendc.workload.Task +import nl.atlarge.opendc.platform.workload.Task import java.util.* /** @@ -42,16 +42,16 @@ import java.util.* * @property interval The interval at which task will be (re)scheduled. * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) */ -class Datacenter(val scheduler: Scheduler, val interval: Duration) : Entity, Process { +interface Datacenter : Entity, Process { /** - * The logger instance to use for the simulator. + * The task scheduler the datacenter uses. */ - private val logger = KotlinLogging.logger {} + val scheduler: Scheduler /** - * The initial state of the entity. + * The interval at which task will be (re)scheduled. */ - override val initialState = Unit + val interval: Duration /** * This method is invoked to start the simulation an [Entity] associated with this [Process]. @@ -69,6 +69,8 @@ class Datacenter(val scheduler: Scheduler, val interval: Duration) : Entity.run() { + val logger = KotlinLogging.logger {} + // The queue of messages to be processed after a cycle val queue: Queue = ArrayDeque() // Find all machines in the datacenter diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/container/Rack.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/container/Rack.kt index 27207d4c..25429f71 100644 --- a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/container/Rack.kt +++ b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/container/Rack.kt @@ -32,6 +32,4 @@ import nl.atlarge.opendc.topology.Entity * * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) */ -class Rack : Entity { - override val initialState = Unit -} +interface Rack : Entity diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/container/Room.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/container/Room.kt index 109a5629..3b338899 100644 --- a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/container/Room.kt +++ b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/container/Room.kt @@ -31,9 +31,4 @@ import nl.atlarge.opendc.topology.Entity * * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) */ -class Room : Entity { - /** - * The initial state of the entity. - */ - override val initialState = Unit -} +interface Room : Entity diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/machine/Cpu.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/machine/Cpu.kt index 78e2eaaa..f97e73e9 100644 --- a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/machine/Cpu.kt +++ b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/machine/Cpu.kt @@ -29,10 +29,4 @@ package nl.atlarge.opendc.topology.machine * * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) */ -data class Cpu( - override val speed: Int, - override val cores: Int, - override val energyConsumption: Int -) : ProcessingUnit { - override val initialState = Unit -} +interface Cpu : ProcessingUnit diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/machine/Gpu.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/machine/Gpu.kt index 09179c94..15c5263f 100644 --- a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/machine/Gpu.kt +++ b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/machine/Gpu.kt @@ -29,11 +29,5 @@ package nl.atlarge.opendc.topology.machine * * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) */ -class Gpu( - override val speed: Int, - override val cores: Int, - override val energyConsumption: Int -) : ProcessingUnit { - override val initialState = Unit -} +interface Gpu : ProcessingUnit diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/machine/Machine.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/machine/Machine.kt index 3305581a..4338ae04 100644 --- a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/machine/Machine.kt +++ b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/machine/Machine.kt @@ -25,8 +25,8 @@ package nl.atlarge.opendc.topology.machine import mu.KotlinLogging -import nl.atlarge.opendc.extension.topology.destinations -import nl.atlarge.opendc.workload.Task +import nl.atlarge.opendc.topology.destinations +import nl.atlarge.opendc.platform.workload.Task import nl.atlarge.opendc.kernel.Context import nl.atlarge.opendc.kernel.Process import nl.atlarge.opendc.kernel.time.Duration @@ -38,7 +38,7 @@ import nl.atlarge.opendc.topology.Entity * * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) */ -class Machine : Entity, Process { +open class Machine : Entity, Process { /** * The logger instance to use for the simulator. */ @@ -53,8 +53,18 @@ class Machine : Entity, Process { /** * The shape of the state of a [Machine] entity. + * + * @property status The status of the machine. + * @property task The task assign to the machine. + * @property memory The memory usage of the machine (defaults to 50mb for the kernel) + * @property load The load on the machine (defaults to 0.0) + * @property temperature The temperature of the machine (defaults to 23 degrees Celcius) */ - data class State(val status: Status, val task: Task? = null) + data class State(val status: Status, + val task: Task? = null, + val memory: Int = 50, + val load: Double = 0.0, + val temperature: Double = 23.0) /** * The initial state of a [Machine] entity. @@ -69,24 +79,28 @@ class Machine : Entity, Process { val interval: Duration = 10 val cpus = outgoingEdges.destinations("cpu") - val speed = cpus.fold(0, { acc, (speed, cores) -> acc + speed * cores }) + val speed = cpus.fold(0, { acc, cpu -> acc + cpu.clockRate * cpu.cores }) / 10 + var task: Task = receiveTask() - update(State(Status.RUNNING, task)) + update(State(Status.RUNNING, task, load = 1.0, memory = state.memory + 50, temperature = 30.0)) + task.run { start() } while (true) { - if (task.finished) { + if (task.remaining <= 0) { + task.run { finalize() } logger.info { "${entity.id}: Task ${task.id} finished. Machine idle at $time" } update(State(Status.IDLE)) task = receiveTask() } else { - task.consume(speed * delta) + task.run { consume(speed * delta) } } // Check if we have received a new order in the meantime. val msg = receive(interval) if (msg is Task) { task = msg - update(State(Status.RUNNING, task)) + update(State(Status.RUNNING, task, load = 1.0, memory = state.memory + 50, temperature = 30.0)) + task.run { start() } } } } diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/machine/ProcessingUnit.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/machine/ProcessingUnit.kt index 31bfbcd6..abc8608b 100644 --- a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/machine/ProcessingUnit.kt +++ b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/machine/ProcessingUnit.kt @@ -33,9 +33,9 @@ import nl.atlarge.opendc.topology.Entity */ interface ProcessingUnit : Entity { /** - * The speed of this [ProcessingUnit] per core. + * The speed of this [ProcessingUnit] per core in MHz. */ - val speed: Int + val clockRate: Int /** * The amount of cores within this [ProcessingUnit]. @@ -43,7 +43,7 @@ interface ProcessingUnit : Entity { val cores: Int /** - * The energy consumption of this [ProcessingUnit] in Kj/s. + * The energy consumption of this [ProcessingUnit] in Watt. */ - val energyConsumption: Int + val energyConsumption: Double } diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/power/PowerUnit.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/power/PowerUnit.kt index aac4ce03..b9602e55 100644 --- a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/power/PowerUnit.kt +++ b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/topology/power/PowerUnit.kt @@ -29,9 +29,6 @@ import nl.atlarge.opendc.topology.Entity /** * An [Entity] which provides power for other entities a cloud network to run. * - * @param output The power output of the power unit in Watt. * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) */ -class PowerUnit(val output: Double) : Entity { - override val initialState = Unit -} +interface PowerUnit : Entity diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/workload/Job.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/workload/Job.kt deleted file mode 100644 index 6dbbf327..00000000 --- a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/workload/Job.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 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 nl.atlarge.opendc.workload - -/** - * A job that is submitted to a cloud network, which consists of one or multiple [Task]s. - * - * @param id The unique identifier of this job. - * @param name The name of this job. - * @param owner The user to which the job belongs. - * @param tasks The tasks of which the job consists. - * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) - */ -data class Job(val id: Int, val name: String, val owner: User, val tasks: Collection) diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/workload/Task.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/workload/Task.kt deleted file mode 100644 index bd2b0604..00000000 --- a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/workload/Task.kt +++ /dev/null @@ -1,73 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 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 nl.atlarge.opendc.workload - -import nl.atlarge.opendc.kernel.time.Instant - -/** - * A task represents some computation that is part of a [Job]. - * - * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) - */ -data class Task( - val id: Int, - val dependencies: Set, - val flops: Long -) { - /** - * The remaining amount of flops to compute. - */ - var remaining: Long = flops - private set - - /** - * A flag to indicate whether the task is finished. - */ - var finished: Boolean = false - private set - - /** - * Determine whether the task is ready to be processed. - * - * @return `true` if the task is ready to be processed, `false` otherwise. - */ - fun isReady() = dependencies.all { it.finished } - - /** - * Consume the given amount of flops of this task. - * - * @param flops The total amount of flops to consume. - */ - fun consume(flops: Long) { - if (finished) - return - if (remaining <= flops) { - finished = true - remaining = 0 - } else { - remaining -= flops - } - } -} diff --git a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/workload/User.kt b/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/workload/User.kt deleted file mode 100644 index d0e90851..00000000 --- a/opendc-stdlib/src/main/kotlin/nl/atlarge/opendc/workload/User.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 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 nl.atlarge.opendc.workload - -import nl.atlarge.opendc.topology.Topology - -/** - * A user of a cloud network that provides [Job]s for the simulation. - * - * Each [User] in a simulation has its own logical view of the cloud network which is used to route its jobs in the - * physical network. - * - * @param id The unique identifier of the user. - * @param name The name of the user. - * @param view The view of the user on the topology. - * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) - */ -data class User(val id: Int, val name: String, val view: Topology) -- cgit v1.2.3