-
Notifications
You must be signed in to change notification settings - Fork 792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor manual agent stop logic #2261
Comments
Finding progenitor is relevant only in the case where the shutdown signal travels from UI to island slower than the agent propagates 2 hops. It may be worth it to postpone it if finding a progenitor involves a lot of work. There's also a case when there's no progenitor and depth is not 0. In that case best we can do is just to compare timestamps |
Finding the progenitor is simple. Each agent has a reference to it's parent. You just follow them until you find an agent with A simple optimization might be
|
Refactor
Component(s) to be refactored
monkey_island.cc.resources.stop_agent_check
monkey_island.cc.resources.stop_all_agents
Explanation
In order to know whether or not an agent has been manually killed and should stop, two pieces of information are required:
If the agent or its progenitor was started before the terminate signal was sent, it should stop. The logic looks something like:
We can create an
AgentSignals
model and anAgentSignalsService
to retrieve the status of those signals.Currently,
AgentSignals
will only containterminate
, but we plan to add a signal to force kill agents in the future. Other signals can be easily added as the need arises.AgentSignals
modelAgentSignalsService
Tasks
TERMINATE_AGENTS
toIslandEventTopic
(0d) @ilija-lazoroskiSimulation
model that contains a timestamp of when the stop button was pressed (0d) @ilija-lazoroskiAgentSignalService
with stubbed methods that do nothing and/or return dummy data (0d) @ilija-lazoroskiIAgentRepository.get_progenitor(descendant: Agent) -> agent
(0d) @ilija-lazoroskiAgentSignalsService.on_terminate_agents_signal
toTERMINATE_AGENTS
events. UpdateISimulationRepository
with the latest data. (0d) @ilija-lazoroski @cakekoaAgentSignalsService.get_signals()
(See above logic to get started) (0d) @mssalvatore/api/agent-signals
) @cakekoa, @shreyamalviya (0d)POST /api/agent-signals/terminate-all
(accepts a timestamp in the json body)TERMINATE_AGENTS
with timestamp toIIslandEventQueue
GET /api/agent-signals/<AGENT_ID>
that returnsAgentSignals
needs-to-stop
to callGET /api/agent-signals/<AGENT_ID>
(0d) @ilija-lazoroskiget_agent_signals()
toIslandAPIClient
IslandAPIClient.get_agent_signals()
fromControlChannel
and check timestamp of terminate signalPOST /api/agent-signals/terminate-all
(0d) - @shreyamalviyamonkey_island.cc.resources.agent_controls
(0.25d) - @VakarisZ, @mssalvatoremonkey_island.cc.models.AgentSignals
to common (0d) - @ilija-lazoroskiTask dependencies
The text was updated successfully, but these errors were encountered: