Example #1
0
    def __setattr__(self, name, value):
        if name == "_readonly":
            if _pbs_v1.in_python_mode() and \
                                hasattr(self, "_readonly") and not value:
                 raise BadAttributeValueError("_readonly can only be set to True!")
        elif not _vnode.attributes.has_key(name):
            raise UnsetAttributeNameError("vnode attribute '%s' not found" % (name,))
        super(_vnode,self).__setattr__(name, value)

        # attributes that are set in python mode will be reflected in
        # _attributes_hook_set dictionary.
        # For example,
        # _attributes_hook_set[<vnode object>]=['Priority', 'comment']
        # if 'comment' or 'Priority' has been assigned a value within the hook
        # script, or been unset.

        if _pbs_v1.in_python_mode() and (name != "_connect_server"):
            if not self._attributes_hook_set.has_key(self):
                self._attributes_hook_set[self] = {}
            # using a dictionary value as easier to search for keys
            self._attributes_hook_set[self].update({name : None})
            _pbs_v1.mark_vnode_set(self.name, name, str(value))        
Example #2
0
    def __setattr__(self, name, value):
        if name == "_readonly":
            if _pbs_v1.in_python_mode() and \
                                hasattr(self, "_readonly") and not value:
                 raise BadAttributeValueError("_readonly can only be set to True!")
        elif not _vnode.attributes.has_key(name):
            raise UnsetAttributeNameError("vnode attribute '%s' not found" % (name,))
        super(_vnode,self).__setattr__(name, value)

        # attributes that are set in python mode will be reflected in
        # _attributes_hook_set dictionary.
        # For example,
        # _attributes_hook_set[<vnode object>]=['Priority', 'comment']
        # if 'comment' or 'Priority' has been assigned a value within the hook
        # script, or been unset.

        if _pbs_v1.in_python_mode() and (name != "_connect_server"):
            if not self._attributes_hook_set.has_key(self):
                self._attributes_hook_set[self] = {}
            # using a dictionary value as easier to search for keys
            self._attributes_hook_set[self].update({name : None})
            _pbs_v1.mark_vnode_set(self.name, name, str(value))