Commit 00683cea authored by Mario Hock's avatar Mario Hock
Browse files

[Re-]read environment-file when logging starts

When autologging is used, one can change the environment-file between runs.
parent f40e81b5
...@@ -246,20 +246,13 @@ if __name__ == "__main__": ...@@ -246,20 +246,13 @@ if __name__ == "__main__":
assert( set(nics).issuperset(args.nics) ) assert( set(nics).issuperset(args.nics) )
monitored_nics = args.nics monitored_nics = args.nics
## Read environment file (if given).
if ( args.environment ):
with open(args.environment) as f:
environment = json.load(f)
else:
environment = None
## --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, helpers.get_sysinfo(), environment, logging_manager = LoggingManager( psutil.NUM_CPUS, monitored_nics, helpers.get_sysinfo(), args.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()
......
...@@ -329,9 +329,17 @@ class LoggingManager: ...@@ -329,9 +329,17 @@ class LoggingManager:
if ( self.watch_experiment ): if ( self.watch_experiment ):
self.auto_comment = self._find_cmd_line_of(self.watch_experiment) self.auto_comment = self._find_cmd_line_of(self.watch_experiment)
## Read environment file (if given).
if ( self.environment ):
with open(self.environment) as f:
environment = json.load(f)
else:
environment = None
# 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.system_info, self.environment, self.system_info, 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