本文整理汇总了Python中schedule.Schedule.add方法的典型用法代码示例。如果您正苦于以下问题:Python Schedule.add方法的具体用法?Python Schedule.add怎么用?Python Schedule.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类schedule.Schedule
的用法示例。
在下文中一共展示了Schedule.add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_schedule
# 需要导入模块: from schedule import Schedule [as 别名]
# 或者: from schedule.Schedule import add [as 别名]
def get_schedule(self, activity_list):
S = Schedule(self.problem)
self.al_iter = activity_list.__iter__()
for i in xrange(self.problem.num_activities):
activity = self._select_activity()
precedence_feasible_start = S.earliest_precedence_start(activity)
real_start = self._compute_real_start(S, activity, precedence_feasible_start)
S.add(activity, real_start, force=True)
return S
示例2: Manager
# 需要导入模块: from schedule import Schedule [as 别名]
# 或者: from schedule.Schedule import add [as 别名]
class Manager(Object, threading.Thread):
# INIT -------------------------------------------------------------
def __init__(self):
threading.Thread.__init__(self)
Object.__init__(self)
# OBJECTS
self.scheduler = Schedule() # The schedule object
self.series = [] # List of series
# LOAD -------------------------------------------------------------
# Loads schedule from a file (schedule_settings.py).
def load(self):
# Add blocks
for block in schedule_settings.BLOCKS:
# Calculate the day
start_day = str(getDate(block[1].split()[0]))
end_day = str(getDate(block[2].split()[0]))
self.scheduler.add(start_day + " " + block[1].split()[1], end_day + " " + block[2].split()[1], "%j %H:%M", block[0])
# Start the scheduler (if it isn't already)
if not self.scheduler.running:
self.scheduler.start()
# NEXT -------------------------------------------------------------
# Picks the next show (will still obey schedule times, even if
# something is skipped)
def next(self):
pass
# BACK -------------------------------------------------------------
# Picks the previous show played.
def back(self):
pass
# THREADING --------------------------------------------------------
def run(self):
while self.scheduler.running:
time.sleep(settings.MANAGER_SLEEP)