clutester opened a new pull request, #3382: URL: https://github.com/apache/caldera/pull/3382
…operations ## Description Resolves #3374. Previously, when an operation was created via the "Schedules" menu using a Cron job, the cloned template operation (s.task) contained shallow objects. Because the adversary object had an empty abilities list, the planner would instantly go idle and fail to execute any actions unless the operation was manually restarted. Additionally, tasks were occasionally hanging due to being attached to a potentially stale event loop during server boot. Specific updates in app/service/app_svc.py include: - Object Inflation: Added logic inside run_scheduler to explicitly query data_svc and fetch the fully-populated Adversary, Planner, and Source objects before storing and running the cloned operation. - Event Loop Synchronization: Replaced self.loop.create_task(...) with asyncio.get_running_loop().create_task(...) in both run_scheduler and resume_operations to ensure the coroutines are placed on the actively executing thread, improving compatibility with modern Python versions. ## Type of change Please delete options that are not relevant. - [X] Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. - [x] Scheduled Execution: Created a scheduled operation to execute 1 minute in the future with a standard adversary profile. Verified that the operation dropped into the queue, abilities successfully loaded into the planner, and fired against active agents without manual intervention. - [x] Active Loop Binding: Verified that resume_operations properly reconnects to the active event loop without silent task hangs upon server restart. ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [ ] I have made corresponding changes to the documentation - [x] I have added tests that prove my fix is effective or that my feature works ## Test: - Start Adversary. - Create scheduled operation. - Validate operation fully fires in operations tab. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
