Example setup
Closed this issue ยท 5 comments
We're doing the Lab exercise for Distributed Systems, at the VU, and we're having trouble creating a setup file for the SC18PlatformRunner
. We've tried the website, but that failed (see atlarge-research/opendc-frontend#66). We've also found Sc18SetupParser
, but its somewhat hard to reverse-engineer a good setup from that.
Could you provide an example setup file? Or provide/link to documentation on the format of this setup file?
The simulator is unfortunately pretty tightly coupled to the database (or at least Hibernate) at the moment, so my apologies for the trouble you are having to go through.
But to get back on point, examples of such a setup file and accompanying traces can be found in the SC18 release. An example of such a setup file:
{
"name": "Experimental Setup 2",
"rooms": [
{
"type": "SERVER",
"objects": [
{
"type": "RACK",
"machines": [
{ "cpus": [2] }, { "cpus": [2]},
{ "cpus": [2] }, { "cpus": [2]},
{ "cpus": [2] }, { "cpus": [2]},
{ "cpus": [2] }, { "cpus": [2]},
{ "cpus": [2] }, { "cpus": [2]},
{ "cpus": [2] }, { "cpus": [2]},
{ "cpus": [2] }, { "cpus": [2]},
{ "cpus": [2] }, { "cpus": [2]}
]
},
{
"type": "RACK",
"machines": [
{ "cpus": [1] }, { "cpus": [1]},
{ "cpus": [1] }, { "cpus": [1]},
{ "cpus": [1] }, { "cpus": [1]},
{ "cpus": [1] }, { "cpus": [1]},
{ "cpus": [1] }, { "cpus": [1]},
{ "cpus": [1] }, { "cpus": [1]},
{ "cpus": [1] }, { "cpus": [1]},
{ "cpus": [1] }, { "cpus": [1]}
]
}
]
}
]
}
This is a JSON file that models a very basic datacenter (like you can construct on opendc.org). This datacenter contains a single server room with two racks:
- A rack containing 16 machines with a single CPU of type 2
- A rack containing 16 machines with a single CPU of type 1
The two CPU types available in this format are:
- Intel i7 (4 cores, 4100 MHz)
- Intel i5 (2 cores, 3500 MHz).
We are at the moment actively working on establishing a (documented) format for describing datacenter environments and will be implementing it in OpenDC to make these things a bit more easier in the future.
@fabianishere thanks still will give us a good starting point.
Hi @fabianishere I have some more questions, I hope you don't mind I'm reusing this issue for them.
We're implementing a new TaskSortingPolicy
. In the policy we need access to information about all the available machines. To access those machines we call context<StageScheduler.State, OdcModel>().run { /* Access to state.machines here. */ }
. But the machines are of type com.atlarge.opendc.model.odc.topology.machine.Machine
, which do not provide enough information for us. The class code itself can access more CPU details here: https://github.com/atlarge-research/opendc-simulator/blob/master/opendc-model-odc/core/src/main/kotlin/com/atlarge/opendc/model/odc/topology/machine/Machine.kt#L100, which comes from https://github.com/atlarge-research/opendc-simulator/blob/master/opendc-stdlib/src/main/kotlin/com/atlarge/opendc/model/topology/TopologyContext.kt#L49 (I think).
Now my question how can we access those CPU details in a TaskSortPolicy
implementation, if at all possible?
If you need more information please ask, or alternatively I can share the changes we've made so far (can't do that publicly (yet)).
Hi @Thomasdezeeuw, no problem!
Notice line 99 in Machine.kt
:
Here,
model.run
brings the methods from TopologyContext into scope.
You can do something similar to access the CPU details in a TaskSortPolicy
implementation:
class MySortingPolicy : TaskSortingPolicy {
override suspend fun sort(tasks: List<Task>): List<Task> =
context<StageScheduler.State, OdcModel>().run {
model.run {
...
val cpus = machine.outgoingEdges.destinations<Cpu>("cpu")
...
}
}
}
Not the most elegant code unfortunately, but it will do for now :P
Thanks @fabianishere for all your help we've completed our lab, so this can be closed.