Demo: Using JMX to probe into Jason Agent execution #115
mindcrime
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
Thanks for sharing your progress on this. Indeed, JMX is a nice approach, specially in the Java world. One aspect to discuss could be to implement this feature as an Agent Architecture instead of an Agent. In Jason, these two classes can be customised. The first represent the "body" of the agent: it provides interaction with the environment, with other agents, and execution power :-) -- a thread usually. The latter represent the "mind": beliefs, decisions, reasoning, ... So it seems more natural, for me, that suspending an agent is implemented in the architecture. There are candidate methods there to place the "wait". |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all, thought that today I'd try sharing something instead of bothering people with my own questions. It's all related though.. in service of figuring out some stuff about how things work in the bowels of Jason at Agent execution time I threw together a little thing with a custom JMX MBean and a custom Agent class, where I can jam properties into the MBean and inspect them with JConsole, as well as blocking execution at a point until I invoke an operation on the MBean.
In some ways this isn't too different than what you can accomplish with some combination of the MindInspector and the debug mode ExecutionControl class, but this setup is just more natural to way I think and work. Maybe some other folks will find this valuable for something, especially in regards to learning Jason.
Full runnable example with all source code can be found at this repo
The basic concept is this. I created a custom Agent class, and overrode the selectEvent and selectIntention methods. In selectEvent I only do some extra logging, but in selectIntention I add the AgentStats MBean if it's not already in the PlatformMBeanServer, and set the current cycle number and the list of available Intentions. If the MBean is already there I just updated the attributes with the updated values. Then I block execution indefinitely until the MBean's "proceed" flag toggles to true (it resets immediately afterward, so every iteration will block when using this approach).
JMXAgent.java
AgentStatsMBean.java (the MBean interface)
AgentStats.java (MBean implementation)
Beta Was this translation helpful? Give feedback.
All reactions