Python schedule 模块,clear() 实例源码

我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用schedule.clear()

项目:crickbuzz_cricket_score    作者:LinuxTerminali    | 项目源码 | 文件源码
def recent_diliveris():
    # print(soup)
    recent_balls = soup.find_all('div', attrs={'class': 'cb-col cb-col-100 cb-font-12 cb-text-gray cb-min-rcnt'})
    # print(recent_balls)
    # print(soup)
    # recent_balls[0].span.clear()
    # print(recent_balls[0].get_text())
    try:
        recent_ball = recent_balls[0].text
        recent_ball = recent_ball.strip('Recent: ')
    except IndexError:
        recent_ball = ' '
    return recent_ball



#method to get crrent batsman and bowler
项目:core    作者:distribrewed    | 项目源码 | 文件源码
def start_worker(self, schedule_id, worker_schedule):
        self.schedule_id = schedule_id
        schedule.clear()
        self._setup_worker_schedule(worker_schedule)
        global scheduler_running
        global scheduler_done
        scheduler_done = False
        if not scheduler_running:
            scheduler_running = True
            self.schedule_thread = Thread(target=run_scheduler)
            self.schedule_thread.start()
        self.resume_worker()
        self._send_event_to_master('on_start')
项目:crickbuzz_cricket_score    作者:LinuxTerminali    | 项目源码 | 文件源码
def cancel_scedule():
    schedule.clear('score_updates')

# a method containing ascii art
项目:thermostat_ita    作者:jpnos26    | 项目源码 | 文件源码
def reloadSchedule():
    with scheduleLock:
        schedule.clear()

        activeSched = None

        with thermostatLock:
            thermoSched = JsonStore( "thermostat_schedule.json" )
            if holdControl != "down" :
                if heatControl.state == "down":
                    activeSched = thermoSched[ "heat" ]  
                    log( LOG_LEVEL_INFO, CHILD_DEVICE_SCHEDULER, MSG_SUBTYPE_CUSTOM + "/load", "heat" )
            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                                                 #
#                                                                            #
##############################################################################

##############################################################################
#      encoding: UTF-8                                                       #
# Form based authentication for CherryPy. Requires the                       #
# Session tool to be loaded.                                                 #
##############################################################################
项目:RaspberryPiThermostat    作者:scottpav    | 项目源码 | 文件源码
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                                                 #
#                                                                            #
##############################################################################
项目:kibitzr    作者:kibitzr    | 项目源码 | 文件源码
def schedule_checks(checkers):
    schedule.clear()
    for checker in checkers:
        conf = checker.conf
        period = conf["period"]
        logger.info(
            "Scheduling checks for %r every %r seconds",
            conf["name"],
            period,
        )
        schedule.every(period).seconds.do(checker.check)
项目:pseudo-channel    作者:justinemter    | 项目源码 | 文件源码
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)
项目:OpenFinData    作者:FedorArbuzovHSE    | 项目源码 | 文件源码
def delete_cache(first_time='0:05', second_time='1:05'):
    try:
        # Deleting folders from 1am to 23pm at 24.05 o'clock
        schedule.every().day.at(first_time).do(delete_unnecessary_folders23)
        # Deleting folders from which we created during 24th hour at 1.05 o'clock
        schedule.every().day.at(second_time).do(delete_unnecessary_folders24)

        while 1:
            schedule.run_pending()
            sleep(50)
    except Exception as e:
        print("{0} Error: {1}".format(strftime("%Y-%m-%d %H:%M:%S", gmtime()), e))
        schedule.clear()
        print('Notification: Timer is reset')
        delete_cache()