| | |
- Boost.Python.instance(__builtin__.object)
-
- UserData
class UserData(Boost.Python.instance) |
| |
__init__()
Creates a new instance of a Python object container for use with
VR Juggler clustering. The Python object contained within a
cluster.UserData instance will be distributed to all the nodes of
a cluster.
cluster.UserData is based on the C++ type cluster::UserData<T>, but
its usage takes advantage of Python features to simplify the usage.
In the C++ version, the contained type must be serializable (it
must derive from the C++ type vpr::SerializableObject), but with
cluster.UserData, the requirement is that the contained object
support pickling (Python's version of serialization). Most Python
objects support pickling by default, so no additional code must be
written in most cases.
The basic usage in a VR Juggler application object is as follows:
class AppObj(vrj.GlApp):
def __init__(self):
vrj.GlApp.__init__(self)
self.user_data = cluster.UserData()
self.pickled_obj = MyObj()
def init(self):
self.user_data.init(vpr.GUID("...")
self.user_data.setPickleObject(self.pickled_obj)
def preFrame(self):
if self.user_data.isLocal():
# Modify self.pickled_obj ...
def latePfreFrame(self):
# Set up rendering state based on self.pickled_obj ...
More details can be found in the PyJuggler Getting Started Guide. |
| |
- Method resolution order:
- UserData
- Boost.Python.instance
- __builtin__.object
Methods defined here:
- __init__(...)
- init(...)
- init(id, writerAddr = '')
Initializes this application-specific shared data object with
the given vpr.GUID instance. There must be a distinct GUID for
for each instance of shared data, even if the instances are all
of the same type.
If the second argument is not given, the writer (master) host
must be identified using a configuration element of type
application_data. Otherwise, the given string object is used
to identify the writer host. Naming the writer host explicitly
is somewhat easier to use, but it can be less flexible.
Keyword arguments:
id -- A vpr.GUID object that uniquely identifies this
instance of application-specific shared data.
writerAddr -- The cluster node (hostnameo or IP address) that
will be the writer of the shared data. This
argument is optional.
- isLocal(...)
- isLocal() -> Boolean
Returns whether this cluster node is responsible for updating
the application-specific shared data. This determination is
based on which node was identified as the writer when init()
was called.
Pre-condition:
init() has been invoked.
- setPickleObject(...)
- setPickleObject(object)
Stores the given Python object as the object to be pickled and
un-pickled by the data-sharing code. The object must support
pickling. Refer to the Python pickling documentation, which
can be found at http://docs.python.org/lib/module-pickle.html
among other sites.
Data and other attributes defined here:
- __instance_size__ = 20
Data and other attributes inherited from Boost.Python.instance:
- __dict__ = <dictproxy object>
- __new__ = <built-in method __new__ of Boost.Python.class object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
- __weakref__ = <member '__weakref__' of 'Boost.Python.instance' objects>
| |