Home Help Center

IceGrid::Admin & Python

rlimbergerrlimberger Member rene limbergerOrganization: imageworksProject: netrender
I would like to write some tools (cmdline and/or GUI) to monitor a registry. I would like to use Python if possible.

Are there some examples i could use as a starting point to do this? My understanding is that is somehow need to use the IceGrid::Admin function set, right? How do i do that from python?

thanks a lot,
-r

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    You need to establish a session with the registry to obtain a proxy for the IceGrid::Admin interface. The session will also allow you to register observers to receive updates from the IceGrid registry and nodes.

    Here's how to create an IceGrid admin session and get the admin proxy with Python and IcePy:
    #!/usr/bin/env python
    import sys, Ice, IceGrid
    
    communicator = Ice.initialize(sys.argv)
    registry = IceGrid.RegistryPrx.uncheckedCast(communicator.stringToProxy("DemoIceGrid/Registry"))
    
    session = registry.createAdminSession("user", "passord")
    admin = session.getAdmin()
    
    print admin.getAllServerIds()
    
    session.destroy()
    communicator.destroy()
    
    

    You'll need to pass the appropriate --Ice.Defaut.Locator=<proxy of the locator> command line option to execute this script.

    Cheers,
    Benoit.
Sign In or Register to comment.