本文整理汇总了Python中job.Job.setExecution方法的典型用法代码示例。如果您正苦于以下问题:Python Job.setExecution方法的具体用法?Python Job.setExecution怎么用?Python Job.setExecution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类job.Job
的用法示例。
在下文中一共展示了Job.setExecution方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: endElement
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import setExecution [as 别名]
def endElement(self, name):
attributes = self.attributesList.pop()
if name == "job":
# build job
job = Job(self.recipeRef)
executionType = attributes[u"type"]
executionTime = util.parseTime(attributes[u"time"])
executionDay = ""
if (not executionType == "daily"):
executionDay = attributes[u"day"]
job.setExecution(executionType, executionTime, executionDay)
self.jobs.append(job)
if name == "recipeRef":
self.recipeRef = self.buffer
self.buffer = ""
示例2: testDaily
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import setExecution [as 别名]
def testDaily():
print "TEST Daily"
job = Job("testRef")
now = datetime(2014, 2, 2, 10)
# execute later
addition = timedelta(hours=1)
job.setExecution("daily", (now + addition).time())
calculateNextExecution(job, now)
assert datetime(2014, 2, 2, 11) == job.nextExecution, "Calculated wrong execution date: %s"\
% str(job.nextExecution)
# execute tomorrow
addition = timedelta(hours=-1)
job.setExecution("daily", (now + addition).time())
calculateNextExecution(job, now)
assert datetime(2014, 2, 3, 9) == job.nextExecution, "Calculated wrong execution date: %s"\
% str(job.nextExecution)
print "OK"