<div dir="ltr">got it, thanks.<div><br><div class="gmail_extra"><br><div class="gmail_quote">2018-03-22 0:50 GMT+08:00 Ed Leafe <span dir="ltr"><<a href="mailto:ed@leafe.com" target="_blank">ed@leafe.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mar 21, 2018, at 11:35 AM, 少合冯 <<a href="mailto:lvmxhster@gmail.com">lvmxhster@gmail.com</a>> wrote:<br>
><br>
>> By default, hosts are weighed one by one. You can subclass the BaseWeigher (in nova/weights.py) to weigh all objects at once.<br>
><br>
> Does that means it require call cyborg accelerator one by one?  the pseudo code as follow:<br>
> for host in hosts:<br>
>        accelerator = cyborg.http_get_ accelerator(host)<br>
>        do_weight_by_accelerator<br>
><br>
> Instead of call cyborg accelerators once,  the pseudo code as follow :<br>
> accelerators = cyborg.http_get_ accelerator(hosts)<br>
> for acc in accelerators:<br>
>        do_weight_by_accelerator<br>
<br>
</span>What it means is that if you override the weigh_objects() method of the BaseWeigher class, you can make a single call to Cyborg with a list of all the hosts. That call could then create a list of weights for all the hosts and return that. So if you have 100 hosts, you don’t need to make 100 calls to Cyborg; only 1.<br>
<div class="HOEnZb"><div class="h5"><br>
-- Ed Leafe<br>
<br>
<br>
<br>
<br>
<br>
<br>
______________________________<wbr>______________________________<wbr>______________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.<wbr>openstack.org?subject:<wbr>unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack-dev</a><br>
</div></div></blockquote></div><br></div></div></div>