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


Python Task.wait方法代码示例

本文整理汇总了Python中task.Task.wait方法的典型用法代码示例。如果您正苦于以下问题:Python Task.wait方法的具体用法?Python Task.wait怎么用?Python Task.wait使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在task.Task的用法示例。


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

示例1: start_epc

# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import wait [as 别名]
    def start_epc(self):
        #launch HSS, wait for prompt
        log("INFO: ALU test: run HSS")
        self.task_hss = Task("actions/alu_hss.bash",
                "alu_hss",
                self.epc_machine,
                self.oai_user,
                self.oai_password,
                self.env,
                self.logdir + "/alu_hss." + self.epc_machine,
                event=self.event)
        self.task_hss.waitlog('S6AS_SIM-> ')

        #then launch EPC, wait for connection on HSS side
        log("INFO: ALU test: run EPC")
        task_epc = Task("actions/alu_epc.bash",
                "ALU EPC",
                self.epc_machine,
                self.oai_user,
                self.oai_password,
                self.env,
                self.logdir + "/alu_epc." + self.epc_machine)
        ret = task_epc.wait()
        if ret != 0:
            log("ERROR: EPC start failure");
            raise TestFailed()
        self.task_hss.waitlog('Connected\n')
开发者ID:ShibinMathew36,项目名称:OAI-step,代码行数:29,代码来源:alu_test.py

示例2: compile_enb

# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import wait [as 别名]
 def compile_enb(self, build_arguments, log_suffix=""):
     log("INFO: ALU test: compile softmodem on " + self.enb_machine)
     envcomp = list(self.env)
     envcomp.append('BUILD_ARGUMENTS="' + build_arguments + '"')
     #we don't care about BUILD_OUTPUT but required (TODO: change that)
     envcomp.append('BUILD_OUTPUT=/')
     logdir = self.logdir + "/compile_log"
     remote_files = "'/tmp/oai_test_setup/oai/cmake_targets/log/*'"
     post_action = "mkdir -p "+ logdir + \
             " && sshpass -p " + self.oai_password + \
             " scp -r " + self.oai_user + \
             "@" + self.enb_machine + ":" + remote_files + " " + logdir + \
             " || true"
     task = Task("actions/compilation.bash",
             "compile_softmodem",
             self.enb_machine,
             self.oai_user,
             self.oai_password,
             envcomp,
             self.logdir + "/compile_softmodem." + log_suffix + \
                 self.enb_machine,
             post_action=post_action)
     ret = task.wait()
     if ret != 0:
         log("ERROR: softmodem compilation failure");
         raise TestFailed()
     task.postaction()
开发者ID:ShibinMathew36,项目名称:OAI-step,代码行数:29,代码来源:alu_test.py

示例3: stop_epc

# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import wait [as 别名]
    def stop_epc(self):
        #stop EPC, wait for disconnection on HSS side
        log("INFO: ALU test: stop EPC")
        task_epc = Task("actions/alu_epc_stop.bash",
                "alu_epc_stop",
                self.epc_machine,
                self.oai_user,
                self.oai_password,
                self.env,
                self.logdir + "/alu_epc_stop." + self.epc_machine)
        ret = task_epc.wait()
        if ret != 0:
            log("ERROR: ALU test: ALU EPC stop failed")
            raise TestFailed()
        self.task_hss.waitlog('Disconnected\n')

        log("INFO: ALU test: stop HSS")
        self.task_hss.sendnow("exit\n")
        ret = self.task_hss.wait()
        if ret != 0:
            log("ERROR: ALU test: ALU HSS failed")
            raise TestFailed()
开发者ID:ShibinMathew36,项目名称:OAI-step,代码行数:24,代码来源:alu_test.py

示例4: __init__

# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import wait [as 别名]
class alu_test:
    def __init__(self,
                 epc, enb, ue,
                 openair,
                 user, password,
                 log_subdir,
                 env,
                 enb_rru = "",
                 enb_rcc = ""):
        self.epc_machine      = epc
        self.enb_machine      = enb
        self.ue_machine       = ue
        self.openair_dir      = openair
        self.oai_user         = user
        self.oai_password     = password
        self.env              = env
        self.enb_rru_machine  = enb_rru
        self.enb_rcc_machine  = enb_rcc

        self.task_hss     = None
        self.task_enb     = None
        self.task_ue      = None
        self.task_rru_enb = None
        self.task_rcc_enb = None

        self.logdir = openair + '/cmake_targets/autotests/log/' + log_subdir
        quickshell('mkdir -p ' + self.logdir)

        #event object used to wait for several tasks at once
        self.event = threading.Event()

    ##########################################################################
    # finish
    ##########################################################################
    def finish(self):
        #brutally kill tasks still running
        #TODO: call 'wait', some processes may still be there as zombies
        if self.task_hss != None and self.task_hss.alive():
            self.task_hss.kill()
        if self.task_enb != None and self.task_enb.alive():
            self.task_enb.kill()
        if self.task_ue != None and self.task_ue.alive():
            self.task_ue.kill()
        if self.task_rru_enb != None and self.task_rru_enb.alive():
            self.task_rru_enb.kill()
        if self.task_rcc_enb != None and self.task_rcc_enb.alive():
            self.task_rcc_enb.kill()

    ##########################################################################
    # start_epc
    ##########################################################################
    def start_epc(self):
        #launch HSS, wait for prompt
        log("INFO: ALU test: run HSS")
        self.task_hss = Task("actions/alu_hss.bash",
                "alu_hss",
                self.epc_machine,
                self.oai_user,
                self.oai_password,
                self.env,
                self.logdir + "/alu_hss." + self.epc_machine,
                event=self.event)
        self.task_hss.waitlog('S6AS_SIM-> ')

        #then launch EPC, wait for connection on HSS side
        log("INFO: ALU test: run EPC")
        task_epc = Task("actions/alu_epc.bash",
                "ALU EPC",
                self.epc_machine,
                self.oai_user,
                self.oai_password,
                self.env,
                self.logdir + "/alu_epc." + self.epc_machine)
        ret = task_epc.wait()
        if ret != 0:
            log("ERROR: EPC start failure");
            raise TestFailed()
        self.task_hss.waitlog('Connected\n')

    ##########################################################################
    # stop_epc
    ##########################################################################
    def stop_epc(self):
        #stop EPC, wait for disconnection on HSS side
        log("INFO: ALU test: stop EPC")
        task_epc = Task("actions/alu_epc_stop.bash",
                "alu_epc_stop",
                self.epc_machine,
                self.oai_user,
                self.oai_password,
                self.env,
                self.logdir + "/alu_epc_stop." + self.epc_machine)
        ret = task_epc.wait()
        if ret != 0:
            log("ERROR: ALU test: ALU EPC stop failed")
            raise TestFailed()
        self.task_hss.waitlog('Disconnected\n')

        log("INFO: ALU test: stop HSS")
        self.task_hss.sendnow("exit\n")
#.........这里部分代码省略.........
开发者ID:ShibinMathew36,项目名称:OAI-step,代码行数:103,代码来源:alu_test.py

示例5: _do_traffic

# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import wait [as 别名]
    def _do_traffic(self, name,
            server_code, server_machine, server_ip,
            client_code, client_machine,
            waitlog,
            server_logfile, client_logfile,
            udp_bandwidth=None):
        log("INFO: ALU test: run traffic: " + name)

        log("INFO: ALU test:     launch server")
        task_traffic_server = Task("actions/" + server_code + ".bash",
                server_logfile,
                server_machine,
                self.oai_user,
                self.oai_password,
                self.env,
                self.logdir + "/" + server_logfile + "." + server_machine,
                event=self.event)
        task_traffic_server.waitlog(waitlog)

        env = list(self.env)
        if udp_bandwidth != None:
            env.append("UDP_BANDWIDTH=" + udp_bandwidth)
        env.append("SERVER_IP=" + server_ip)

        log("INFO: ALU test:     launch client")
        task_traffic_client = Task("actions/" + client_code + ".bash",
                client_logfile,
                client_machine,
                self.oai_user,
                self.oai_password,
                env,
                self.logdir + "/" + client_logfile + "." + client_machine,
                event=self.event)
        log("INFO: ALU test:     wait for client to finish (or some error)")

        self.event.wait()
        log("DEBUG: event.wait() done")

        if (    (self.task_enb != None and not self.task_enb.alive()) or
                (self.task_rru_enb!=None and not self.task_rru_enb.alive()) or
                (self.task_rcc_enb!=None and not self.task_rcc_enb.alive()) or
                not self.task_hss.alive() or
                not self.task_ue.alive()):
            log("ERROR: unexpected task exited, test failed, kill all")
            if task_traffic_client.alive():
                task_traffic_client.kill()
            if (self.task_enb != None and self.task_enb.alive()):
                self.task_enb.kill()
            if (self.task_rru_enb != None and self.task_rru_enb.alive()):
                self.task_rru_enb.kill()
            if (self.task_rcc_enb != None and self.task_rcc_enb.alive()):
                self.task_rcc_enb.kill()
            if self.task_ue.alive():
                self.task_ue.kill()

        ret = task_traffic_client.wait()
        if ret != 0:
            log("ERROR: ALU test: downlink traffic failed")
            #not sure if we have to quit here or not
            #os._exit(1)

        #stop downlink server
        #log("INFO: ALU test:     stop server (kill ssh connection)")
        #task_traffic_server.kill()
        log("INFO: ALU test:     stop server (ctrl+z then kill -9 %1)")
        task_traffic_server.sendnow("%ckill -9 %%1 || true\n" % 26)
        log("INFO: ALU test:     wait for server to quit")
        task_traffic_server.wait()

        self.event.clear()

        if (    (self.task_enb != None and not self.task_enb.alive()) or
                (self.task_rru_enb!=None and not self.task_rru_enb.alive()) or
                (self.task_rcc_enb!=None and not self.task_rcc_enb.alive()) or
                not self.task_hss.alive() or
                not self.task_ue.alive()):
            log("ERROR: ALU test: eNB, HSS or UE task died")
            raise TestFailed()
