def main(args): """ Process arguments """ options = get_parsed_arg_options() script_path = options.script_path warm_ups = options.warmups average_over = options.average_over repetition_range = options.repetition_range warm_up_repetitions = options.warm_up_repetitions hosts = options.hosts print 'I am in main' """ Warm ups """ print 'Start: %s' % (datetime.datetime.now()) for _ in range(1, warm_ups): do_work(warm_up_repetitions, script_path) """ Start benchmarking """ repetition = 10 for _ in range(1, repetition_range): for _ in range(1, average_over): f = open( Configuration.get_benchmark_directory() + '/Monitor_check.txt', 'a') f.write("start processing %s:\n" % (repetition)) do_work(repetition, script_path, hosts) repetition = repetition * 10 print 'END:%s' % (datetime.datetime.now())
def start(self, specID): Logger.logFuncCall([Monitor, self.start]) if (Configuration.useXmlMonitorModel()): {self.__getModelFromXml(specID)} else: {self.__getModelFromScribble(specID, )} pass
def __init__(self): self._config = Configuration() self._sock = None self._player1 = None self._player2 = None self._board = Board() self._new_board = False self.round_sign = Sign.x
def parse_settings_ini(settings_ini_path=Path.CURRENT_DIRECTORY + '/settings.ini'): config = ConfigParser() config.optionxform = str config.read(settings_ini_path) bullet_config = create_bullet_config({ key: config[INIStrings.Sections.BULLET][key] for key in config[INIStrings.Sections.BULLET] }) return Configuration(bullet_config=bullet_config)
def __init__(self): # print('irrigation') # conf_folder =os.environ['conf_irrigation'] # print(conf_folder) self.conf = Configuration() self.create_log() self.log.info( '-----------------------------------------------------------------' ) self.log.info('This is the irrigation module :' + str(datetime.datetime.now())) self.log.info( '-----------------------------------------------------------------' ) self.init_pins() #self.start_irrigation() self.log.info('job done, have a good day') self.play_relay_1() self.play_relay_2() GPIO.cleanup()
def add_book(source: str, target: str, config: Configuration) -> Book: m = StateManager(config.get_connection_string()) ret = m.add_book(source, target) print("Book added successfully") return ret
send_msg = "%s%s to %s;\n" % (data.send_label, str(i), data.receiver) resv_msg = "%s%s from %s;\n" % (data.resv_label, str(i), data.receiver) if data.send_first: f.write(send_msg) f.write(resv_msg) else: f.write(resv_msg) f.write(send_msg) f.flush() f.write(scribble_end) f.close() class TestData: def __init__(self, cid, role, role_capability): self.cid = cid self.role = role self.role_capability = role_capability file_path = Configuration.get_test_directory( ) + '/end-to-end-tests/test-data/FSMInitializationTest.spr' #file_path = "/homes/rn710/workspace/MonitorPrototype/src/test/end-to-end-tests/test-data/FSMInitializationTest.spr" def start(): tests = [1, 10, 1000, 1000] for i in tests: generate_protocol(i, file_path, ParticipantData('Seller'))
def test_log_missing_ip(self): with patch.object(logging.Logger, 'warn', return_value=None) as log: conf = Configuration('nonexistent_file.cfg') conf.server_ip self.assertTrue(log.called)
def test_default_ip(self): conf = Configuration('nonexistent_file.cfg') self.assertEqual(conf.default_server_ip, conf.server_ip)
def __init__(self): self._config = Configuration() self._sock = None self._game = None
""" Uncomment paramiko """ import sys, os, string, threading #import paramiko from common.configuration import Configuration import time import datetime import optparse python_path = Configuration.get_python_path() #benchmark_script_path = os.path.normpath("/homes/rn710/%s/../../" %__file__) + '/end-to-end-tests/scripts/benchmark_logic.py' benchmark_script_path = os.path.normpath( "/homes/rn710/%s/../../" % __file__) + '/end-to-end-tests/scripts/benchmark_big_fsm.py' #benchmark_script_path = os.path.normpath("/homes/rn710/%s/../../" %__file__) + '/end-to-end-tests/scripts/benchmark_msg_size.py' print "file:%s" % (__file__) print benchmark_script_path start_order = ['allice-monitor', 'bob-monitor', 'bob', 'allice'] #start_order= ['bob', 'allice'] def get_commands(mapping, repetition, script_path): commands = [] for key in mapping: cmd = python_path + ' ' + script_path + ' ' + key + ' ' + str( repetition) #cmd = python_path + ' ' + os.path.normpath("%s/../" %__file__) + '/hello.py' commands.append(cmd)
def get_lt_full_name(file_name): return os.path.join(Configuration.get_specs_directory(), file_name)
def __init__(self): self._config = Configuration() self._sock = None self._board = Board() self._display = None self._logger = logging.getLogger(__name__)
def setUp(self): self.path = Configuration.get_specs_directory()
def __init__(self, connection: str): self._connection = connection self._config = Configuration()
for j in range(0, colns): cell = sheet.cell(i, j) cell_name = cellname(i, j) #cell_xf_index = sheet.cell_xf_index(i, j) #print cell_xf_index if cell_name in marking[n]: style = styles[marking[n][cell_name]] # TODO Use matching style defined earlier #print target_sheet target_sheet.write(i, j, label=cell.value, style=style) target_workbook.save(targetFileName) if __name__ == '__main__': config = Configuration('config.ini') # Test on one file #inputFile = "data-test/simple.xls" #markingFile = "data-test/simple-marking.txt" #mess = Mess(config, inputFile) #mess.extractMarkingFromXLS(markingFile) tpl = open_workbook("data/input/marking/template.xls", formatting_info=True, on_demand=True) target_workbook = copy(tpl) target_workbook.save("/tmp/tpl.xls") # Test on one file inputFile = "data-test/simple-blank.xls" markingFile = "data-test/simple-marking.txt"