Exemple #1
0
def add_monthly_schedule(taskname, schedule, callback):
    cancel_schedule(taskname)
   
    timeofday = time.strptime(schedule['timeofday'], "%H%M")
    daysofmonth = map(lambda x: int(x) + 1, schedule['dayofmonth'])
    task = KRON.add_daytime_task(
            schedule_runner,
            taskname,
            None,
            daysofmonth,
            (timeofday.tm_hour, timeofday.tm_min + 1),
            'threaded',
            (callback,taskname,),
            None)

    KRON.tasks[taskname] = task
Exemple #2
0
def add_daily_schedule(taskname, schedule, callback):
    cancel_schedule(taskname)
    
    timeofday = time.strptime(schedule['timeofday'], "%H%M")
    task = KRON.add_daytime_task(
            schedule_runner, # method to run
            taskname, # taskname
            range(1,8), # days of the week
            None, # days of the month
            (timeofday.tm_hour, timeofday.tm_min), # time of the day
            'threaded',
            (callback,taskname,), # args to job method
            None) # kwargs to job method

    KRON.tasks[taskname] = task
    logger.debug("done adding schedule")