Commit e0d5f0cf authored by Mario Hock's avatar Mario Hock
Browse files

Store whole sysinfo instead of just the hostname

parent 8614f529
...@@ -228,20 +228,13 @@ if __name__ == "__main__": ...@@ -228,20 +228,13 @@ if __name__ == "__main__":
else: else:
environment = None environment = None
## Get hostname (for display and logging).
osdetails = tuple(os.uname())
ostype = osdetails[0]
hostname = osdetails[1]
## --autologging implies --logging ## --autologging implies --logging
if ( args.autologging ): if ( args.autologging ):
args.logging = True args.logging = True
## Logging ## Logging
logging_manager = LoggingManager( psutil.NUM_CPUS, monitored_nics, hostname, environment, logging_manager = LoggingManager( psutil.NUM_CPUS, monitored_nics, helpers.get_sysinfo(), environment,
args.comment, args.path, args.autologging, args.watch ) args.comment, args.path, args.autologging, args.watch )
if args.logging: if args.logging:
logging_manager.enable_measurement_logger() logging_manager.enable_measurement_logger()
......
...@@ -163,3 +163,16 @@ def split_proprtionally(text, weights, size=0, fill=" "): ...@@ -163,3 +163,16 @@ def split_proprtionally(text, weights, size=0, fill=" "):
last_pos += pos last_pos += pos
return ret return ret
def get_sysinfo():
#uname = os.uname()
#input_fields = ("sysname", "nodename", "release", "version", "machine")
output_fields = ("sysname", "hostname", "kernel", "version", "machine")
ret = dict()
for out_field, value in zip(output_fields, os.uname()):
ret[out_field] = value
return ret
...@@ -26,7 +26,7 @@ class MeasurementLogger: ...@@ -26,7 +26,7 @@ class MeasurementLogger:
## Initialization ## ## Initialization ##
def __init__(self, num_cpus, nics, begin, hostname, environment, comment, filename): def __init__(self, num_cpus, nics, begin, system_info, environment, comment, filename):
## Attributes ## Attributes
self.num_cpus = num_cpus self.num_cpus = num_cpus
self.nics = nics self.nics = nics
...@@ -43,7 +43,7 @@ class MeasurementLogger: ...@@ -43,7 +43,7 @@ class MeasurementLogger:
self.class_defs.values(), self.class_defs.values(),
self.type_string, self.type_string,
begin, begin,
hostname, system_info,
environment, environment,
comment) comment)
...@@ -94,7 +94,7 @@ class MeasurementLogger: ...@@ -94,7 +94,7 @@ class MeasurementLogger:
## TODO Move this outside the class? ## TODO Move this outside the class?
def _create_json_header(self, class_names, class_defs, type, begin, hostname, environment, comment): def _create_json_header(self, class_names, class_defs, type, begin, system_info, environment, comment):
top_level = dict() top_level = dict()
general = dict() general = dict()
class_definitions = dict() class_definitions = dict()
...@@ -104,7 +104,7 @@ class MeasurementLogger: ...@@ -104,7 +104,7 @@ class MeasurementLogger:
general["Type"] = type general["Type"] = type
general["Comment"] = comment general["Comment"] = comment
general["Date"] = begin general["Date"] = begin
general["Hostname"] = hostname general["SystemInfo"] = system_info
general["Environment"] = environment general["Environment"] = environment
#general["End"] = 0 ## TODO ... can't be written at the beginning of the file!! #general["End"] = 0 ## TODO ... can't be written at the beginning of the file!!
#general["Duration"] = 0 ## TODO #general["Duration"] = 0 ## TODO
...@@ -252,13 +252,14 @@ class CNLFileWriter: ...@@ -252,13 +252,14 @@ class CNLFileWriter:
class LoggingManager: class LoggingManager:
def __init__(self, num_cpus, nics, hostname, environment, comment, path, autologging, watch_experiment): def __init__(self, num_cpus, nics, system_info, environment, comment, path, autologging, watch_experiment):
self.num_cpus = num_cpus self.num_cpus = num_cpus
self.nics = nics self.nics = nics
self.comment = comment self.comment = comment
self.auto_comment = None self.auto_comment = None
self.path = path self.path = path
self.hostname = hostname self.system_info = system_info
self.hostname = system_info["hostname"]
self.environment = environment self.environment = environment
self.watch_experiment = watch_experiment self.watch_experiment = watch_experiment
...@@ -312,7 +313,7 @@ class LoggingManager: ...@@ -312,7 +313,7 @@ class LoggingManager:
# Create Logger. # Create Logger.
self.measurement_logger = MeasurementLogger(self.num_cpus, self.nics, [date,t], self.measurement_logger = MeasurementLogger(self.num_cpus, self.nics, [date,t],
self.hostname, self.environment, self.system_info, self.environment,
self.auto_comment if self.auto_comment else self.comment, self.auto_comment if self.auto_comment else self.comment,
filename) filename)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment