# Author: Alina Quereilhac <alina.quereilhac@inria.fr>
# Julien Tribino <julien.tribino@inria.fr>
+from nepi.util.timefuncs import tnow
from nepi.execution.resource import ResourceManager, clsinit_copy, \
ResourceState, reschedule_delay
from nepi.execution.attribute import Attribute, Flags
import time
+reschedule_check = "0.2s"
+confirmation_counter = 3000
+
@clsinit_copy
class OMFNode(OMFResource):
"""
self._omf_api = None
+ # For performance tests
+ self.perf = True
+ self.begin_deploy_time = None
+
+
@property
def exp_id(self):
return self.ec.exp_id
def do_deploy(self):
""" Deploy the RM. It means : Send Xmpp Message Using OMF protocol
to enroll the node into the experiment.
- It becomes DEPLOYED after sending messages to enroll the node
"""
+ ## For performance test
+ if self.perf:
+ self.begin_deploy_time = tnow()
+ self.perf = False
+
if not self.get('xmppServer'):
msg = "XmppServer is not initialzed. XMPP Connections impossible"
self.error(msg)
super(OMFNode, self).do_deploy()
def do_release(self):
- """ Clean the RM at the end of the experiment
+ """ Clean the RM at the end of the experiment by unenrolling
+ the node from the topic
"""
from nepi.resources.omf.application import OMFApplication
self.ec.schedule(reschedule_delay, self.release)
return
+ from nepi.resources.omf.interface import OMFWifiInterface
+ rm_list = self.get_connected(OMFWifiInterface.get_rtype())
+ if rm_list:
+ for rm in rm_list:
+ if rm.state < ResourceState.RELEASED:
+ self.ec.schedule(reschedule_delay, self.release)
+ return
+
if self._omf_api:
if self.get('version') == "5":
self._omf_api.release(self.get('hostname'))