|
22 | 22 | simulation = wrench.Simulation() |
23 | 23 |
|
24 | 24 | # Starting the simulation, with this simulated process running on the host ControllerHost |
25 | | - simulation.start(platform_file_path, "ControllerHost") |
| 25 | + with open(platform_file_path, "r") as platform_file: |
| 26 | + xml_string = platform_file.read() |
| 27 | + simulation.start(xml_string, "ControllerHost") |
26 | 28 |
|
27 | 29 | print(f"Simulation, time is {simulation.get_simulated_time()}") |
28 | 30 |
|
|
121 | 123 | print("Getting simulation events that have occurred while I slept...") |
122 | 124 | events = simulation.get_events() |
123 | 125 | for event in events: |
124 | | - print(f" - Event: {event}") |
| 126 | + print(f"\t- Event: {event}") |
125 | 127 |
|
126 | 128 | print("Creating another task") |
127 | 129 | task2 = workflow.add_task("task2", 100.0, 1, 1, 0) |
|
131 | 133 |
|
132 | 134 | print("Creating a VM on the cloud compute service...") |
133 | 135 | my_vm = ccs.create_vm(1, 100, |
134 | | - {"CloudComputeServiceProperty::VM_BOOT_OVERHEAD": "5s"},{}) |
| 136 | + {"CloudComputeServiceProperty::VM_BOOT_OVERHEAD": "5s"}, {}) |
135 | 137 |
|
136 | 138 | print("Starting the VM...") |
137 | 139 | vm_cs = my_vm.start() |
|
141 | 143 |
|
142 | 144 | print("Synchronously waiting for the next simulation event...") |
143 | 145 | event = simulation.wait_for_next_event() |
144 | | - print(f" - Event: {event}") |
| 146 | + print(f"\t- Event: {event}") |
145 | 147 |
|
146 | 148 | print(f"Time is {simulation.get_simulated_time()}") |
147 | 149 |
|
|
158 | 160 | # if (my_sleep_action_1.get_state_as_string() == "RUNNING"): |
159 | 161 | # print("Action is still running!") |
160 | 162 |
|
161 | | - |
162 | 163 | print("Terminating simulation") |
163 | 164 |
|
164 | 165 | simulation.terminate() |
|
0 commit comments