开发者ID:ShibinMathew36,项目名称:OAI-step,代码行数:80,代码来源:alu_test.py

示例6: run

# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import wait [as 别名]
    def run(self):
        id = self.id
        machine = self.machine
        test = self.test

        # step 1: compile

        log("INFO: start compilation of test " + id + " on machine " +
            machine.name)
        tasks = []
        runenv = list(env)
        runenv.append('OPENAIR_DIR=/tmp/oai_test_setup/oai')
        runenv.append('PRE_BUILD="'
                        + test.findtext('pre_compile_prog')
                        + '"')
        runenv.append('BUILD_PROG="'
                        + test.findtext('compile_prog')
                        + '"')
        runenv.append('BUILD_ARGUMENTS="'
                        + test.findtext('compile_prog_args')
                        + '"')
        runenv.append('PRE_EXEC="'
                        + test.findtext('pre_exec') + " "
                        + test.findtext('pre_exec_args')
                        + '"')
        logdir = openair_dir +"/cmake_targets/autotests/log/"+ id + \
                 "/compile_log"
        remote_files = "'/tmp/oai_test_setup/oai/cmake_targets/log/*'"
        post_action = "mkdir -p "+ logdir + \
                      " && sshpass -p " + oai_password + \
                      " scp -r " + oai_user + "@" + machine.name + ":" + \
                                   remote_files + " " + logdir + \
                      " || true"
        task = Task("actions/execution_compile.bash",
                    "compilation of test " + id + " on " + machine.name,
                    machine.name,
                    oai_user,
                    oai_password,
                    runenv,
                    openair_dir + "/cmake_targets/autotests/log/"
                       + id + "_compile."
                       + machine.name,
                    post_action=post_action)
        ret = task.wait()
        task.postaction()
        if ret != 0:
            log("ERROR: compilation of test " + id + " failed: " + str(ret))
            machine.unbusy()
            return

        #step 2: run all tests

        nruns = test.findtext('nruns')
        args = test.findtext('main_exec_args')
        i = 0
        for arg in args.splitlines():
            i = i+1
            runenv2 = list(runenv)
            runenv2.append('OPENAIR_TARGETS=/tmp/oai_test_setup/oai/targets')
            runenv2.append('EXEC="'
                             + test.findtext('main_exec')
                             + '"')
            runenv2.append('EXEC_ARGS="' + arg + '"')
            for run in range(int(nruns)):
                log("INFO: start execution of test " + id + " case " +
                    str(i) + " run " + str(run) + " on machine " +
                    machine.name)
                task =Task("actions/execution.bash",
                           "execution of test " + id + " on " + machine.name,
                           machine.name,
                           oai_user,
                           oai_password,
                           runenv2,
                           openair_dir + "/cmake_targets/autotests/log/"
                              + id + "_case_" + str(i) + "_run_" + str(run)
                              + "." + machine.name)
                ret = task.wait()
                if ret != 0:
                    log("ERROR: execution of test " +id+ " failed: " +
                        str(ret))

        machine.unbusy()
开发者ID:ShibinMathew36,项目名称:OAI-step,代码行数:84,代码来源:main.py


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