示例#1
0
文件: node_item.py 项目: ROS-PSE/arni
    def execute_action(self, action):
        """
        Sends a signal to top or restart the node.

        :param action: action to be executed
        :type action: RemoteAction
        """
        host_formatted = helper.underscore_ip(self.__parent.get_seuid()[2:])
        service_name = "/execute_node_reaction/%s" % host_formatted
        try:
            execute = rospy.ServiceProxy(
                service_name, NodeReaction)
            resp = execute(self.seuid[2:], action, '')
        except ServiceException:
            self._logger.log("error", Time.now(), self.seuid, "could not stop node %s, service %s not found"
                             % (self.seuid, service_name))
示例#2
0
    def execute_action(self, action):
        """
        Sends a signal to top or restart the node.

        :param action: action to be executed
        :type action: RemoteAction
        """
        host_formatted = helper.underscore_ip(self.__parent.get_seuid()[2:])
        service_name = "/execute_node_reaction/%s" % host_formatted
        try:
            execute = rospy.ServiceProxy(service_name, NodeReaction)
            resp = execute(self.seuid[2:], action, '')
        except ServiceException:
            self._logger.log(
                "error", Time.now(), self.seuid,
                "could not stop node %s, service %s not found" %
                (self.seuid, service_name))
示例#3
0
 def execute_reaction(self):
     host_formatted = helper.underscore_ip(self._host)
     service_name = "/execute_node_reaction/%s" % host_formatted
     try:
         if self._host is not None:
             execute = rospy.ServiceProxy(service_name, NodeReaction)
             resp = execute(self._node, "restart", '')
             rospy.logdebug("restarting node %s returned: %s" %
                            (self._node, resp.returnmessage))
         else:
             rospy.logdebug(
                 "could not restart node %s, " % self._node +
                 "because there is no information about where the node" +
                 " is run from. (possibly because" +
                 " the node never sent any statistics.)")
     except ServiceException:
         rospy.logdebug("could not restart node %s, service %s not found" %
                        (self._node, service_name))
示例#4
0
 def execute_reaction(self):
     host_formatted = helper.underscore_ip(self._host)
     service_name = "/execute_node_reaction/%s" % host_formatted
     try:
         if self._host is not None:
             execute = rospy.ServiceProxy(
                 service_name, NodeReaction)
             resp = execute(self._node, "restart", '')
             rospy.logdebug(
                 "restarting node %s returned: %s"
                 % (self._node, resp.returnmessage))
         else:
             rospy.logdebug(
                 "could not restart node %s, " % self._node
                 + "because there is no information about where the node"
                 + " is run from. (possibly because"
                 + " the node never sent any statistics.)")
     except ServiceException:
         rospy.logdebug(
             "could not restart node %s, service %s not found"
             % (self._node, service_name))