本文整理汇总了Python中API.getWorkers方法的典型用法代码示例。如果您正苦于以下问题:Python API.getWorkers方法的具体用法?Python API.getWorkers怎么用?Python API.getWorkers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类API
的用法示例。
在下文中一共展示了API.getWorkers方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkWorkerHeartbeat
# 需要导入模块: import API [as 别名]
# 或者: from API import getWorkers [as 别名]
def checkWorkerHeartbeat(events):
for worker in API.getWorkers():
if (datetime.now() - worker.heartbeat) > WORKER_HEARTBEAT_TIMEOUT:
for schedule in API.getSchedules(worker):
schedule.worker = API.getNextWorker()
API.destroyWorker(worker)
events.enter(WORKER_HEARTBEAT_TIMEOUT.total_seconds(), 1, checkWorkerHeartbeat, (events,))
示例2: printWorkerStatus
# 需要导入模块: import API [as 别名]
# 或者: from API import getWorkers [as 别名]
def printWorkerStatus(w):
for worker in API.getWorkers():
if (w == worker):
debug_status("worker %d is up." % w.id)
debug_status("worker %d is down")
示例3: printAllWorkerTask
# 需要导入模块: import API [as 别名]
# 或者: from API import getWorkers [as 别名]
def printAllWorkerTask():
for w in API.getWorkers():
printWorkerTask(w)
示例4: printAllWorkerHeartBeat
# 需要导入模块: import API [as 别名]
# 或者: from API import getWorkers [as 别名]
def printAllWorkerHeartBeat():
for w in API.getWorkers():
printWorkerHeartBeat(w)
示例5: printAllUpWorkers
# 需要导入模块: import API [as 别名]
# 或者: from API import getWorkers [as 别名]
def printAllUpWorkers():
L = len(API.getWorkers())
if (L == 1):
debug_status("1 worker is up")
else:
debug_status("%d workers are up" % L)