Howto Write VizION Node

From Gravity
Jump to: navigation, search

The subversion is located at vis.eng.uci.edu:/var/svn/vizclass

You then will need to install the logger package.

You can then symlink/copy the VizION3/trunk/VizION folder into the folder where the application is.

python applicationName.py --help will display options, the --node takes an address pair in the form ipaddress:port. VizION starts looking for available ports at 20000 and increments by one. The name option is completely optional, its more there for displayings sake than anything else.

To start a node, first you need to run just one. You can do this by just running the node (python LoginGUI.py for example), then you can connect a second node to it by doing say python LoginGUI.py --node=yourhosthere:20000.

A good example node is there LoginGUI, which has a lot of commenting in it. The actual node code is in LoginNode.py, and the actual GUI code is in LoginGUI.py. This gives a basic example on how to interact with nodes, a more complex example is the GateKeeper Admin Interface (GKAdminGUI).

Everything is based on XMLRPC, so once you have the remote node object (typically defined as rnode) you can call on functions very easily by getting the command, and then just executing that commmand with any options and take in results very easily. VizION supports all the basic python types, but does not support python objects. So it supports strings, numbers (up to 32bit signed iirc), lists, dictionaries, etc.

You have to register functions that can be called by other nodes by using the localnode, but be aware those functions must take a few arguments (as seen in LoginNode's getCreds function) for it to work.

To become aware of other nodes, you need to monitor for them, and you can match in a few ways. I'm not completely sure how all of them work but the example code shows you how to do it. Dirk could probably fill in more information about this. You can add a death handler to any remote node, which simply just calls the function you tell it to whenever that node is determined to be dead (for whatever reason).

You can also subscribe to messages, messages are VizION-wide, so they get sent everywhere. Similarly you can see how these work in both examples.

Theres also some ordering on how things are done, first you need to create the node, then you can add any commands, and then you need to start the node. Once started, you can then monitor for nodes. Note you can't monitor for nodes before the node has started, and you can't add commands once the node has started.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox