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


Python time.delay函数代码示例

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


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


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