def __send_const(self, update, context, text_id): if not self.__check_whitelist(update): return if text_id not in strings.keys(): logging.error("{} is not in strings.json".format(text_id)) return try: update.message.reply_text(strings[text_id], parse_mode=ParseMode.HTML) except Exception as e: logging.error("Error in __send_const: {}".format(str(e))) util.log_message(update)
def _become_a_slave(self): self._logger.info("Trying to become a SLAVE") if self._ctx.this_node.role == "MASTER": self._stop_master_workers() self._ctx.this_node.role = "SLAVE" if self._ctx.master_list: self._assign_master(self._ctx.master_list[0]) else: util.log_message("Unable to set a master for the node, master list empty", sys.exc_info()) self.shutdown() self._slave_loop(self._ctx.node_list)
def check_av(i_config, i_interleaving): global total_count global failed_count global failed_tests global passed_count f = open('violations.out', 'r') file_line = f.readline() f.close() total_count = total_count + 1 output_res = 0 if "Atomicity violation detected" in file_line: output_res = 1 if av_result[i_config] == output_res: util.log_message("*** TEST PASSED ***") passed_count = passed_count + 1 else: util.log_message("*** TEST FAILED ***") failed_count = failed_count + 1 f_test = [] f_test.append(str(configs[i_config])) f_test.append(str(i_interleaving)) failed_tests.append(f_test) if av_result[i_config] == 1 and output_res == 0: util.log_message( "Test has an Atomicty Violation but was not reported by tool") else: util.log_message( "Test has no Atomicty Violation but tool reported atomicity violation" )
def __send_plot(self, update: Update, context: CallbackContext, plot_type: str) -> None: """ Sendet einen plot als Antwort auf eine Nachricht. :param update: Nachrichtenupdate :param context: Nachrichtencontext :param plot_type: art des Plots gemäß der Klasse Plotter """ if not self.__check_whitelist(update): return plot_path = self.plot_service.get_plot(plot_type) if plot_path is not None: update.message.reply_photo(open(plot_path, "rb")) util.log_message(update)
def check_av(i_config, i_interleaving): global total_count global failed_count global failed_tests global passed_count f = open('violations.out', 'r') file_line = f.readline() f.close() total_count = total_count + 1 output_res = 0 if "Atomicity violation detected" in file_line: output_res = 1 if av_result[i_config] == output_res: util.log_message("*** TEST PASSED ***") passed_count = passed_count + 1 else: util.log_message("*** TEST FAILED ***") failed_count = failed_count + 1 f_test = [] f_test.append(str(configs[i_config])) f_test.append(str(i_interleaving)) failed_tests.append(f_test) if av_result[i_config] == 1 and output_res == 0: util.log_message("Test has an Atomicty Violation but was not reported by tool") else: util.log_message("Test has no Atomicty Violation but tool reported atomicity violation")
def __send_text_id(self, update: Update, context: CallbackContext, text_id: str) -> None: """ Sendet einen Text als Antwort auf eine Nachricht. :param update: Nachrichtenupdate :param context: Nachrichtencontext :param text_id: Text-ID """ if not self.__check_whitelist(update): return parse_mode, text = self.message_service.gen_text(text_id) try: update.message.reply_text(text, parse_mode=parse_mode) except Exception as e: logging.error("Error in __send_text_id: {}".format(str(e))) util.log_message(update)
def _master_election(self, index): print('_master_election ENTER') new_index = index try: my_pos = self._ctx.active_node_list.index(self._ctx.this_node) print("_master_election My position in the list:" + str(my_pos) + " index:" + str(index)) # logger.debug("My position in the list is %d, a = %d" % (my_pos, index)) count = self._get_master_count() # In case that master has changed, assign a new master to self if self._ctx.this_node.role == "SLAVE" and self._ctx.master_list: if self._ctx.my_master not in self._ctx.master_list: self._assign_master(self._ctx.master_list[0]) # If there is not enough of masters, and own ranking on the list # equals index, then become master if count == "TOO_LOW": print("too low") if index == my_pos: print("'_master_election _become_a_master") self._become_a_master() new_index = (index + 1) % len(self._ctx.active_node_list) print("index:" + str(index)) # In case that there is enough or too many masters, become # slave else: self._become_a_slave() except: self._logger.debug("_master_election - shutdown") util.log_message("_master_election - shutdown", sys.exc_info()) self.shutdown() return new_index
f = open('sat_check.out', 'r') f_line = f.readline() f.close() if "unsat" in benchmark: if "unsat" in f_line: output_res = 0 else: output_res = 1 else: if "sat" in f_line: output_res = 1 else: output_res = 0 if test_res == output_res: util.log_message("*** TEST PASSED ***") passed_count = passed_count + 1 else: util.log_message("*** TEST FAILED ***") failed_count = failed_count + 1 f_test = [] f_test.append(config["NAME"]) f_test.append(benchmark) failed_tests.append(f_test) if test_res == 1 and output_res == 0: util.log_message("Test has a data race but was not reported by tool") else: util.log_message("Test has no data race but tool reported data race") except util.ExperimentError, e: print "Error: %s" % e
if do_run: run_string = config["RUN_LINE"] + benchmark util.run_command(run_string, verbose=False) test_res = 0 if "Yes" in benchmark and "fixed" not in benchmark: test_res = 1 f = open('violations.out', 'r') file_line = f.readline() f.close() output_res = 0 if "Atomicity violation detected" in file_line: output_res = 1 if test_res == output_res: util.log_message("*** TEST PASSED ***") passed_count = passed_count + 1 else: util.log_message("*** TEST FAILED ***") failed_count = failed_count + 1 f_test = [] f_test.append(config["NAME"]) f_test.append(benchmark) failed_tests.append(f_test) if test_res == 1 and output_res == 0: util.log_message("Test has an Atomicty Violation but was not reported by tool") else: util.log_message("Test has no Atomicty Violation but tool reported atomicity violation") except util.ExperimentError, e: print "Error: %s" % e
if do_run: run_string = config["RUN_LINE"] + benchmark util.run_command(run_string, verbose=False) test_res = 0 if "Yes" in benchmark and "fixed" not in benchmark: test_res = 1 f = open('violations.out', 'r') file_line = f.readline() f.close() output_res = 0 if "Atomicity violation detected" in file_line: output_res = 1 if test_res == output_res: util.log_message("*** TEST PASSED ***") passed_count = passed_count + 1 else: util.log_message("*** TEST FAILED ***") failed_count = failed_count + 1 f_test = [] f_test.append(config["NAME"]) f_test.append(benchmark) failed_tests.append(f_test) if test_res == 1 and output_res == 0: util.log_message( "Test has an Atomicty Violation but was not reported by tool" ) else: util.log_message( "Test has no Atomicty Violation but tool reported atomicity violation"