def _generate_status(self): ret = { "author": get_user(), "generated": get_time_str(), "gofed_version": VERSION, "hostname": get_hostname(), "topology": [] } system = System(self.get_config(), self.get_system_json_path()) for service_name in system.get_services_list(): try: registry_response = system.get_service_location(service_name) except Exception as e: log.warning("Encountered error while querying for service '%s', skipping this service ('%s')" % (service_name, str(e))) for response in registry_response: ret['topology'].append({ 'service': service_name, 'host': response[0], 'port': response[1], 'type': 'computational' if system.is_computational(service_name) else 'storage' }) ret['topology'].append({ 'type': 'registry', 'host': system.get_registry_host(), 'port': system.get_registry_port() }) print dict2json(ret)
def _make_header(self, services): ret = {} ret['gofed_version'] = VERSION ret['author'] = get_user() ret['hostname'] = get_hostname() ret['generated'] = get_time_str() ret['services'] = {} ret['services']['computational'] = services['computational'] ret['services']['storages'] = services['storages'] ret['git_head'] = get_githead() return ret
def _generate_status(self): ret = { "author": get_user(), "generated": get_time_str(), "gofed_version": VERSION, "hostname": get_hostname(), "topology": [] } system = System(self.get_config(), self.get_system_json_path()) for service_name in system.get_services_list(): try: registry_response = system.get_service_location(service_name) except Exception as e: log.warning( "Encountered error while querying for service '%s', skipping this service ('%s')" % (service_name, str(e))) for response in registry_response: ret['topology'].append({ 'service': service_name, 'host': response[0], 'port': response[1], 'type': 'computational' if system.is_computational(service_name) else 'storage' }) ret['topology'].append({ 'type': 'registry', 'host': system.get_registry_host(), 'port': system.get_registry_port() }) print dict2json(ret)
def log_service_name(self, name): self._stats['meta']['service'] = name self._stats['meta']['service-version'] = VERSION self._stats['meta']['hostname'] = get_hostname() self._stats['meta']['created'] = int(time.time())