@@ -241,6 +241,7 @@ async def load_persistent_executions(self):
241
241
if await self .systemd_manager .is_service_active (
242
242
execution .controller_service
243
243
): # TODO: Improve the way that we re-create running execution
244
+ logger .debug (("Execution %s is still running in systemd, reconnecting" , execution .vm_hash ))
244
245
await execution .prepare ()
245
246
if self .network :
246
247
vm_type = VmType .from_message_content (execution .message )
@@ -251,16 +252,21 @@ async def load_persistent_executions(self):
251
252
vm = execution .create (vm_id = vm_id , tap_interface = tap_interface , prepare = False )
252
253
await vm .start_guest_api ()
253
254
execution .ready_event .set ()
255
+ execution .times .starting_at = execution .times .starting_at or datetime .now (tz = timezone .utc )
254
256
execution .times .started_at = datetime .now (tz = timezone .utc )
255
-
257
+ execution .times .stopping_at = None
258
+ execution .times .stopped_at = None
256
259
self ._schedule_forget_on_stop (execution )
257
260
258
261
# Start the snapshot manager for the VM
259
262
if vm .support_snapshot and self .snapshot_manager :
260
263
await self .snapshot_manager .start_for (vm = execution .vm )
261
264
265
+ assert execution .is_running
262
266
self .executions [vm_hash ] = execution
267
+
263
268
else :
269
+ logger .debug (("Execution %s is not running in systemd, reconnecting" , execution .vm_hash ))
264
270
execution .uuid = saved_execution .uuid
265
271
await execution .record_usage ()
266
272
0 commit comments