本文整理汇总了Python中lxml.objectify.Element.cron_definition方法的典型用法代码示例。如果您正苦于以下问题:Python Element.cron_definition方法的具体用法?Python Element.cron_definition怎么用?Python Element.cron_definition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lxml.objectify.Element
的用法示例。
在下文中一共展示了Element.cron_definition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle
# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import cron_definition [as 别名]
def handle(self, *args, **kwargs):
with closing(self.server.odb.session()) as session:
params = _get_params(kwargs.get('payload'), ['cluster_id'], 'data.')
definition_list = Element('definition_list')
definitions = job_list(session, params['cluster_id'])
for definition in definitions:
definition_elem = Element('definition')
definition_elem.id = definition.id
definition_elem.name = definition.name
definition_elem.is_active = definition.is_active
definition_elem.job_type = definition.job_type
definition_elem.start_date = definition.start_date
definition_elem.extra = definition.extra.decode('utf-8')
definition_elem.service_id = definition.service_id
definition_elem.service_name = definition.service_name.decode('utf-8')
definition_elem.weeks = definition.weeks if definition.weeks else ''
definition_elem.days = definition.days if definition.days else ''
definition_elem.hours = definition.hours if definition.hours else ''
definition_elem.minutes = definition.minutes if definition.minutes else ''
definition_elem.seconds = definition.seconds if definition.seconds else ''
definition_elem.repeats = definition.repeats if definition.repeats else ''
definition_elem.cron_definition = (definition.cron_definition.decode('utf-8') if
definition.cron_definition else '')
definition_list.append(definition_elem)
return ZATO_OK, etree.tostring(definition_list)
示例2: Element
# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import cron_definition [as 别名]
except Exception, e:
session.rollback()
msg = 'Could not complete the request, e=[{e}]'.format(e=format_exc(e))
logger.error(msg)
raise
else:
job_elem = Element('job')
if action == 'create':
job_elem.id = job.id
if job_type == 'cron_style':
# Needs to be returned because we might've been performing
# a substitution like changing '@hourly' into '0 * * * *'.
job_elem.cron_definition = cs_job.cron_definition
out = etree.tostring(job_elem)
return ZATO_OK, out
class GetList(AdminService):
""" Returns a list of all jobs defined in the SingletonServer's scheduler.
"""
def handle(self, *args, **kwargs):
with closing(self.server.odb.session()) as session:
params = _get_params(kwargs.get('payload'), ['cluster_id'], 'data.')
definition_list = Element('definition_list')
definitions = job_list(session, params['cluster_id'])