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


Python schedule.clear方法代码示例

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


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

示例1: __init__

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import clear [as 别名]
def __init__(self, use_Dingtalk=False):
        chrome_options = Options()
        self.__exit_flag = threading.Event()
        self.__exit_flag.clear()
        self.use_Dingtalk = use_Dingtalk
        if config['mute']:
            chrome_options.add_argument('--mute-audio')  # 关闭声音

        if os.path.exists('driver/chrome.exe'):
            chrome_options.binary_location = 'driver/chrome.exe'
        # chrome_options.add_argument('--no-sandbox')#解决DevToolsActivePort文件不存在的报错
        # chrome_options.add_argument('window-size=800x600') #指定浏览器分辨率
        # chrome_options.add_argument('--disable-gpu') #谷歌文档提到需要加上这个属性来规避bug
        # chrome_options.add_argument('--hide-scrollbars') #隐藏滚动条, 应对一些特殊页面
        # chrome_options.add_argument('blink-settings=imagesEnabled=false') #不加载图片, 提升速度
        if config['background_process'] and self.use_Dingtalk:
            chrome_options.add_argument('--headless')  # 浏览器不提供可视化页面. linux下如果系统不支持可视化不加这条会启动失败
        self.driver = webdriver.Chrome('driver/chromedriver.exe', options=chrome_options)
        LOGGER.setLevel(logging.CRITICAL) 
开发者ID:zodiac182,项目名称:autoxuexi,代码行数:21,代码来源:xuexi.py

示例2: go_generate_daily_sched

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import clear [as 别名]
def go_generate_daily_sched():

            """Saving current daily schedule as cached .json"""
            pseudo_channel.save_daily_schedule_as_json()

            schedule.clear('daily-tasks')

            sleep(1)

            try:
                pseudo_channel.generate_daily_schedule()
            except:
                print("----- Recieved error when running generate_daily_schedule()")
            generate_memory_schedule(pseudo_channel.db.get_daily_schedule(), True) 
开发者ID:justinemter,项目名称:pseudo-channel,代码行数:16,代码来源:PseudoChannel.py

示例3: read_new_article

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import clear [as 别名]
def read_new_article(self):
        article_url = 'https://www.xuexi.cn/lgdata/1jscb6pu1n2.json'

        try:
            resp = requests.get(article_url, proxies=config['proxies'] if config['use_proxy'] else {})
        except Exception:
            raise TimeoutError('Timeout')

        resp_list = eval(resp.text)

        self.__exit_flag.clear()

        for link in resp_list:
            try:
                if not read_check(link['itemId'], 'article'):
                    continue

                self.driver.get(link['url'])
                app.log(u'正在学习文章:%s' % link['title'])
                while not self.__exit_flag.isSet():
                    ActionChains(self.driver).key_down(Keys.DOWN).perform()

                    self.driver.execute_script("""
                        (function(){
                            if (document.documentElement.scrollTop + document.documentElement.clientHeight  >= document.documentElement.scrollHeight*0.9){
                                document.title = 'scroll-done';}
                            })();
                            """)
                    if u'scroll-done' in self.driver.title:
                        break
                    else:
                        self.__exit_flag.wait(random.randint(2, 5))
                app.log(u'%s 学习完毕' % link['title'])
                yield True
            except Exception as error:
                logging.debug(error)
                yield False 
开发者ID:zodiac182,项目名称:autoxuexi,代码行数:39,代码来源:xuexi.py

示例4: resume

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import clear [as 别名]
def resume(self):
        self.__exit_flag.clear() 
开发者ID:zodiac182,项目名称:autoxuexi,代码行数:4,代码来源:xuexi.py

示例5: pause

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import clear [as 别名]
def pause(self):
        self.__in_progress.clear()
        self.xx_obj.stop() 
开发者ID:zodiac182,项目名称:autoxuexi,代码行数:5,代码来源:xuexi.py

示例6: quit

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import clear [as 别名]
def quit(self):
        self.__running.clear()
        self.xx_obj.close() 
开发者ID:zodiac182,项目名称:autoxuexi,代码行数:5,代码来源:xuexi.py

示例7: stop_click

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import clear [as 别名]
def stop_click(self):
        schedule.clear()
        self.__monitor_flag.clear()
        self.quit_click()

    # def show_img(self, pil_image):
    #     tk_image = ImageTk.PhotoImage(pil_image)

    #     self.label_img = Label(root, image = tk_image)

    #     self.label_img.grid(row=2, column=0, padx=5, pady=5, columnspan=3, sticky='NSWE') 
开发者ID:zodiac182,项目名称:autoxuexi,代码行数:13,代码来源:xuexi.py

示例8: exit_handler

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import clear [as 别名]
def exit_handler(signum, frame):
    log.info("Received %s, canceling jobs and exiting.", signal.Signals(signum).name)
    schedule.clear()
    exit()


############################################################
# MAIN
############################################################ 
开发者ID:l3uddz,项目名称:traktarr,代码行数:11,代码来源:traktarr.py

