本文整理汇总了Python中job.Job.node方法的典型用法代码示例。如果您正苦于以下问题:Python Job.node方法的具体用法?Python Job.node怎么用?Python Job.node使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类job.Job
的用法示例。
在下文中一共展示了Job.node方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: buildsaenablejobs
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import node [as 别名]
def buildsaenablejobs(cls,tenant):
context = cls._buildcontext(tenant)
svclist = tenant.services
jobs = []
for svc in svclist:
if svc.name == "vpc":
continue
nodes = svc.nodes
for node in nodes:
job = Job()
job.node = node
job.nodeId = node.stackid
job.setGroup(tenant.id)
job.setName("[%s]%s:(%s)" % (node.vmtype,node.manageip,"SA_Provision"))
job.setNodeFilter(node.manageip)
WF= factory.ServiceFactory.createfactory(svc.name).createWFBuilder("SA_Provision").buildWF(context)
if len(WF) == 0:
logger.info("no need to run job(%s), becasue no work flow" % "[%s]%s:(%s)" % (node.vmtype,node.manageip,"SA_Provision"))
continue
for step in WF:
step.attach(job)
print job.to_xml()
jobs.append(job)
return jobs
示例2: buildmonitorcpejob
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import node [as 别名]
def buildmonitorcpejob(cls,tenant):
ctx = ServiceContext()
config = ctx.getConfigService()
host = config.get("monitorcpe","host")
cmd = config.get("monitorcpe","command")
lockcmd = config.get("monitorcpe","getlock")
releasecmd = config.get("monitorcpe","releaselock")
svclist = tenant.services
for svc in svclist:
if svc.name == "vrouter":
nodes = svc.nodes
for node in nodes:
job = Job()
job.node = node
job.setNodeFilter(host)
job.setGroup(tenant.id)
job.setName("MonitorCPETest")
job.addlocalcommand(lockcmd)
job.addcommand(cmd + " -c 6620e868-e9df-4c8d-8c74-87fe364f7222 -l 10.74.113.116 -r 10.74.113.117 -x 204 -y 205")
job.addcommand(releasecmd)
return job
return None