本文整理汇总了Python中pinball.workflow.name.Name.get_workflow_schedule_token_name方法的典型用法代码示例。如果您正苦于以下问题:Python Name.get_workflow_schedule_token_name方法的具体用法?Python Name.get_workflow_schedule_token_name怎么用?Python Name.get_workflow_schedule_token_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pinball.workflow.name.Name
的用法示例。
在下文中一共展示了Name.get_workflow_schedule_token_name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_schedule
# 需要导入模块: from pinball.workflow.name import Name [as 别名]
# 或者: from pinball.workflow.name.Name import get_workflow_schedule_token_name [as 别名]
def get_schedule(self, workflow):
"""Get workflow schedule data from the store.
Args:
workflow: The name of the workflow whose schedule should be
retrieved.
Returns:
The workflow schedule or None if it was not found.
"""
name = Name(workflow=workflow)
schedule_token_name = name.get_workflow_schedule_token_name()
tokens = self._store.read_tokens(name_prefix=schedule_token_name)
if tokens:
for token in tokens:
if token.name == schedule_token_name:
schedule = pickle.loads(token.data)
overrun_policy_help = OverrunPolicy.get_help(
schedule.overrun_policy)
return WorkflowScheduleData(
next_run_time=schedule.next_run_time,
recurrence_seconds=schedule.recurrence_seconds,
overrun_policy=schedule.overrun_policy,
overrun_policy_help=overrun_policy_help,
workflow=schedule.workflow,
parser_params=schedule.parser_params,
emails=schedule.emails,
max_running_instances=schedule.max_running_instances)
return None
示例2: _get_schedule_token
# 需要导入模块: from pinball.workflow.name import Name [as 别名]
# 或者: from pinball.workflow.name.Name import get_workflow_schedule_token_name [as 别名]
def _get_schedule_token():
name = Name(workflow='workflow_0')
now = int(time.time())
token = Token(name=name.get_workflow_schedule_token_name(),
owner='some_owner',
expirationTime=now - 10)
schedule = WorkflowSchedule(next_run_time=now - 10,
recurrence_seconds=10,
workflow='workflow_0')
token.data = pickle.dumps(schedule)
return token
示例3: _generate_schedule_tokens
# 需要导入模块: from pinball.workflow.name import Name [as 别名]
# 或者: from pinball.workflow.name.Name import get_workflow_schedule_token_name [as 别名]
def _generate_schedule_tokens(workflows):
result = []
for w in range(workflows):
next_run_time = time.time() + (365 + w) * 24 * 60 * 60
recurrence = min(365 * 24 * 60 * 60, 60 ** w)
workflow = 'workflow_%d' % w
schedule = WorkflowSchedule(next_run_time,
recurrence_seconds=recurrence,
overrun_policy=w % 4, workflow=workflow)
name = Name(workflow=workflow)
result.append(Token(name=name.get_workflow_schedule_token_name(),
version=100000000 * w,
owner='some_owner',
expirationTime=next_run_time,
data=pickle.dumps(schedule)))
return result