• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python time.delay函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: disengage

 def disengage(self):
   if (self.state==0):
     return
   time.delay(.3)
   GPIO.output(solenoid_pin,0)
   time.delay(.3)
   self.state=0
开发者ID:sparamona,项目名称:vplotter,代码行数:7,代码来源:solenoid.py


示例2: test_templateBuiltInReady

 def test_templateBuiltInReady(self):
     """
     built-in templates CentOS to be ready
     """
     for z in self.zones_list:
         retry = self.retry
         while retry != 0:
             self.debug("Looking for at least one ready builtin template")
             templates = listTemplates.listTemplatesCmd()
             templates.templatefilter = 'featured'
             templates.listall = 'true'
             templates_list = self.apiClient.listTemplates(templates)
             if templates_list is not None:
                 builtins = [tmpl
                             for tmpl in templates_list
                             if tmpl.templatetype == 'BUILTIN'
                             and tmpl.isready]
                 if len(builtins) > 0:
                     self.debug("Found %d builtins ready for use %s" % (len(builtins), builtins))
                     break
             retry -= 1
             delay(60)  # wait a minute for retry
         self.assertNotEqual(retry, 0,
                             "builtIn templates not ready in zone %s" %
                             z.name)
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:25,代码来源:testSetupSuccess.py


