@@ -24,7 +24,7 @@ def __check_expression(name, value, expected, expression):
2424
2525 # Verifies that an energybridge executable is present, and can be executed without error
2626 @staticmethod
27- def __validate_energibridge (measure_enabled , eb_path ):
27+ def __validate_energibridge (measure_enabled , eb_path , eb_logfile ):
2828 # Do nothing if its not enabled
2929 if not measure_enabled :
3030 return
@@ -36,7 +36,13 @@ def __validate_energibridge(measure_enabled, eb_path):
3636 ConfigValidator .error_found = True
3737 ConfigValidator \
3838 .config_values_or_exception_dict ["EnergiBridge" ] = "EnergiBridge executable was not present or valid"
39-
39+
40+ if eb_logfile \
41+ and not is_path_exists_or_creatable_portable (eb_logfile ):
42+ ConfigValidator .error_found = True
43+ ConfigValidator \
44+ .config_values_or_exception_dict ["EnergiBridge" ] = f"EnergiBridge logfile ({ eb_logfile } ) was not a valid path"
45+
4046 # Test run to see if energibridge works
4147 try :
4248 eb_args = [eb_path , "--summary" , "-o" , "/dev/null" , "--" , "sleep" , "0.5" ]
@@ -70,13 +76,17 @@ def validate_config(config: RunnerConfig):
7076 if '~' in str (config .experiment_path ):
7177 config .experiment_path = config .experiment_path .expanduser ()
7278
73- # Set defaults to support configs without the self_measure parameter
79+ # Set defaults to support configs without the self_measure parameter and friends
7480 if not hasattr (config , "self_measure" ):
7581 config .self_measure = False
7682
77- if config .self_measure and not hasattr (config , "self_measure_bin" ):
78- config .self_measure_bin = "/usr/local/bin/energibridge" # This is spesific to linux, might work for osx as well
79-
83+ if config .self_measure :
84+ if not hasattr (config , "self_measure_bin" ):
85+ config .self_measure_bin = "/usr/local/bin/energibridge" # This is spesific to linux, might work for osx as well
86+
87+ if not hasattr (config , "self_measure_logfile" ):
88+ config .self_measure_logfile = None
89+
8090 # Convert class to dictionary with utility method
8191 ConfigValidator .config_values_or_exception_dict = class_to_dict (config )
8292
@@ -102,7 +112,10 @@ def validate_config(config: RunnerConfig):
102112 (lambda a , b : is_path_exists_or_creatable_portable (a ))
103113 )
104114
105- ConfigValidator .__validate_energibridge (config .self_measure , config .self_measure_bin )
115+ ConfigValidator .__validate_energibridge (config .self_measure ,
116+ config .self_measure_bin ,
117+ config .self_measure_logfile
118+ )
106119
107120 # Display config in user-friendly manner, including potential errors found
108121 print (
0 commit comments