def __init__(self, role, gconfig={}, ** options): assert role in ("work","standby"), "MutexScheduler.__init__参数值错误,role有效值:work、standby!" Scheduler.__init__(self, gconfig, ** options) self.ip = get_ip('eth0') self.uuid = uuid4().hex self.role = role #work:自己没有持有锁就可以获得锁、standby:任何人没有持有锁才可以获得锁 self._logger.info("Scheduler: %s, Role: %s", self.uuid,self.role)
def __init__(self, gconfig={}, **options): Scheduler.__init__(self, gconfig, **options) self.ip = get_ip('eth0') self.uuid = uuid4().hex