示例9: reloadSchedule

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import clear [as 别名]
def reloadSchedule():
	with scheduleLock:
		schedule.clear()

		activeSched = None

		with thermostatLock:
			thermoSched = JsonStore( "thermostat_schedule.json" )
	
			if holdControl.state != "down":
				if heatControl.state == "down":
					activeSched = thermoSched[ "heat" ]  
					log( LOG_LEVEL_INFO, CHILD_DEVICE_SCHEDULER, MSG_SUBTYPE_CUSTOM + "/load", "heat" )
				elif coolControl.state == "down":
					activeSched = thermoSched[ "cool" ]  
					log( LOG_LEVEL_INFO, CHILD_DEVICE_SCHEDULER, MSG_SUBTYPE_CUSTOM + "/load", "cool" )

				if useTestSchedule: 
					activeSched = getTestSchedule()
					log( LOG_LEVEL_INFO, CHILD_DEVICE_SCHEDULER, MSG_SUBTYPE_CUSTOM + "/load", "test" )
					print "Using Test Schedule!!!"
	
		if activeSched != None:
			for day, entries in activeSched.iteritems():
				for i, entry in enumerate( entries ):
					getattr( schedule.every(), day ).at( entry[ 0 ] ).do( setScheduledTemp, entry[ 1 ] )
					log( LOG_LEVEL_DEBUG, CHILD_DEVICE_SCHEDULER, MSG_SUBTYPE_TEXT, "Set " + day + ", at: " + entry[ 0 ] + " = " + str( entry[ 1 ] ) + scaleUnits )


##############################################################################
#                                                                            #
#       Web Server Interface                                                 #
#                                                                            #
############################################################################## 
开发者ID:chaeron,项目名称:thermostat,代码行数:36,代码来源:thermostat.py

示例10: scheduleRechecking

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import clear [as 别名]
def scheduleRechecking():
    """ Schedules Rechecking every 30 mins incase of pending tasks or errors """
    schedule.clear("daily-task")
    schedule.every(30).minutes.do(scheduleAllSpiders).tag("recheck-task") 
开发者ID:vipulgupta2048,项目名称:scrape,代码行数:6,代码来源:scheduler.py

示例11: scheduler

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import clear [as 别名]
def scheduler(dummy,state):
  import time
  import sys
  import schedule
  from datetime import datetime

  sys.stdout = open("scheduler.log", "a", buffering=0)
  sys.stderr = open("scheduler.err.log", "a", buffering=0)

  print "Starting scheduler thread ..."

  last_wake = 0
  last_sleep = 0
  last_sched_switch = 0

  while True:

    if last_wake != state['wake_time'] or last_sleep != state['sleep_time'] or last_sched_switch != state['sched_enabled']:
      schedule.clear()

      if state['sched_enabled'] == True:
        schedule.every().day.at(state['sleep_time']).do(gotosleep,1,state)
        schedule.every().day.at(state['wake_time']).do(wakeup,1,state)

        nowtm = float(datetime.now().hour) + float(datetime.now().minute)/60.
        sleeptm = state['sleep_time'].split(":")
        sleeptm = float(sleeptm[0]) + float(sleeptm[1])/60.
        waketm = state['wake_time'].split(":")
        waketm = float(waketm[0]) + float(waketm[1])/60.

        if waketm < sleeptm:
          if nowtm >= waketm and nowtm < sleeptm:
            wakeup(1,state)
          else:
            gotosleep(1,state)
        elif waketm > sleeptm:
          if nowtm < waketm and nowtm >= sleeptm:
            gotosleep(1,state)
          else:
            wakeup(1,state)

      else:
        wakeup(1,state)

    last_wake = state['wake_time']
    last_sleep = state['sleep_time']
    last_sched_switch = state['sched_enabled']

    schedule.run_pending()

    time.sleep(1) 
开发者ID:brycesub,项目名称:silvia-pi,代码行数:53,代码来源:silvia-pi.py

示例12: list_jobs

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import clear [as 别名]
def list_jobs():
    """List jobs in a user-friends manner
    
    This method should only be used when the script is not being used as a service.
    
    """

    # Clear the console
    os.system('clear')

    # Get Current Time
    curr_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    
    # Print Header
    print("++++++++ Scrapyd Scheduler (thisisayush) ++++++++")
    print("================= "+curr_time+" =================")
    print(" [ CHECK LOG FILE FOR ERRORS ] [PID: " + str(os.getpid()) + "]")
    print("- Running Schedules: (Updated Every 1 minute)")

    # Print Current Schedules
    print(schedule.jobs)

    # Start Printing Schedules on Scrapyd Server
    print("- Running Schedules on Server: ")
    try:
        r = requests.get(api_url + 'listprojects.json')
        projects = r.json()

        for project in projects['projects']:
            print(" === "+project+" ===")
            r = requests.get(api_url + 'listjobs.json', params = { 'project':project })
            jobs = r.json()
            print("+ Pending Jobs:")
            for pending_jobs in jobs['pending']:
                print(" |_ "+pending_jobs['spider']+" ("+ pending_jobs['id']+")")

            print("+ Completed Jobs:")
            for completed_jobs in jobs['finished']:
                print(" |_ "+completed_jobs['spider']+" ("+ completed_jobs['id']+") ")
                print("      START: "+completed_jobs['start_time']+" END: "+completed_jobs['end_time'])

            print("+ Running Jobs:")
            for running_jobs in jobs['running']:
                print(" |_ "+running_jobs['spider']+" ("+running_jobs['id']+") START: "+running_jobs['start_time'])
    except Exception as e:
        logger.error(__name__ + " [UNHANDLED] " + str(e))
        print("Error:" +str(e)) 
开发者ID:vipulgupta2048,项目名称:scrape,代码行数:49,代码来源:scheduler.py


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