当前位置: 首页>>代码示例>>Python>>正文


Python ec.ExperimentController类代码示例

本文整理汇总了Python中nepi.execution.ec.ExperimentController的典型用法代码示例。如果您正苦于以下问题:Python ExperimentController类的具体用法?Python ExperimentController怎么用?Python ExperimentController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ExperimentController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

    def setUp(self):
        self.ec = ExperimentController(exp_id = str(OMFVLCWrongCaseAllCritical.id))
        OMFVLCWrongCaseAllCritical.id += 1

        self.node1 = self.ec.register_resource("omf::Node")
        self.ec.set(self.node1, 'hostname', 'wlab12')
        self.ec.set(self.node1, 'xmppUser', "nepi")
        self.ec.set(self.node1, 'xmppServer', "xmpp-plexus.onelab.eu")
        self.ec.set(self.node1, 'xmppPort', "5222")
        self.ec.set(self.node1, 'xmppPassword', "1234")
        
        self.iface1 = self.ec.register_resource("omf::WifiInterface")
        self.ec.set(self.iface1, 'name', "wlan0")
        self.ec.set(self.iface1, 'mode', "adhoc")
        self.ec.set(self.iface1, 'hw_mode', "g")
        self.ec.set(self.iface1, 'essid', "vlcexp")
        self.ec.set(self.iface1, 'ip', "10.0.0.12/24")

        self.app1 = self.ec.register_resource("omf::Application")
        self.ec.set(self.app1, 'appid', 'Vlc#1')
        self.ec.set(self.app1, 'command', "/opt/vlc-1.1.13/cvlc /opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.49,port=1234,mux=ts}'")
        self.ec.set(self.app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")

        self.ec.register_connection(self.app1, self.node1)
        self.ec.register_connection(self.node1, self.iface1)
开发者ID:phiros,项目名称:nepi,代码行数:25,代码来源:omf6_vlc_wrong_critical.py

示例2: setUp

    def setUp(self):
        self.ec = ExperimentController(exp_id = "99999")

        self.node1 = self.ec.register_resource("omf::Node")
        self.ec.set(self.node1, 'hostname', 'omf.plexus.wlab17')
        self.ec.set(self.node1, 'xmppUser', "nepi")
        self.ec.set(self.node1, 'xmppServer', "xmpp-plexus.onelab.eu")
        self.ec.set(self.node1, 'xmppPort', "5222")
        self.ec.set(self.node1, 'xmppPassword', "1234")
        self.ec.set(self.node1, 'version', "5")
        
        self.iface1 = self.ec.register_resource("omf::WifiInterface")
        self.ec.set(self.iface1, 'name', "wlan0")
        self.ec.set(self.iface1, 'mode', "adhoc")
        self.ec.set(self.iface1, 'hw_mode', "g")
        self.ec.set(self.iface1, 'essid', "vlcexp")
        self.ec.set(self.iface1, 'ip', "10.0.0.17/24")
        self.ec.set(self.iface1, 'version', "5")
        
        self.channel = self.ec.register_resource("omf::Channel")
        self.ec.set(self.channel, 'channel', "6")
        self.ec.set(self.channel, 'xmppUser', "nepi")
        self.ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
        self.ec.set(self.channel, 'xmppPort', "5222")
        self.ec.set(self.channel, 'xmppPassword', "1234")
        self.ec.set(self.channel, 'version', "5")
        
        self.app1 = self.ec.register_resource("omf::Application")
        self.ec.set(self.app1, 'appid', 'Vlc#1')
        self.ec.set(self.app1, 'command', "/opt/vlc-1.1.13/cvlc /opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
        self.ec.set(self.app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
        self.ec.set(self.app1, 'version', "5")

        self.app2 = self.ec.register_resource("omf::Application")
        self.ec.set(self.app2, 'version', "5")

        self.app3 = self.ec.register_resource("omf::Application")
        self.ec.set(self.app3, 'version', "5")

        self.app4 = self.ec.register_resource("omf::Application")
        self.ec.set(self.app4, 'version', "5")

        self.app5 = self.ec.register_resource("omf::Application")
        self.ec.set(self.app5, 'version', "5")

        self.ec.register_connection(self.app1, self.node1)
        self.ec.register_connection(self.app2, self.node1)
        self.ec.register_connection(self.app3, self.node1)
        self.ec.register_connection(self.app4, self.node1)
        self.ec.register_connection(self.app5, self.node1)
        self.ec.register_connection(self.node1, self.iface1)
        self.ec.register_connection(self.iface1, self.channel)

        self.ec.register_condition(self.app2, ResourceAction.START, self.app1, ResourceState.STARTED , "3s")
        self.ec.register_condition(self.app3, ResourceAction.START, self.app2, ResourceState.STARTED , "2s")
        self.ec.register_condition(self.app4, ResourceAction.START, self.app3, ResourceState.STARTED , "3s")
        self.ec.register_condition(self.app5, ResourceAction.START, [self.app3, self.app2], ResourceState.STARTED , "2s")
        self.ec.register_condition(self.app5, ResourceAction.START, self.app1, ResourceState.STARTED , "25s")

        self.ec.register_condition([self.app1, self.app2, self.app3,self.app4, self.app5], ResourceAction.STOP, self.app5, ResourceState.STARTED , "1s")
开发者ID:phiros,项目名称:nepi,代码行数:60,代码来源:omf5_vlc_normal_case.py

示例3: setUp

    def setUp(self):
        self.ec = ExperimentController(exp_id = str(OMFVLCWrongCaseWithNonCritical.id))
        OMFVLCWrongCaseWithNonCritical.id += 1

        self.node1 = self.ec.register_resource("omf::Node")
        self.ec.set(self.node1, 'hostname', 'omf.plexus.wlab17')
        self.ec.set(self.node1, 'xmppUser', "nepi")
        self.ec.set(self.node1, 'xmppServer', "xmpp-plexus.onelab.eu")
        self.ec.set(self.node1, 'xmppPort', "5222")
        self.ec.set(self.node1, 'xmppPassword', "1234")
        self.ec.set(self.node1, 'version', "5")
        
        self.iface1 = self.ec.register_resource("omf::WifiInterface")
        self.ec.set(self.iface1, 'name', "wlan0")
        self.ec.set(self.iface1, 'mode', "adhoc")
        self.ec.set(self.iface1, 'hw_mode', "g")
        self.ec.set(self.iface1, 'essid', "vlcexp")
        self.ec.set(self.iface1, 'ip', "10.0.0.17/24")
        self.ec.set(self.iface1, 'version', "5")

        self.app1 = self.ec.register_resource("omf::Application")
        self.ec.set(self.app1, 'appid', 'Kill#1')
        self.ec.set(self.app1, 'command', "/usr/bin/test -1")
        self.ec.set(self.app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")
        self.ec.set(self.app1, 'version', "5")

        self.ec.register_connection(self.app1, self.node1)
        self.ec.register_connection(self.node1, self.iface1)
开发者ID:phiros,项目名称:nepi,代码行数:28,代码来源:omf5_vlc_wrong_non_critical.py

示例4: test_schedule_print

    def test_schedule_print(self):
        def myfunc():
            return 'hola!' 

        ec = ExperimentController()
    
        tid = ec.schedule("0s", myfunc, track=True)
        
        while True:
            task = ec.get_task(tid)
            if task.status != TaskStatus.NEW:
                break

            time.sleep(1)

        self.assertEquals('hola!', task.result)

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:18,代码来源:ec.py

示例5: _ec_from_xml

    def _ec_from_xml(self, doc):
        from nepi.execution.ec import ExperimentController
        ec = None
        
        ecnode_list = doc.getElementsByTagName("experiment")
        for ecnode in ecnode_list:
            if ecnode.nodeType == doc.ELEMENT_NODE:
                exp_id = xmldecode(ecnode.getAttribute("exp_id"))
                run_id = xmldecode(ecnode.getAttribute("run_id"))
                local_dir = xmldecode(ecnode.getAttribute("local_dir"))

                # Configure number of preocessing threads
                nthreads = xmldecode(ecnode.getAttribute("nthreads"))
                os.environ["NEPI_NTHREADS"] = nthreads

                # Deserialize netgraph
                topology = None
                topo_type = None

                netgraph = self._netgraph_from_xml(doc, ecnode)
                
                if netgraph:
                    topo_type = netgraph.topo_type
                    topology = netgraph.topology

                # Instantiate EC
                ec = ExperimentController(exp_id = exp_id, local_dir = local_dir, 
                        topology = topology, topo_type = topo_type)

                connections = set()

                rmsnode_list = ecnode.getElementsByTagName("rms")
                if rmsnode_list:
                    rmnode_list = rmsnode_list[0].getElementsByTagName("rm") 
                    for rmnode in rmnode_list:
                        if rmnode.nodeType == doc.ELEMENT_NODE:
                            self._rm_from_xml(doc, rmnode, ec, connections)

                for (guid1, guid2) in connections:
                    ec.register_connection(guid1, guid2)

                break

        return ec
开发者ID:phiros,项目名称:nepi,代码行数:44,代码来源:xml_parser.py

示例6: test_schedule_exception

    def test_schedule_exception(self):
        def raise_error():
            # When this task is executed and the error raise,
            # the FailureManager should set its failure level to 
            # TASK_FAILURE
            raise RuntimeError, "NOT A REAL ERROR. JUST TESTING!"

        ec = ExperimentController()

        tid = ec.schedule("2s", raise_error, track = True)
        
        while True:
            task = ec.get_task(tid)
            if task.status != TaskStatus.NEW:
                break

            time.sleep(1)

        self.assertEquals(task.status, TaskStatus.ERROR)
开发者ID:phiros,项目名称:nepi,代码行数:19,代码来源:ec.py

示例7: test_schedule_date

    def test_schedule_date(self):
        def get_time():
            return datetime.datetime.now() 

        ec = ExperimentController()

        schedule_time = datetime.datetime.now()
        
        tid = ec.schedule("4s", get_time, track=True)

        while True:
            task = ec.get_task(tid)
            if task.status != TaskStatus.NEW:
                break

            time.sleep(1)

        execution_time = task.result
        delta = execution_time - schedule_time
        self.assertTrue(delta > datetime.timedelta(seconds=4))
        self.assertTrue(delta < datetime.timedelta(seconds=5))

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:23,代码来源:ec.py

示例8: run_experiment

    def run_experiment(self, filepath, wait_time, wait_guids):
        """ Run an experiment based on the description stored
        in filepath.

        """
        ec = ExperimentController.load(filepath)

        ec.deploy()
    
        ec.wait_finished(wait_guids)
        time.sleep(wait_time)

        ec.release()

        if ec.state == ECState.FAILED:
            raise RuntimeError, "Experiment failed"

        return ec
开发者ID:phiros,项目名称:nepi,代码行数:18,代码来源:runner.py

示例9: ExperimentController

	if source:
		ec.set(app,"sources",source)

	ec.set(app,"command",command)
	return app

#Argentina is missing ,"Argentina":"planet-lab2.itba.edu.ar"
#Host where the ground stations will be allocated

hosts ={"Argentina":"planetlab1.pop-rs.rnp.br","China":"planetlab1.buaa.edu.cn","Spain":"planetlab2.dit.upm.es","Norway":"planetlab1.cs.uit.no","New Zealand":"planetlab1.cs.otago.ac.nz","Florida":"planetlab1.csee.usf.edu","Israel":"planetlab2.mta.ac.il","Brazil":"planetlab1.pop-pa.rnp.br","Reunion Island":"lim-planetlab-1.univ-reunion.fr","Malaysia":"planetlab1.comp.nus.edu.sg","Canada":"planetlab-2.usask.ca","Australia":"pl1.eng.monash.edu.au"}
#hosts ={"Argentina":"planetlab1.pop-rs.rnp.br","China":"planetlab1.buaa.edu.cn","Spain":"planetlab2.dit.upm.es","Norway":"planetlab1.cs.uit.no","New Zealand":"planetlab1.cs.otago.ac.nz","Florida":"planetlab1.csee.usf.edu","Israel":"planetlab2.mta.ac.il","Brazil":"planetlab1.pop-pa.rnp.br","Malaysia":"planetlab1.comp.nus.edu.sg","Canada":"planetlab-2.usask.ca","Australia":"pl1.eng.monash.edu.au"}
#hosts={"New Zealand":"planetlab1.cs.otago.ac.nz"}
#Host where the BonFIRE cloud will be
bonfire_host = ("France","ple6.ipv6.lip6.fr")

ec = ExperimentController("test_ple")

# The username in this case is the slice name, the one to use for login in
# via ssh into PlanetLab nodes. Replace with your own slice name.

slice = "ibbtple_geocloud"
pleuser= os.environ["PL_USER"]
plepass= os.environ["PL_PASS"]
ssh_key = "~/.ssh/id_rsa"
#source_file = "/home/deimos/GeoCloudResources/E2E_0Gerardo.bin" #file that client will send
target_file = "data.txt"
port = 20004
seconds = 43200
seconds = 3600 #1 h
nodes = []
apps = []
开发者ID:ruben11291,项目名称:master-thesis,代码行数:31,代码来源:pPLE.py

示例10: ExperimentController

            "(e.g. hostname must be of form: node0ZZ)", 
        type="str")
parser.add_option("-c", "--channel", dest="channel", 
        help="Nitos reserved channel",
        type="str")
parser.add_option("-s", "--slice-name", dest="slicename", 
        help="Nitos slice name", type="str")
(options, args) = parser.parse_args()

nodex = options.nodex
nodez = options.nodez
slicename = options.slicename
chan = options.channel

# Create the EC
ec = ExperimentController(exp_id="nitos_omf6_ping")

# Create and Configure the Nodes
node1 = ec.register_resource("omf::Node")
ec.set(node1, "hostname", nodex)
ec.set(node1, "xmppUser", slicename)
ec.set(node1, "xmppServer", "nitlab.inf.uth.gr")
ec.set(node1, "xmppPort", "5222")
ec.set(node1, "xmppPassword", "1234")

# Create and Configure the Interfaces
iface1 = ec.register_resource("omf::WifiInterface")
ec.set(iface1, "name", "wlan0")
ec.set(iface1, "mode", "adhoc")
ec.set(iface1, "hw_mode", "g")
ec.set(iface1, "essid", "ping")
开发者ID:phiros,项目名称:nepi,代码行数:31,代码来源:nitos_omf6_ping.py

示例11: t_tap_create

    def t_tap_create(self, host, user=None, identity=None):

        ec = ExperimentController(exp_id="test-tap-create")
        
        node = ec.register_resource("linux::Node")
        ec.set(node, "hostname", host)

        if host != "localhost":
            ec.set(node, "username", user)
            ec.set(node, "identity", identity)

        ec.set(node, "cleanExperiment", True)
        ec.set(node, "cleanProcesses", True)

        tap = ec.register_resource("linux::Tap")
        ec.set(tap, "ip", "%s.1" % self.netblock)
        ec.set(tap, "prefix", "24")
        ec.register_connection(tap, node)

        app = ec.register_resource("linux::Application")
        cmd = "ping -c3 %s.1" % self.netblock
        ec.set(app, "command", cmd)
        ec.register_connection(app, node)

        ec.deploy()

        ec.wait_finished(app)

        ping = ec.trace(app, "stdout")
        expected = """3 packets transmitted, 3 received, 0% packet loss"""
        self.assertTrue(ping.find(expected) > -1)
        
        if_name = ec.get(tap, "deviceName")
        self.assertTrue(if_name.startswith("tap"))

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:36,代码来源:tap.py

示例12: str

    app = ec.register_resource("linux::Application")
    ec.set(app, "command", command)
    ec.register_connection(app, node)
    return app

############## Experiment design and execution ################################

platform = "planetlab"

# Set the number of threads. 
# NOTE: This must be done before instantiating the EC.
os.environ["NEPI_NTHREADS"] = str(thread_count)

# Create Experiment Controller:
exp_id = "%s_bench" % platform
ec = ExperimentController(exp_id)

# Authentication for MyPLC
username = 'inria_sfatest'
pl_user = os.environ.get("PL_USER")
pl_password = os.environ.get("PL_PASS")

# App to run on each node
command = "ping -c5 nepi.inria.fr"

# Add simulated nodes and applications
nodes = list()
apps = list()

for i in xrange(node_count):
    node = create_node(ec, username, pl_user, pl_password)
开发者ID:phiros,项目名称:nepi,代码行数:31,代码来源:planetlab.py

示例13: test_serialize

    def test_serialize(self):
        node_count = 4
        app_count = 2

        ec = ExperimentController(exp_id = "plotter-test")
       
        # Add simulated nodes and applications
        nodes = list()
        apps = list()
        ifaces = list()

        for i in xrange(node_count):
            node = ec.register_resource("dummy::Node")
            nodes.append(node)
            
            iface = ec.register_resource("dummy::Interface")
            ec.register_connection(node, iface)
            ifaces.append(iface)

            for i in xrange(app_count):
                app = ec.register_resource("dummy::Application")
                ec.register_connection(node, app)
                apps.append(app)

        link = ec.register_resource("dummy::Link")

        for iface in ifaces:
            ec.register_connection(link, iface)
       
        fpath = ec.plot()
        statinfo = os.stat(fpath)
        size = statinfo.st_size
        self.assertTrue(size > 0)
        self.assertTrue(fpath.endswith(".png"))

        os.remove(fpath)

        fpath = ec.plot(format = PFormats.DOT)
        statinfo = os.stat(fpath)
        size = statinfo.st_size
        self.assertTrue(size > 0)
        self.assertTrue(fpath.endswith(".dot"))

        os.remove(fpath)
开发者ID:phiros,项目名称:nepi,代码行数:44,代码来源:plotter.py

示例14: t_dce_ccnpeek

    def t_dce_ccnpeek(self, host, user = None, identity = None):
        ec = ExperimentController(exp_id = "test-dce-ccnpeek")

        node = ec.register_resource("linux::Node")
        if host == "localhost":
            ec.set(node, "hostname", host)
        else:
            ec.set(node, "hostname", host)
            ec.set(node, "username", user)
            ec.set(node, "identity", identity)
        
        ec.set(node, "cleanProcesses", True)
        #ec.set(node, "cleanHome", True)

        simu = ec.register_resource("linux::ns3::Simulation")
        ec.set(simu, "verbose", True)
        ec.set(simu, "nsLog", "DceApplication")
        ec.register_connection(simu, node)

        nsnode = add_ns3_node(ec, simu)

        ### create applications
        ccnd = ec.register_resource("linux::ns3::dce::CCND")
        ec.set (ccnd, "stackSize", 1<<20)
        ec.set (ccnd, "StartTime", "1s")
        ec.register_connection(ccnd, nsnode)

        ccnpoke = ec.register_resource("linux::ns3::dce::CCNPoke")
        ec.set (ccnpoke, "contentName", "ccnx:/chunk0")
        ec.set (ccnpoke, "content", "DATA")
        ec.set (ccnpoke, "stackSize", 1<<20)
        ec.set (ccnpoke, "StartTime", "2s")
        ec.register_connection(ccnpoke, nsnode)

        ccnpeek = ec.register_resource("linux::ns3::dce::CCNPeek")
        ec.set (ccnpeek, "contentName", "ccnx:/chunk0")
        ec.set (ccnpeek, "stackSize", 1<<20)
        ec.set (ccnpeek, "StartTime", "4s")
        ec.set (ccnpeek, "StopTime", "20s")
        ec.register_connection(ccnpeek, nsnode)

        ec.deploy()

        ec.wait_finished([ccnpeek])

        expected = "ccnpeek ccnx:/chunk0"
        cmdline = ec.trace(ccnpeek, "cmdline")
        self.assertTrue(cmdline.find(expected) > -1, cmdline)

        expected = "Start Time: NS3 Time:          4s ("
        status = ec.trace(ccnpeek, "status")
        self.assertTrue(status.find(expected) > -1, status)

        expected = "DATA"
        stdout = ec.trace(ccnpeek, "stdout")
        self.assertTrue(stdout.find(expected) > -1, stdout)

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:58,代码来源:ns3dceccnpeek.py

示例15: add_ccncat

    ec.set(app, "command", command)

    return app

def add_ccncat(ec, content_name):
    env = "PATH=$PATH:${BIN}/ccnx-0.8.2/bin"
    command = "ccncat %s" % content_name

    app = ec.register_resource("linux::Application")
    ec.set(app, "env", env)
    ec.set(app, "command", command)

    return app

## Create the experiment controller
ec = ExperimentController(exp_id = "ccn_advanced_transfer")

# Register first PlanetLab host
node1 = add_node(ec, hostname1, username, ssh_key)

# Register CCN setup for host
peers = [hostname2]
ccnd1 = add_ccnd(ec, peers)
ec.register_connection(ccnd1, node1)

# Register content producer application (ccnseqwriter)
## Push the file into the repository
local_path_to_content = os.path.join(
        os.path.dirname(os.path.realpath(__file__)),
            "..", "big_buck_bunny_240p_mpeg4_lq.ts")
开发者ID:phiros,项目名称:nepi,代码行数:30,代码来源:ccn_transfer_using_linuxapp.py


注:本文中的nepi.execution.ec.ExperimentController类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。