def startall(): """ Starts all nodes of the system grouped by roles with the necessary delays to allow a proper registration to the parent JobMgr. The delay between the invocations can be set in the settings. """ # Start all masters before, allowing for a proper setup before registering # a new slave with shell.workon(role('master')): start() # Wait some (configurable) time. One or two seconds should be enough here time.sleep(settings.STARTUP_DELAY) # And now start the slaves with shell.workon(role('slaves')): start() # Wait again some time for possible subsequent programs execution time.sleep(settings.STARTUP_DELAY)
def stopall(): """ Stops all nodes of the system grouped by roles with the necessary delays to allow a proper registration to the parent JobMgr. The delay between the invocations can be set in the settings. Note that in this case the delays are not as important as in the start function on could probably safely be omitted. The behavior is preserved to grant compatibility with future versions of the JobMgr which possibly wants to execute some cleanup code before terminating. In the meanwhile it is possible to set the delay to 0 in the settings. """ with shell.workon(role('slaves')): stop() time.sleep(settings.SHUTDOWN_DELAY) with shell.workon(role('master')): stop() time.sleep(settings.SHUTDOWN_DELAY)
def execute(name, remotedir=None): """ Executes the given test case on all client hosts (normally onle one). """ if not remotedir: remotedir = settings.PATHS['test-cases'][1] remote = os.path.join(remotedir, name) base = os.path.dirname(settings.PATHS['configuration'][1]) with shell.workon(role('client')): with shell.cd(remote): shell.remote('ENV_BASE={0} make -e execute'.format(base))
def toxml(name): """ Converts all raw measure files for the given measure to xml using a remote tshark command. This will overwrite all already converted files with matching names. """ host_shared, guest_shared = settings.PATHS["shared-measures"] pattern = os.path.join(host_shared, name, "*", "*.raw") paths = glob.glob(pattern) paths = (guest_shared + path[len(host_shared) :] for path in paths) with shell.workon(role("client")): for path in paths: tshark.pcaptoxml(path, path.replace(".raw", ".xml"), settings.DISPLAY_FILTER)