Fwd: Issue when using agent mobility in Cougaar

Todd Wright twright at bbn.com
Wed Jun 25 14:17:52 EDT 2008


Daniel,

I tested this in Cougaar 12.4 using the demo "ping" society and the "/move" 
servlet and it worked for me.

Maybe there's something wrong with your MoveAgent request, 'though it looks 
okay to me.  It could be a bug that doesn't happen in the ping test, e.g. a 
race condition.

Please run the following test:

1) Download and unzip Cougaar 12.4 from:
http://cougaar.org/frs/?group_id=17&release_id=161

2) Unzip the required code:
unzip -q cougaar.zip
unzip -q cougaar-support.zip
unzip -q demo-ping.zip

3) Set the required environment variables:
export COUGAAR_INSTALL_PATH=/opt/Cougaar12_4
export COUGAAR_SOCIETY_PATH=/opt/Cougaar12_4/ping
export COUGAAR_RUNTIME_PATH=/opt/Cougaar12_4/ping/run

4) Modified the ping code to add debug output:
cd ping
modify src/org/cougaar/demo/ping/PingSender.java to add line 145:
   log.shout("sub added="+sub.getAddedCollection()+" all="+sub.getCollection());
ant jar
mv tmp/ping.jar lib
cd run

5) In one console run:
cougaar ../configs/PingTwoNodesSociety.xml PingTwoNodesRuntime.xml Node1
and then in a second console run:
cougaar ../configs/PingTwoNodesSociety.xml PingTwoNodesRuntime.xml Node2

6) The first console prints:
   SHOUT [PingSender] - A: sub added=[] all=[]
This shows that the subscription starts out empty, as expected.

7) Let it run for a while then load:
http://localhost:8800/$Node1/move?op=Move&mobileAgent=A&originNode=Node1&destNode=Node2&isForceRestart=false&action=Add

8) The first console prints:
   SHOUT [DOTS] - P+-+....
and the second console prints:
   SHOUT [PingSender] - A: sub added=[] all=[(SimpleRelay uid=A/1214417255150 
source=A target=B query=10 reply=10)]
This shows that the subscription "getAddedCollection()" is empty and the 
"iterator()" was repopulated with the prior state.

Todd

daniel domingue wrote:
> I'm trying a second attempt at the mailing list
> 
> 
> ---------- Forwarded message ----------
> From: daniel domingue <ddomingue at gmail.com>
> Date: Fri, Jun 20, 2008 at 5:07 PM
> Subject: Issue when using agent mobility in Cougaar
> To: cougaar-developers at cougaar.org
> 
> 
> Hello all,
> 
> I have encountered a small problem when trying to use mobile agents.
> The relocated agents have an IncrementalSubscription on message
> elements in the blackboard which contain a specific object.
> Mobility is triggered by a remote agent using the following code :
> 
>                /* get a ticket identification from the mobility factory */
>                Object ticketId = mobilityFactory.createTicketIdentifier();
> 
>                /* get adresses of agent and host */
>                MessageAddress agentAdd =
> MessageAddress.getMessageAddress(agentName);
>                MessageAddress origHostAdd =
> MessageAddress.getMessageAddress(origHost);
> 
>                /* create a transfer ticket with the needed information */
>                Ticket mTicket = new
> Ticket(ticketId,agentAdd,origHostAdd,this.nodeId,false);
> 
>                /* create a move agent order with the created ticket */
>                MoveAgent ac = mobilityFactory.createMoveAgent(mTicket);
> 
>                /* post the ticket to the blackboard for proceeding */
>                blackboard.publishAdd(ac);
> 
> 
> Everything works fine except that the relocated agents receive old
> messages through the getAddedCollection() performed in the execute()
> method after the blackboard has been rehydrated.
> Below is part of the code that filters the messages in the relocated agents :
> 
>        for (Iterator iter = aValMsgSubs.getAddedCollection().iterator();
> iter.hasNext();)
>                {
>                        LS_Com_Target co = (LS_Com_Target) iter.next() ;
>                        Object o = co.getData();
>                        Msg_LBValidator m = ((Msg_LBValidator) o);
> 
>                        /* placebo */
>                        switch(m.getLoadType())
>                        {
>                        case(ScenarioEntry.MSG):
> 
> loadinfo.setRemainingMSGLoadCycles(m.getElapsed());
>                        loadinfo.setMsgTargets(m.getTargetAgents());
>                        System.out.println(this.agentId.toString()+"
> received MSG");
>                        break;
> 
>                        case(ScenarioEntry.PROC):
> 
> loadinfo.setRemainingCPULoadCycles(m.getElapsed());
>                        System.out.println(this.agentId.toString()+"
> received PROC");
>                        break;
> 
>                        case(ScenarioEntry.SIZE):
> 
> loadinfo.setRemainingMEMLoadCycles(m.getElapsed());
>                        System.out.println(this.agentId.toString()+"
> received SIZE");
>                        break;
>                        }
> 
>                        modified=true;
> 
>                }
> 
> The problem I see is that when the blackboard is being rehydrated all
> the old messages change state and are classified as new messages,
> which are picked up at the first execute() call after the load().
> 
> Any clue that could help would be appreciated!
> 
> 
> Thanks in advance,
> 
> 
> --
> Daniel Domingue
> 
> 
> 



More information about the Cougaar-developers mailing list