This is an automated email from the ASF dual-hosted git repository.
deacon-mp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/caldera.git
The following commit(s) were added to refs/heads/master by this push:
new 811eb01f Fix #3374: Fully populate adversary and planner objects in
scheduled operations (#3382)
811eb01f is described below
commit 811eb01fa44753679db0136a32a5e3f20da87617
Author: David Clute <[email protected]>
AuthorDate: Wed Nov 18 20:47:51 2026 -0600
Fix #3374: Fully populate adversary and planner objects in scheduled
operations (#3382)
Operations started by the scheduler, and unfinished operations resumed
at startup, were queued on the event loop that AppService cached when
it was created. The server runs a different loop, so they never
started. Both are now started on the running event loop.
run_scheduler() also replaces the adversary, planner and source copied
from the schedule with the ones currently stored in data_svc, when they
still exist, before the operation starts.
Fixes #3374.
---
app/service/app_svc.py | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/app/service/app_svc.py b/app/service/app_svc.py
index 8afd2b82..97c8f203 100644
--- a/app/service/app_svc.py
+++ b/app/service/app_svc.py
@@ -104,15 +104,29 @@ class AppService(AppServiceInterface, BaseService):
sop.id = str(uuid.uuid4())
sop.name += f"
({datetime.now(timezone.utc).replace(microsecond=0).isoformat()})"
sop.set_start_details()
+ if sop.adversary:
+ full_adv = await
self.get_service('data_svc').locate('adversaries',
match=dict(adversary_id=sop.adversary.adversary_id))
+ if full_adv:
+ sop.adversary = full_adv[0]
+ if sop.planner:
+ full_planner = await
self.get_service('data_svc').locate('planners',
match=dict(planner_id=sop.planner.planner_id))
+ if full_planner:
+ sop.planner = full_planner[0]
+ if sop.source:
+ full_source = await
self.get_service('data_svc').locate('sources', match=dict(id=sop.source.id))
+ if full_source:
+ sop.source = full_source[0]
await sop.update_operation_agents(self.get_services())
await self._services.get('data_svc').store(sop)
- self.loop.create_task(sop.run(self.get_services()))
+ # Force the task onto the actively running asyncio loop
instead of waiting for the next scheduler loop to run it
+
asyncio.get_running_loop().create_task(sop.run(self.get_services()))
await asyncio.sleep(interval)
async def resume_operations(self):
await asyncio.sleep(10)
for op in await self.get_service('data_svc').locate('operations',
match=dict(finish=None)):
- self.loop.create_task(op.run(self.get_services()))
+ # Force the task onto the actively running asyncio loop
+ asyncio.get_running_loop().create_task(op.run(self.get_services()))
async def load_plugins(self, plugins):
def trim(p):