Results 1 to 7 of 7

Thread: asked about the possibilities of icegrid to create automaticly servers

  1. #1
    Gilles is offline Registered User
    Name: Gilles LINDECKER
    Organization: ISIS MPP
    Project: Systeam (tests benches software)
    Join Date
    Oct 2008
    Posts
    10

    asked about the possibilities of icegrid to create automaticly servers

    Hi,

    I would like to known, if ICE allow the creation to any server on the basis of a model.

    The file xml describe our application. We have two services template and each service had an adapter. Each allocatable object of adapter had the same Type (::OSL::MSG).
    The node CDT had 2 icebox server and each server Icebox had one service from a template MSGService1 and MSGService2.

    Actually, if we want to run for example 10 services, we must duplicate the service template, the adapter, the server and the service.

    Is it possible to create a configuration who allow to icegrid to create automaticly a service from a unique client request with a unique ID? But the services must be totally indepentdent each other.


    Currently, we have this Python client code:

    Loop for the research of the list of allocatable objects of the each apadapter

    Code:
    registry = IceGrid.RegistryPrx.checkedCast(self._communicator.stringToProxy("SYSTEAM/Registry"))
            
     try :
      session = registry.createSession("root", "racine")
      sessionAdmin = registry.createAdminSession("root", "racine")
      admin = sessionAdmin.getAdmin()
      tabappli=admin.getAllApplicationNames()
        for appli in tabappli:
          TemplateDescriptorDict=admin.getApplicationInfo(appli).descriptor.serviceTemplates
          listekeys =  TemplateDescriptorDict.keys()
          for key in listekeys:
            listAdapter = TemplateDescriptorDict[key].descriptor.adapters
            nbadapter=0
              for adapter in listAdapter:
                adapters = TemplateDescriptorDict[key].descriptor.adapters[nbadapter]
                  for allocatable in adapters.allocatables:
                    self.listeallocatable.append(allocatable.id.name)
                    nbadapter=nbadapter+1
    except:
      print "Unexpected error:", sys.exc_info()[0], sys.exc_info()[1]
    Loop for the connexion:
    Code:
    for self.allocatable in self.listeallocatable:
      session.setAllocationTimeout(5)
      try:
       self.ObjId=session.allocateObjectById(self.communicator().stringToIdentity(self.allocatable))
    self.twowayMSGIceBox = OSL.MSGPrx.checkedCast(self.ObjId)
        if self.twowayMSGIceBox!= None:
          self.KeepSession = SessionRefreshThread(registry.getSessionTimeout() / 10, session)
          self.KeepSession.start()
          break
    except:
      print self.allocatable.__str__() + " Allready use"
      self.allocatable=""
      self.twowayMSGIceBox = None
    Thanks

    Gilles
    Attached Files Attached Files

  2. #2
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Hi Gilles,

    It's not clear to me why you define 2 service templates, why not just one? To answer your question, no it's not possible to instantiate one server per client. You can however easily deploy 10 servers on your node without having to duplicate the XML configuration. For example, you could use something like the following for your application descriptor:

    Code:
    <icegrid>
       <application name="MSG">
          <service-template id="MSGService">
             <parameter name="name"/>
             <service name="MSGService" entry="OSL.MSG:create">
                <adapter name="MSG" endpoints="default" id="MSG-${name}">
                   <allocatable identity="msg-${name}" type="::OSL::MSG" property="MSG.Identity"/>
                </adapter>
             </service>
          </service-template>
          <server-template id="IceBox">
             <parameter name="name"/>
             <icebox id="IceBox-${name}" activation="session" exe="iceboxd">
                <service-instance template="MSGService" name="${name}"/>
             </icebox>
          </server-template>
          <node name="CDT">
             <server-instance template="IceBox" name="1"/>
             <server-instance template="IceBox" name="2"/>
             <server-instance template="IceBox" name="3"/>
             <server-instance template="IceBox" name="4"/>
             <server-instance template="IceBox" name="5"/>
             <server-instance template="IceBox" name="6"/>
             <server-instance template="IceBox" name="7"/>
             <server-instance template="IceBox" name="8"/>
             <server-instance template="IceBox" name="9"/>
             <server-instance template="IceBox" name="10"/>
          </node>
       </application>
    </icegrid>
    It's also not clear to me what your python code does. It looks like it just tries to allocate an available object. Why not simply call allocateObjectByType on the client session proxy for this? For example:

    Code:
    registry = IceGrid.RegistryPrx.checkedCast(self._communicator.stringToProxy("SYSTEAM/Registry"))
            
    try :
      session = registry.createSession("root", "racine")
      session.setAllocationTimeout(5)
      self.ObjId=session.allocateObjectByType("::OSL::MSG")
      self.twowayMSGIceBox = OSL.MSGPrx.checkedCast(self.ObjId)
      self.KeepSession = SessionRefreshThread(registry.getSessionTimeout() / 10, session)
      self.KeepSession.start()
    except:
      print "Unexpected error:", sys.exc_info()[0], sys.exc_info()[1]
    Cheers,
    Benoit.

  3. #3
    Gilles is offline Registered User
    Name: Gilles LINDECKER
    Organization: ISIS MPP
    Project: Systeam (tests benches software)
    Join Date
    Oct 2008
    Posts
    10
    Hi Benoit,

    Thanks for your answer, your solution is most simple.
    But I have a problem with your python code or with the xml file
    Code:
      self.ObjId=session.allocateObjectByType("::OSL::MSG")
      self.twowayMSGIceBox = OSL.MSGPrx.checkedCast(self.ObjId)
    allocateObjectByType is OK
    and with checkedCast
    Unexpected error: <class 'Ice.NoEndpointException'> exception ::Ice::NoEndpointException
    {
    proxy = msg-10 -t @ MSG-10
    }

    Thanks

    Gilles

  4. #4
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Hi Gilles,

    This is most likely caused by the server failing to start. Is there any errors showing up in the console where you start the icegridnode? You can try adding server activation tracing with IceGrid.Node.Trace.Activator=3 in the IceGrid node configuration file to see if it provides additional clues.

    Cheers,
    Benoit.

  5. #5
    Gilles is offline Registered User
    Name: Gilles LINDECKER
    Organization: ISIS MPP
    Project: Systeam (tests benches software)
    Join Date
    Oct 2008
    Posts
    10
    Hi Benoit

    I see a error message to the console when I execute checkedCast

    Thanks

    Gilles
    Attached Images Attached Images

  6. #6
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Hi Gilles,

    Your server object adapter configuration isn't found. This is most likely because of an adapter name mismatch between your code and the deployment descriptor.

    Your server creates an adapter named "MSG-MSGService" and if you used the application descriptor above without modifications, the adapter name in the XML is "MSG".

    You need to fix your code to use the adapter name "MSG" or the descriptor to use "MSG-MSGService".

    Cheers,
    Benoit.

  7. #7
    Gilles is offline Registered User
    Name: Gilles LINDECKER
    Organization: ISIS MPP
    Project: Systeam (tests benches software)
    Join Date
    Oct 2008
    Posts
    10
    Hi Benoit,

    I resolved my problem, thank for your quick answer


    Gilles

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Logging all calls for IceGrid node servers
    By cfrauenberger in forum Help Center
    Replies: 4
    Last Post: 01-24-2011, 04:33 AM
  2. icegrid servers current path
    By paolo in forum Help Center
    Replies: 1
    Last Post: 09-10-2007, 10:32 AM
  3. Replies: 6
    Last Post: 06-16-2007, 11:03 AM
  4. Starting servers with IceGrid::Admin
    By borax00 in forum Help Center
    Replies: 2
    Last Post: 03-18-2007, 11:00 PM
  5. A problem about IceGrid's replicated servers
    By rc_hz in forum Help Center
    Replies: 3
    Last Post: 05-30-2005, 09:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •