@@ -429,6 +429,7 @@ def authenticate_api_request(request: web.Request) -> bool:
429429
430430async def update_allocations (request : web .Request ):
431431 """Main entry for the start of persistence VM and instance, called by the Scheduler,
432+ POST /control/allocations
432433
433434
434435 auth via the SETTINGS.ALLOCATION_TOKEN_HASH sent in header X-Auth-Signature.
@@ -450,8 +451,10 @@ async def update_allocations(request: web.Request):
450451 pool : VmPool = request .app ["vm_pool" ]
451452
452453 async with allocation_lock :
454+ logger .debug ("Got allocation_lock, updating allocations" )
453455 # First, free resources from persistent programs and instances that are not scheduled anymore.
454456 allocations = allocation .persistent_vms | allocation .instances
457+ stopped_vms = []
455458 # Make a copy since the pool is modified
456459 for execution in list (pool .get_persistent_executions ()):
457460 if (
@@ -465,6 +468,7 @@ async def update_allocations(request: web.Request):
465468 logger .info ("Stopping %s %s" , vm_type , execution .vm_hash )
466469 await pool .stop_vm (execution .vm_hash )
467470 pool .forget_vm (execution .vm_hash )
471+ stopped_vms .append (execution .vm_hash )
468472
469473 # Second start persistent VMs and instances sequentially to limit resource usage.
470474
@@ -531,6 +535,7 @@ async def update_allocations(request: web.Request):
531535 "success" : not failing ,
532536 "successful" : list (successful ),
533537 "failing" : list (failing ),
538+ "stopped" : list (stopped_vms ),
534539 "errors" : {vm_hash : repr (error ) for vm_hash , error in scheduling_errors .items ()},
535540 },
536541 status = status_code ,
0 commit comments