示例3: GET

        def GET(self):
                getInput = web.input(name="")
                aName = str(getInput.name)
                if aName:
                        # set RPi board pins high
                        GPIO.output(7, GPIO.HIGH)
                        GPIO.output(11, GPIO.HIGH)
                        time.delay(1)
                        # set RPi board pins low
                        GPIO.output(7, GPIO.LOW)
                        GPIO.output(11, GPIO.LOW)
                        return """
                                <html>
                                <head>
                                <script>
                                function loaded()
                                {
                                    window.setTimeout(CloseMe, 5);
                                }

                                function CloseMe()
                                {
                                    window.close();
                                }
                                </script>
                                </head>
                                <body onLoad="loaded()">
                                Thanks """+aName+"""!
开发者ID:lmEshoo,项目名称:IEEE-microcontroller-workshop,代码行数:28,代码来源:server.py


示例4: workerThread

 def workerThread(self):
     for x in range(self.total):
         delay(self.delay)
         self.rem = self.total-x-1
         self.Google_server.sendmail(" ",self.target,self.mesg)
         self.gui.stepIt()
     self.running = False
开发者ID:aknuck,项目名称:SMS-Spammer-GUI,代码行数:7,代码来源:SpammerMain.py


示例5: build

 def build(self, wait=20):
     if self.config and self.jobclient:
         while self.jobclient.is_queued_or_running():
             logging.debug("Waiting  %ss for running/queued build to complete"%wait)
             delay(wait)
             
         self.jobclient.invoke(params=self.parseConfigParams())
         self.build_number = self.jobclient.get_last_buildnumber()
         self.paramlist = self.parseConfigParams()
         logging.info("Started build : %d"%self.jobclient.get_last_buildnumber())
         
         while self.jobclient.is_running():
             logging.debug("Polling build status in %ss"%wait)
             delay(wait)
         
         logging.info("Completed build : %d"%self.jobclient.get_last_buildnumber())
         logging.debug("Last Good Build : %d, Last Build : %d, Our Build : \
                       %d"%(self.jobclient.get_last_good_buildnumber(), \
                             self.jobclient.get_last_buildnumber(), \
                             self.build_number))
         if self.jobclient.get_last_good_buildnumber() == self.build_number:
             return self.build_number
         else: #lastGoodBuild != ourBuild
             our_build = self.getBuildWithNumber(self.build_number)
             if our_build is not None and our_build.get_status() == 'SUCCESS':
                 logging.debug("Our builds' %d status %s"%(self.build_number,
                                                           our_build.get_status()))
                 return self.build_number
             else:
                 logging.debug("Our builds' %d status %s"%(self.build_number,
                                                           our_build.get_status()))
                 return 0
开发者ID:iselu,项目名称:cloud-autodeploy,代码行数:32,代码来源:buildGenerator.py


示例6: waitTillPuppetFinishes

 def waitTillPuppetFinishes(self):
     filePath = "/var/lib/puppet/reports/"+self.mgmtHostInfo['hostname']+"."+self.DOMAIN
     while not os.path.exists(filePath):
          delay(60)
          self.logger.info("waiting for puppet setup to finish")
          continue
     pass
开发者ID:bvbharatk,项目名称:cloudstack-automation,代码行数:7,代码来源:hostResource.py


示例7: prepareManagementServer

def prepareManagementServer(mgmt_host):
    """
    Prepare the mgmt server for a marvin test run
    """
    if _isPortListening(host=mgmt_host, port=22, timeout=10) \
            and _isPortListening(host=mgmt_host, port=3306, timeout=10) \
            and _isPortListening(host=mgmt_host, port=8080, timeout=300):
        delay(120) #introduce dumb delay
        mgmt_ip = macinfo[mgmt_host]["address"]
        mgmt_pass = macinfo[mgmt_host]["password"]
        with contextlib.closing(sshClient.SshClient(mgmt_ip, 22, "root", mgmt_pass)) as ssh:
            # Open up 8096 for Marvin initial signup and register
            ssh.execute("mysql -ucloud -pcloud -Dcloud -e\"update configuration set value=8096 where name like 'integr%'\"")
            ssh.execute("service cloudstack-management restart")
    else:
        raise Exception("Reqd services (ssh, mysql) on management server are not up. Aborting")

    if _isPortListening(host=mgmt_host, port=8096, timeout=300):
        logging.info("All reqd services are up on the management server %s"%mgmt_host)
        testManagementServer(mgmt_host)
        return
    else:
        with contextlib.closing(sshClient.SshClient(mgmt_ip, 22, "root", mgmt_pass)) as ssh:
            # Force kill java process
            ssh.execute("killall -9 java; service cloudstack-management start")

    if _isPortListening(host=mgmt_host, port=8096, timeout=300):
        logging.info("All reqd services are up on the management server %s"%mgmt_host)
        testManagementServer(mgmt_host)
        return
    else:
        raise Exception("Reqd service for integration port on management server %s is not open. Aborting"%mgmt_host)
开发者ID:Blufe,项目名称:cloudstack,代码行数:32,代码来源:configure.py


示例8: get_configuration

    def get_configuration(self):
        success = False
        retry_count = 0

        while retry_count < 5 and not success:
            try:
                config = self.read(IMURegisters.NAVX_REG_WHOAMI, IMURegisters.NAVX_REG_SENSOR_STATUS_H + 1)
            except IOError as e:
                logger.warn("Error reading configuration data, retrying (%s)", e)
                success = False
                time.delay(0.5)
            else:
                board_id = self.board_id
                board_id.hw_rev                 = config[IMURegisters.NAVX_REG_HW_REV]
                board_id.fw_ver_major           = config[IMURegisters.NAVX_REG_FW_VER_MAJOR]
                board_id.fw_ver_minor           = config[IMURegisters.NAVX_REG_FW_VER_MINOR]
                board_id.type                   = config[IMURegisters.NAVX_REG_WHOAMI]
                self.ahrs._set_board_id(board_id)

                board_state = self.board_state
                board_state.cal_status          = config[IMURegisters.NAVX_REG_CAL_STATUS]
                board_state.op_status           = config[IMURegisters.NAVX_REG_OP_STATUS]
                board_state.selftest_status     = config[IMURegisters.NAVX_REG_SELFTEST_STATUS]
                board_state.sensor_status       = AHRSProtocol.decodeBinaryUint16(config, IMURegisters.NAVX_REG_SENSOR_STATUS_L)
                board_state.gyro_fsr_dps        = AHRSProtocol.decodeBinaryUint16(config, IMURegisters.NAVX_REG_GYRO_FSR_DPS_L)
                board_state.accel_fsr_g         = config[IMURegisters.NAVX_REG_ACCEL_FSR_G]
                board_state.update_rate_hz      = config[IMURegisters.NAVX_REG_UPDATE_RATE_HZ]
                board_state.capability_flags    = AHRSProtocol.decodeBinaryUint16(config, IMURegisters.NAVX_REG_CAPABILITY_FLAGS_L)
                self.ahrs._set_board_state(board_state)
                success = True

            retry_count += 1

        return success
开发者ID:utk-robotics-2017,项目名称:navX-Python,代码行数:34,代码来源:i2c_io.py


示例9: handle_error

 def handle_error(self, irc_msg):
     if irc_msg.body[0] == "ip (Excess Flood)":
         irc_msg.irc_server.delay += irc_msg.irc_server.delay_incr
         return False    # Cause the connection to be dropped
     if irc_msg.body[0] == "reconnect too fast.":
         time.delay(10)
         return False    # Cause the connection to be dropped
     return True
开发者ID:geniedb,项目名称:djinn,代码行数:8,代码来源:djinn.py


示例10: run

 def run(self):
     while not self.finished:
         snr = tb.digital_mpsk_snr_est_cc_0.snr()
         print " -------------------------------------------------"
         print "SNR : "
         print snr
         print "--------------------------------------------------"
         time.delay(10)
开发者ID:vagonbar,项目名称:GNUnetwork,代码行数:8,代码来源:test_hier_rx_usrp.py


示例11: checkIfHostsUp

 def checkIfHostsUp(self,hosts):
     self.waitForHostReady(hosts)
     delay(30)
     # Re-check because ssh connect works soon as post-installation occurs. But
     # server is rebooted after post-installation. Assuming the server is up is
     # wrong in these cases. To avoid this we will check again before continuing
     # to add the hosts to cloudstack
     self.waitForHostReady(hosts)
开发者ID:bvbharatk,项目名称:cloudstack-automation,代码行数:8,代码来源:hostImager.py


示例12: refreshHosts

def refreshHosts(cscfg, hypervisor="xen", profile="xen602"):
    """
    Removes cobbler system from previous run. 
    Creates a new system for current run.
    Ipmi boots from PXE - default to Xenserver profile
    """
    for zone in cscfg.zones:
        for pod in zone.pods:
            for cluster in pod.clusters:
                for host in cluster.hosts:
                    hostname = urlparse.urlsplit(host.url).hostname
                    logging.debug("attempting to refresh host %s" % hostname)
                    # revoke certs
                    bash("puppet cert clean %s.%s" % (hostname, DOMAIN))
                    # setup cobbler profiles and systems
                    try:
                        hostmac = macinfo[hostname]["ethernet"]
                        hostip = macinfo[hostname]["address"]
                        bash(
                            "cobbler system remove \
                             --name=%s"
                            % (hostname)
                        )
                        bash(
                            "cobbler system add --name=%s --hostname=%s \
                             --mac-address=%s --netboot-enabled=yes \
                             --enable-gpxe=no --profile=%s --server=%s \
                             --gateway=%s"
                            % (
                                hostname,
                                hostname,
                                hostmac,
                                profile,
                                cobblerHomeResolve(hostip, param="cblrgw"),
                                cobblerHomeResolve(hostip),
                            )
                        )

                        bash("cobbler sync")
                    except KeyError:
                        logging.error("No mac found against host %s. Exiting" % hostname)
                        sys.exit(2)
                    # set ipmi to boot from PXE
                    try:
                        ipmi_hostname = ipmiinfo[hostname]
                        logging.debug("found IPMI nic on %s for host %s" % (ipmi_hostname, hostname))
                        bash(
                            "ipmitool -Uroot -P%s -H%s chassis bootdev \
                             pxe"
                            % (IPMI_PASS, ipmi_hostname)
                        )
                        bash("ipmitool -Uroot -P%s -H%s chassis power cycle" % (IPMI_PASS, ipmi_hostname))
                        logging.debug("Sent PXE boot for %s" % ipmi_hostname)
                    except KeyError:
                        logging.error("No ipmi host found against %s. Exiting" % hostname)
                        sys.exit(2)
                    yield hostname
    delay(5)  # to begin pxe boot process or wait returns immediately
开发者ID:iselu,项目名称:cloud-autodeploy,代码行数:58,代码来源:configure.py


示例13: main

def main():
	compass = i2c_hmc5883l.i2c_hmc5883l(4)	# 4 is because /dev/i2c-4 is the GPIO I2C bus on the odroid
	compass.setContinuousMode()
	compass.setDeclination(0, 6)
	
	# Get data from compass 10 times and print
	for i in range(10):
		print(compass)
		time.delay(1)
开发者ID:Harry73,项目名称:IGVC2017,代码行数:9,代码来源:run_compass.py


示例14: dispatch

 def dispatch(self, request):
     self.publisher.publish(request.serialize(), 'Dispatcher received request')
     self.func_list.append(request.function)
     if request.function == jsonrpc.SERVER_READY:
         return request.respond(True)
     elif request.function == 'long_test':
         time.delay(5)
         return request.respond(True)
     else:
         return request.respond(self.default_ret)
开发者ID:ghbjimmy,项目名称:NewTestPlatform,代码行数:10,代码来源:testengine.py


示例15: getCSCode

def getCSCode(inp_dict):
    path = inp_dict['path'] 
    os.chdir(path)
    os.system("killall -9 java")
    print "*******************************Restarting Management Server****************************************"  
    delay(30)

    if (str(inp_dict['noSimulator']).lower()=="true"):
        os.system("mvn -pl :cloud-client-ui jetty:run &")
    else:
       os.system("mvn -Dsimulator -pl client jetty:run &")
开发者ID:bvbharatk,项目名称:cloudstack-automation,代码行数:11,代码来源:restartMgmtServer.py


示例16: main

def main():
    """Funcion principal del juego"""

    can_continue = True
    suma_jugador = 0
    suma_maquina = 0

    print SALUDO # Saludamos al usuario

    cards = barajar_cartas() # Barajamos las cartas

    print PLAYER_TIME

    while can_continue:

        card = dar_carta(cards) # Preguntamos al usuario si quiere carta

        if card:
            print "It is the card %s and costs %.1f" %(str(card), CARTAS[card])
            suma_jugador += CARTAS[card] # Sumamos los puntos de la carta tocada.
            
            if suma_jugador > 7.5: # Si se pasa del limite, el usuario pierde y acaba el juego.
                print GAME_OVER
                return
                
        else: #Si no quiere carta, turno de la maquina
            can_continue = False

    can_continue = True

    # Turno de la maquina
    print MACHINE_TIME

    while can_continue:

        card = cards.pop() # Cogemos carta

        if (suma_maquina + CARTAS[card] > 7.5):
            can_continue = False # Si se pasa del limite, la maquina para de jugar
        else:
            print "The machine takes the card %s that it costs %.1f" %(str(card), CARTAS[card])
            suma_maquina += CARTAS[card]
        
        delay(2) # Esperamos 2 segundos para que escoja de nuevo otra carta la maquina

    # Anunciamos el ganador
    print WINNER_TIME
    print "And the winner is...",
    if (suma_jugador > suma_maquina):
        print "the player 1 with %.1f points vs %.1f points of the machine!!" %(suma_jugador, suma_maquina)
    elif (suma_jugador == suma_maquina):
        print "That was a draw!!! No winner this time, more lucky next time :) "
    else:
        print "the machine with %.1f points vs %.1f points of the player 1!!" %(suma_maquina, suma_jugador)
开发者ID:hermetico,项目名称:IA,代码行数:54,代码来源:setimig.py


示例17: wait_for_page

 def wait_for_page(self,timeout_seconds=45):
     """
     Include start page to confirm change started ??
     """
     end                     =   TIME() + timeout_seconds
     delay(                      1)
     while TIME()<end:
         status              =   self.window.execute_script("return document.readyState")
         if status=='complete':
             return
         else:
             delay(              2)
开发者ID:sethc23,项目名称:seamless_yelp_scraping,代码行数:12,代码来源:webpage_scrape.py


示例18: isPortListening

 def isPortListening(host, port, timeout=120):
     """
     Scans 'host' for a listening service on 'port'
     """
     tn = None
     while timeout != 0:
         try:
             tn = telnetlib.Telnet(host, port, timeout=timeout)
             timeout = 0
         except Exception, e:
             logging.debug("Failed to telnet connect to %s:%s with %s" % (host, port, e))
             delay(5)
             timeout = timeout - 5
开发者ID:vogxn,项目名称:devcloud-ci,代码行数:13,代码来源:bashUtils.py


示例19: isManagementServiceStable

 def isManagementServiceStable(self,ssh=None, timeout=300, interval=5):
    self.logger.info("Waiting for cloudstack-management service to become stable")
    if ssh is None:
       return False
    while timeout != 0:
       cs_status = ''.join(ssh.execute("service cloudstack-management status"))
       self.logger.debug("[-%ds] Cloud Management status: %s"%(timeout, cs_status))
       if cs_status.find('running') > 0:
           pass
       else:
           ssh.execute("killall -9 java; mvn -Dsimulator -pl client jetty:run")
       timeout = timeout - interval
       delay(interval)
开发者ID:bvbharatk,项目名称:cloudstack-automation,代码行数:13,代码来源:hostResource.py


示例20: isManagementServiceStable

def isManagementServiceStable(ssh=None, timeout=300, interval=5):
    logging.info("Waiting for cloudstack-management service to become stable")
    if ssh is None:
        return False
    while timeout != 0:
        cs_status = ''.join(ssh.execute("service cloudstack-management status"))
        logging.debug("[-%ds] Cloud Management status: %s"%(timeout, cs_status))
        if cs_status.find('running') > 0:
            pass
        else:
            ssh.execute("service cloudstack-management restart")
        timeout = timeout - interval
        delay(interval)
开发者ID:Blufe,项目名称:cloudstack,代码行数:13,代码来源:configure.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python time.get_clock_info函数代码示例发布时间:2022-05-27
下一篇:
Python time.ctime函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap