
23 Mar
2015
23 Mar
'15
8:31 a.m.
+ def _update_host_info(self, host_info): + if not isinstance(host_info, dict): + return + + host_info['cpus'] = psutil._psplatform.get_num_cpus() + host_info['memory'] = psutil.phymem_usage().total +
_get_host_info() runs once on __init__() and then set the self.host_info value
So I don't think we need the above function as we can update the self.host_info directly on lookup()
You prefer these codes: host_info['cpus'] = psutil._psplatform.get_num_cpus() host_info['memory'] = psutil.phymem_usage().total placed in lookup() only? So, in_get_host_info() I'd have those fields (cpus, memory) initialized like: res['cpus'] = 0 res['memory'] = 0L What do you think? Thank you