ucloud-host can not be started by using hostname
This commit is contained in:
parent
da5a600ccb
commit
e37222c1c7
4 changed files with 40 additions and 18 deletions
|
|
@ -19,8 +19,8 @@ import etcd3
|
|||
def update_heartbeat(host):
|
||||
client = Etcd3Wrapper(*etcd_wrapper_args, **etcd_wrapper_kwargs)
|
||||
host_pool = HostPool(client, HOST_PREFIX)
|
||||
this_host = host_pool.get(host)
|
||||
|
||||
this_host = next(filter(lambda h: h.hostname == host, host_pool.hosts), None)
|
||||
|
||||
while True:
|
||||
this_host.update_heartbeat()
|
||||
host_pool.put(this_host)
|
||||
|
|
@ -78,8 +78,8 @@ def main():
|
|||
heartbeat_updating_process = mp.Process(target=update_heartbeat, args=(args.hostname,))
|
||||
|
||||
host_pool = HostPool(etcd_client, HOST_PREFIX)
|
||||
host = host_pool.get(args.hostname)
|
||||
assert host, "No such host"
|
||||
host = next(filter(lambda h: h.hostname == args.hostname, host_pool.hosts), None)
|
||||
assert host is not None, "No such host"
|
||||
|
||||
try:
|
||||
heartbeat_updating_process.start()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue