Hi Khadija,

the problem with the code is in this part:


define
   RF=functor
      import
         Pickle
         Module

      export
         done:D
      define
         AgentServer={Pickle.load "agents.ozf"}
         [D]={Module.apply [AgentServer]}        %  (1)
         {D.publishserver ""}
      end

   RM={New Remote.manager init}

   M={RM apply(RF $)}

   GetServer=M.done.getserver    % (2)


The module AgentServer is created at (1) in code that is executed via
Remote.manager. In other words, AgentServer is created in a different
process or even on a different computer.
AgentServer.ozf itself uses the module Pickle. Pickle is one of the
SITED modules, i.e. it can only be used in the same process where it
was created.
That makes AgentServer a sited module, too.

At (2) you are accessing a method from AgentServer in the local
process. When you are trying to use GetServer, it will fail because it
will try to use the remote instance of the Pickle module in the local
process.

To fix this problem, you should create a local version of AgentServer,
for example by simply adding "Agents" to the toplevel imports section
and then using Agents.getserver.

Hope this helps,

Wolfgang



On Mon, Jan 16, 2012 at 11:55 AM, Khadija EL MAHRSI
<khadija.elmah...@gmail.com> wrote:
>
> Hello,
> Since I still can't figure out the problem, I decided to give you the code so 
> that you can try it out and hopefully solve my problem. The only changes that 
> must be done are the ones related to the files' paths in AgentRemote.oz (and 
> eventually any mistakes that I may have done).
>
> Thanks.
>
>
> 2011/12/23 Khadija EL MAHRSI <khadija.elmah...@gmail.com>
>>
>> Hi,
>> I've been working on the remote agent server and I think I managed to 
>> correct the given code (hopefully). However, I keep getting the exception 
>> "serverUnavailable" even though the creation of the server is done 
>> successfully. Maybe I'm not accessing the server correctly (the getserver 
>> part after applying the functor to the remote manager). Can someone tell me 
>> how it should be done so that I can compare it to my code and see if I made 
>> any mistakes?
>>
>> Thanks.
>>
>>
>> 2011/12/15 Khadija EL MAHRSI <khadija.elmah...@gmail.com>
>>>
>>> Hello,
>>> I just wanted to add that I think the code for the remote agent server is 
>>> also incorrect. I'm doing the same previous example but with a remote agent 
>>> server and trying to correct the provided code so if anyone can help me 
>>> with it I'd appreciate it.
>>>
>>> Thanks.
>>>
>>>
>>> 2011/12/14 Khadija EL MAHRSI <khadija.elmah...@gmail.com>
>>>>
>>>> Hello,
>>>> I can't thank you enough for your help, I added ! and everything worked 
>>>> perfectly. I've been trying to figure out the problem for quite some time 
>>>> now and I was starting to get really frustrated. I think it would be 
>>>> better to correct the document and update it (since there are some 
>>>> unfinished parts). Maybe this document is an old version and a more 
>>>> complete one exists which I somehow missed?
>>>>
>>>> Again, thank you for the help.
>>>>
>>>>
>>>> 2011/12/14 Wolfgang Meyer <wolfgang.m.me...@googlemail.com>
>>>>>
>>>>> Hi,
>>>>>
>>>>> this is an error in the source code.
>>>>> In this line:
>>>>>
>>>>> {Server2 functor import OS define D1={OS.time} end}
>>>>>
>>>>> the "define" statement introduces a NEW variable D1. The line does not 
>>>>> assign to the "D1" variable in the outer scope.
>>>>> (Maybe this code is from an earlier Mozart version??)
>>>>>
>>>>> The correct way to write this is to use an "!" to suppress the 
>>>>> declaration of a new variable:
>>>>>
>>>>> {Server2 functor import OS define !D1={OS.time} end}
>>>>>
>>>>> "!" can also be useful in the patterns of case-statement or when using 
>>>>> unification within a variable definition
>>>>> (see also 
>>>>> http://www.mozart-oz.org/documentation/tutorial/node5.html#control.anonymous
>>>>>  ).
>>>>>
>>>>> Hope this helps,
>>>>>
>>>>> Wolfgang
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Dec 14, 2011 at 11:30 AM, Khadija EL MAHRSI 
>>>>> <khadija.elmah...@gmail.com> wrote:
>>>>>>
>>>>>> Hi,
>>>>>> I've been doing some more tests and any use of D1 after the functor is 
>>>>>> sent to the server results in an endless wait. Instead of using {Wait 
>>>>>> D1}, I used another variable D2 that uses D1 and the block still remains 
>>>>>> (since D2 waits for D1 to be bound before continuing). What could be the 
>>>>>> problem?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>>
>>>>>> 2011/12/13 Khadija EL MAHRSI <khadija.elmah...@gmail.com>
>>>>>>>
>>>>>>> Hello,
>>>>>>> I've been trying to do the Agent Server example from the Mobile agents 
>>>>>>> part in the following link 
>>>>>>> (http://graubart.rz.ifi.lmu.de/programming/mozart/print/tutorial/DistributedProgramming.pdf)
>>>>>>>  but for some reason couldn't succeed.
>>>>>>> I used the Agent Server code provided in 4.1.6 and the last code for 
>>>>>>> agents provided in 4.1.2. I think there is a missing line in this agent 
>>>>>>> code which is {AS.publishserver "/usr/staff/pvr/public_html/as2"} 
>>>>>>> before Server2={GetServer "http://www.info.ucl.ac.be/~pvr/as2"} 
>>>>>>> (Nothing worked before I added this line). I also changed both of 
>>>>>>> ".../as2" into "as2" and ".../agents.ozf" into "agents.ozf" for 
>>>>>>> simplicity.
>>>>>>> In my agent code, I added {Wait D1} to be able to see D1's value. 
>>>>>>> However, The program seems to block when trying to show this value. Can 
>>>>>>> anyone tell me why?
>>>>>>>
>>>>>>> Thanks
>>>>>>
>>>>>>
>>>>>>
>>>>>> _________________________________________________________________________________
>>>>>> mozart-users mailing list                               
>>>>>> mozart-users@mozart-oz.org
>>>>>> http://www.mozart-oz.org/mailman/listinfo/mozart-users
>>>>>
>>>>>
>>>>>
>>>>> _________________________________________________________________________________
>>>>> mozart-users mailing list                               
>>>>> mozart-users@mozart-oz.org
>>>>> http://www.mozart-oz.org/mailman/listinfo/mozart-users
>>>>
>>>>
>>>
>>
>
>
> _________________________________________________________________________________
> mozart-users mailing list                               
> mozart-users@mozart-oz.org
> http://www.mozart-oz.org/mailman/listinfo/mozart-users
_________________________________________________________________________________
mozart-users mailing list                               
mozart-users@mozart-oz.org
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to