def measure_original_gravity(self, request_number): """ Function for taking the original gravity (OG) reading of the mixture :param: self :return: Return log """ status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Measuring Original Gravity\"}" ServiceNowLog.ServiceNowLog.create_new_log(self, status_log) log = Log(3, "Ferment.Measure Original Gravity", "Measuring original gravity ", datetime.datetime.now(), "pass") print(log.generate_log()) base_measurement = 0 try: while base_measurement < self.original_gravity: print("Measuring: ", base_measurement, "g/mL") # grams per milli-Liter time.sleep(sleep_time) base_measurement += 0.050 if base_measurement == self.original_gravity: print("Original Gravity has been measured") print("-----------------------------------------") log = Log(4, "Ferment.MeasureOriginalGravity", " Original gravity measured ", datetime.datetime.now(), "pass") print(log.generate_log()) except Exception as ex: print(ex) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation", "Measured Original Gravity") print("-----------------------------------------") self.add_yeast(request_number)
def measure_final_gravity(self, request_number): """ Function to measure the final gravity (FG) of the mixture :param: self :return: return Log """ status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\" Measuring Final Gravity\"}" ServiceNowLog.ServiceNowLog.create_new_log(self, status_log) log = Log(9, "Ferment.FinalGravity", "Measuring Final Gravity", datetime.datetime.now(), "pass") print(log.generate_log()) base_measurement = 0 try: while base_measurement < self.final_gravity: print("Measuring Final Gravity: ", base_measurement, "g/mL") # grams per milli-Liter time.sleep(sleep_time) base_measurement += 0.050 if base_measurement == self.final_gravity: print("Final Gravity has been measured") print("-----------------------------------------") log = Log(10, "Ferment.MeasureFinalGravity", " Final gravity measured ", datetime.datetime.now(), "pass") print(log.generate_log()) except Exception as ex: print(ex) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation", "Measured Final Gravity") print("-----------------------------------------") self.drain_ale(request_number)
def begin_fermentation_process(self, request_number): """ Function to begin fermentation process :param: self :return: return Log and brewed Ale """ status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\" Fermentation had begun\"}" ServiceNowLog.ServiceNowLog.create_new_log(self, status_log) log = Log(7, "Ferment.beginFermentationProcess", "Beginning Fermentation Process", datetime.datetime.now(), "pass") print(log.generate_log()) try: while self.ferment_time > 0: print("Fermentation time Left: ", self.ferment_time, "sec") time.sleep(sleep_time) self.ferment_time -= 1 if self.ferment_time == 0: print("Fermentation has completed") print("-----------------------------------------") log = Log(8, "Ferment.beginFermentationProcess", "Fermentation has completed", datetime.datetime.now(), "pass") print(log.generate_log()) except Exception as ex: print(ex) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation", "Fermentation has begun") print("-----------------------------------------") self.measure_final_gravity(request_number)
def qa(self, brew_master_id, request_number): """ Function for quality testing :param brew_master_id: the ID of the brew master :return: pass or fail and Log """ status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Checking Quality Assurance\"}" ServiceNowLog.ServiceNowLog.create_new_log(self, status_log) log = Log(12, "Ferment.QualityAssurance", "Quality Assurance", datetime.datetime.now(), "fail") print(log.generate_log()) try: difference = self.final_gravity - self.original_gravity measured_abv = (difference * 131.25) abs(measured_abv) == measured_abv if measured_abv == self.base_abv: log = Log(13, "Ferment.QualityAssurance", "Quality Assurance", datetime.datetime.now(), "pass") print(log.generate_log()) except Exception as e: print(e) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation", "Checked Quality Assurance") print("-----------------------------------------") self.send_to_kegging(request_number)
def mill_grains(self, recipe, request_number): # Mill_grains process start """ The start of milling grains :param request_number: a brew batch request number :param recipe: recipe instance :return: Return Log """ self.mill_time = recipe.get_mill_time() self.grains_weight = recipe.get_grain_weight(recipe.get_grain()) try: # log to begin process status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Starting Mashing Process\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.Milling", "Milling Started", datetime.datetime.now(), "pass") print(log.generate_log()) print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Milling", "Milling Started") while self.mill_time > 0: print("Milling Time Left: ", self.mill_time, "min") time.sleep(sleep_time) self.mill_time -= 1 if self.mill_time == 0: print("Grains milled") print("-----------------------------------------") # log to end process status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Milling Ended\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(2, "Mashing.Milling", "Milling Ended", datetime.datetime.now(), "pass") print(log.generate_log()) print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Milling", "Milling Ended") self.send_grains_to_sparging_tank(recipe, request_number) except Exception as e: # error handling status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Mashing Process Failed\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.Milling", "Milling Started", datetime.datetime.now(), "fail") print(log.generate_log()) print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Milling", "Milling Failed") print(e)
def separate_wort(self, recipe, request_number): # Separates the wort from the mash """ Displays a count down while wort separation is in process :param recipe: a recipe instance :param request_number: a brew batch request number :return: Current date, time and count down to separating wort. """ self.separation_time = recipe.get_wort_separation_time() try: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Separating Wort\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(4, "Mashing.Wort", "Wort Separation Started", datetime.datetime.now(), "pass") print(log.generate_log()) print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Wort Separation Started") # Counts the separation time in seconds while self.separation_time > 0: print("Wort Separating Time Left: ", self.separation_time, "min") time.sleep(sleep_time) self.separation_time -= 1 # Verifies that the wort separation has been completed. if self.separation_time == 0: print("Wort Separation Completed") print("-----------------------------------------") # Generates a log and displays the process has been successfully completed. status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Wort Separated\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(5, "Mashing.Wort", "Wort Separation Ended", datetime.datetime.now(), "pass") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Wort Separation Ended") print("-----------------------------------------") print("Wort Separated from Mash") print("-----------------------------------------") return True except Exception as e: # error handling status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Wort Separation Failed\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.Wort", "Wort Separation Failed", datetime.datetime.now(), "fail") print(log.generate_log()) print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Wort Separation Failed") print(e)
def sanitization(self, request_number): """ Main method that runs the sanitation process to clean equipment Completion is done by pressing enter and sends logging to ServiceNOW throughout the process :param request_number: a brew batch request number :return: void """ log_no = 0 try: time.sleep(sleep_time) log_no += 1 status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"Sanitization\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(log_no, "Prep.Sanitization", "Asked for manual input if Sanitization completed.", datetime.datetime.now(), "pass") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Prep.Sanitization", "Asked for manual input if Sanitization completed") time.sleep(sleep_time * 2) input("\033[1m" + "\n 1. Press Enter when sanitization is done:" + "\033[0m \n") # GPIO.wait_for_edge(self.button,GPIO.FALLING) time.sleep(sleep_time) # noinspection PyRedundantParentheses message = (" Sanitization Completed.\n") print("\t\t" + message + "\n") log_no += 1 status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"Sanitization\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(log_no, "Prep.Sanitization", "Sanitization done - Input received.", datetime.datetime.now(), "pass") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Prep.Sanitization", "Sanitization done -Input received.") time.sleep(sleep_time * 2) except Exception as e: print(e) log_no += 1 status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"Sanitization\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(int(log_no), "Prep.Sanitization", "Input for Sanitization completed failed.", datetime.datetime.now(), "fail") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Prep.Sanitization", "Input for Sanitization completed failed") time.sleep(sleep_time * 2) return log_no
def add_water(self, recipe, request_number): """ Water added to tank from hot liquor tank (HLT) :param recipe: a recipe instance :param request_number: a brew batch request number :return: """ try: #adding heated water to tank self.water_temp = recipe.get_water_temp() status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Adding Hot Water to Tank\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.Sparging", "Heated water added to tank", datetime.datetime.now(), "pass") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Sparging", "Heated water added to tank") print("-----------------------------------------" ) # prints line to separate statements & log 1 is created print("Water Temp: ", self.water_temp, "degrees F") # displays water temp in degrees F print("Added Heated Water to Sparging Tank" ) # print validates the process of water being heated print( "-----------------------------------------" ) # prints line to separate the next process in sparging tank self.stir_mash(recipe, request_number) except Exception as e: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Adding Hot Water to Tank Failed\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.Sparging", "Adding Hot Water to Tank Failed", datetime.datetime.now(), "fail") print(log.generate_log()) print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog( ml, request_number, "Mashing.Sparging", "Adding Hot Water to Tank Failed") print(e)
def heat_water(self, recipe, request_number): # Water heating process starts """ The start of water heating :param request_number: a brew request number :param recipe: a recipe instance :return: return log """ self.water_amount = recipe.get_water_volume() self.water_temp = recipe.get_water_temp() try: # log to begin process status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Water heating\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.HotLiquorTank", "Water heating started.", datetime.datetime.now(), "pass") print(log.generate_log()) print("-----------------------------------------") print("Water Temperature Heated To: ", self.water_temp, " degrees F") print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.HotLiquorTank", "Water heating started") self.check_water_temp(recipe, request_number) except Exception as e: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Water Heating Failed\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.Milling", "Water Heating Failed", datetime.datetime.now(), "fail") print(log.generate_log()) print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.HotLiquorTank", "Water Heating Failed") print(e)
def send_hot_water_to_sparging_tank(self, recipe, request_number): """ Sends water to sparging tank :param recipe: a recipe instance :param request_number: a bre batch request number :return: print statement """ try: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Sending Hot Water to Sparging Tank\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(3, "Mashing.HotLiquorTank", "Sending Hot Water to Sparging Tank", datetime.datetime.now(), "pass") print(log.generate_log()) print("-----------------------------------------") print("Hot water is sent to Sparging Tank.") print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog( ml, request_number, "Mashing.HotLiquorTank", "Hot water is sent to Sparging Tank") st = SpargingTank() st.add_water(recipe, request_number) except Exception as e: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Sending Hot Water to Sparging Tank Failed\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.HotLiquorTank", "Sending Hot Water to Sparging Tank Failed", datetime.datetime.now(), "fail") print(log.generate_log()) print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog( ml, request_number, "Mashing.HotLiquorTank", "Sending Hot Water to Sparging Tank Failed") print(e)
def sanitization(self, request_number): status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Sanitizing Vessel\"}" ServiceNowLog.ServiceNowLog.create_new_log(self, status_log) log = Log(14, "Ferment.sanitize_vessels", datetime.datetime.now(), "pass") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation", "Sanitizing Vessels") print("-----------------------------------------")
def sparg_the_tank(self, recipe, request_number): #empty the tank while spraying water over the remaing grains """ Function to remove finished wort from Sparging tank. :param recipe: a Recipe Instance :param request_number: a brew batch request number :return: Return log 4 """ try: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Sparging the Tank\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(4, "Mashing.Sparging", "Sparging the Tank", datetime.datetime.now(), "pass") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Sparging", "Sparging the Tank") print("-----------------------------------------" ) # prints line to separate statements & log 4 is created print("Tank emptying, washing grains." ) # Finishing before sending it to the boiling phase print("-----------------------------------------") w = Wort() w.check_hot_water_temp(recipe, request_number) except Exception as e: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Sparging the Tank Failed\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.Sparging", "Sparging the Tank Failed", datetime.datetime.now(), "fail") print(log.generate_log()) print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Sparging", "Sparging the Tank Failed") print(e)
def check_water_volume(self, recipe, request_number): """ Getter for water volume :param recipe: a recipe instance :param request_number: a brew batch request number :return: water volume. """ try: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Checking Water Volume\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(3, "Mashing.HotLiquorTank", "Checking Water Volume", datetime.datetime.now(), "pass") print(log.generate_log()) print("-----------------------------------------") print("Water Volume: ", self.water_amount, "gallons") print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.HotLiquorTank", "Checking Water Volume") self.send_hot_water_to_sparging_tank(recipe, request_number) except Exception as e: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Checking Water Volume Failed\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.HotLiquorTank", "Checking Water Volume Failed", datetime.datetime.now(), "fail") print(log.generate_log()) print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.HotLiquorTank", "Checking Water Volume Failed") print(e)
def send_grains_to_sparging_tank(self, recipe, request_number): """ Adds grains to the Sparging Tank :param recipe: a Recipe instance :param request_number: a bre batch request number :return: print statement """ try: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Sending Grains to Sparging Tank\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(3, "Mashing.Milling", "Send Grains to Sparging Tank", datetime.datetime.now(), "pass") print(log.generate_log()) print("-----------------------------------------") print("Grains added to Sparging Tank") print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog( ml, request_number, "Mashing.Milling", "Sending Grains to Sparging Tank") hlt = HotLiquorTank() hlt.heat_water(recipe, request_number) except Exception as e: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Sending Grains to Sparging Tank Failed\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.Milling", "Sending Grains to Sparging Tank", datetime.datetime.now(), "fail") print(log.generate_log()) print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog( ml, request_number, "Mashing.Milling", "Sending Grains to Sparging Tank Failed") print(e)
def check_water_temp(self, recipe, request_number): """ Checks the current temperature of the water. :param recipe: Recipe instance :param request_number: a brew batch request number :return: current water temperature """ try: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Checking Water Temp\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(2, "Mashing.HotLiquorTank", "Checking Water Temperature", datetime.datetime.now(), "pass") print(log.generate_log()) print("-----------------------------------------") print("Water Temperature: ", self.water_temp, "degrees F") print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.HotLiquorTank", "Checking Water Temperature") self.check_water_volume(recipe, request_number) except Exception as e: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Checking Water Temperature Failed\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.HotLiquorTank", "Checking Water Temperature", datetime.datetime.now(), "fail") print(log.generate_log()) print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.HotLiquorTank", "Water Temperature Failed") print(e)
def check_wort_volume(self, recipe, request_number): # Wort Volume? Should we use it as BatchSize # Displays wort volume """ Displays the correct wort volume / generates a log :param recipe: a recipe instance :param request_number: a brew batch request number :return: Current date, time and correct wort volume / and a log """ self.wort_volume = recipe.get_wort_volume() # Records correct wort volume to Log try: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Check Wort Volume\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(3, "Mashing.Wort", "Check Wort Volume", datetime.datetime.now(), "pass") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Check Wort Volume") print("-----------------------------------------") print("Wort Volume: ", self.wort_volume, "gallons") print("-----------------------------------------") self.separate_wort(recipe, request_number) except Exception as e: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Check Wort Volume Failed\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.Wort", "Check Wort Volume Failed", datetime.datetime.now(), "fail") print(log.generate_log()) print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Check Wort Volume Failed") print(e)
def check_hot_water_temp(self, recipe, request_number): # Checks for water temperature """ Displays correct water temp in the wort phase / generates a log :param recipe: a recipe instance :param request_number: a brew batch request number :return: Displays current date, time and correct water temperature """ self.hot_water_temp = recipe.get_water_temp() # Records correct hot water temp to Log try: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Checking Water Temp\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.Wort", "Checking Water Temp", datetime.datetime.now(), "pass") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Checking Water Temp") print("-----------------------------------------") print("Hot Water Temperature: ", self.hot_water_temp, "degrees F") print("-----------------------------------------") self.check_water_volume(recipe, request_number) except Exception as e: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Checking Water Temp Failed\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.Wort", "Checking Water Temp Failed", datetime.datetime.now(), "fail") print(log.generate_log()) print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Checking Water Temp Failed") print(e)
def check_water_volume(self, recipe, request_number): # Checks for water volume """ Displays the correct water volume / generates a log :param recipe: a recipe instance :param request_number: a brew batch request number :return: Current date, time and correct water volume """ self.water_volume = recipe.get_water_volume() try: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Checking Water Volume\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(2, "Mashing.Wort", "Checking Water Volume", datetime.datetime.now(), "pass") print(log.generate_log()) print("-----------------------------------------") print("Water Volume: ", self.water_volume, "gallons") print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Checking Water Volume") self.check_wort_volume(recipe, request_number) except Exception as e: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Checking Water Volume Failed\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.Wort", "Checking Water Volume Failed", datetime.datetime.now(), "fail") print(log.generate_log()) print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Wort", "Checking Water Volume Failed") print(e)
def drain_ale(self, request_number): """ Function to drain Ale :param: self :return: Return log and filtered Ale """ status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Draining Ale\"}" ServiceNowLog.ServiceNowLog.create_new_log(self, status_log) log = Log(11, "Ferment.drainAle", "Draining Ale. Sending to QA", datetime.datetime.now(), "pass") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation", "Draining Ale") print("-----------------------------------------") self.qa(self.brew_master_id, request_number)
def close_lid(self, request_number): """ Function for closing lid :param: self :return: Return log """ status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Closing lid of vessel\"}" ServiceNowLog.ServiceNowLog.create_new_log(self, status_log) log = Log(6, "Ferment.closeLid", "Closing lid", datetime.datetime.now(), "pass") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation", "Closing Fermentation Vessel Lid") print("-----------------------------------------") self.begin_fermentation_process(request_number)
def send_to_kegging(self, request_number): """ Function to send filtered Ale to Team Kegging :param: self :return: Return Log """ status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Sending Ale to the Kegging Process\"}" ServiceNowLog.ServiceNowLog.create_new_log(self, status_log) log = Log(13, "Ferment.send_to_kegging", "Ale sent to kegging", datetime.datetime.now(), "pass") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog( ml, request_number, "Fermentation", "Sending Ale to the Kegging Process") print("-----------------------------------------")
def get_wort(self, request_number): """ Function for receiving the wort :param request_number: the ID of the current batch :return: Return log """ status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Starting Fermentation Process\"}" ServiceNowLog.ServiceNowLog.create_new_log(self, status_log) log = Log(1, "Receiving wort", "Received wort from Team Boil", datetime.datetime.now(), "pass") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation", "Starting Fermentation Process") print("-----------------------------------------") self.add_to_fermentation_vessel(request_number)
def set_ferment_temperature(self, request_number): """ Function for setting the temperature of the mixture to ferment :param: self :return: Return fermentation temperature """ status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\" Setting fermentation temperature\"}" ServiceNowLog.ServiceNowLog.create_new_log(self, status_log) log = Log(7, "Ferment.setFermentTemperature", "Temperature is set at %.2f" % self.ferment_temp, datetime.datetime.now(), "pass") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Fermentation", "Setting Fermentation Temperature") print("-----------------------------------------") self.begin_fermentation_process(request_number)
def add_to_fermentation_vessel(self, request_number): """ Function for adding the wort to fermentation vessel :param: vessel_id : the ID of the vessel :return: Return log """ status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Wort added to Vessel\"}" ServiceNowLog.ServiceNowLog.create_new_log(self, status_log) log = Log(2, "Addition to Fermentation Vessel", "Adding wort to fermentation vessel ", datetime.datetime.now(), "pass") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog( ml, request_number, "Fermentation", "Wort added to Fermentation Vessel") print("-----------------------------------------") self.measure_original_gravity(request_number)
def add_yeast(self, request_number): """ Function for adding activated yeast to the fermentation vessel with wort :param: self :return: Return Log """ status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Fermentation\", \"log\":\"Adding yeast to vessel\"}" ServiceNowLog.ServiceNowLog.create_new_log(self, status_log) log = Log(5, "Ferment.addYeast", "Activated yeast has been added to the fermentation vessel", datetime.datetime.now(), "pass") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog( ml, request_number, "Fermentation", "Adding Yeast to Fermentation Vessel") print("-----------------------------------------") self.close_lid(request_number) return ("Yeast added")
def read_weight_hops(self, recipe, request_number): """ Displays the actual weight of the hops :param recipe: a Recipe instance :param request_number: a brew batch request number :return: a float, the weight that goes into the weight scale """ try: hop = list(recipe.hop_hop_amt.keys()) weight = list(recipe.hop_hop_amt.values()) weight = list(map(lambda x: float(x.replace(",", "")), weight)) j = 1 for i in range(len(hop)): weight_scale = 0.0 status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"WeightScale\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) self.log_no = self.log_no + 1 log = Log(self.log_no, "Prep.WeightScale", "Weight scale is set to zero.", datetime.datetime.now(), "pass") print(log.generate_log()) time.sleep(sleep_time) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Prep.WeightScale", "Weight scale is set to zero") time.sleep(1) status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"WeightScale\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) self.log_no = self.log_no + 1 log = Log(self.log_no, "Prep.WeightScale", "Brewer is being asked to dispense " + hop[i] + ".", datetime.datetime.now(), "pass") print(log.generate_log()) time.sleep(sleep_time) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Prep.WeightScale", "Brewer is being asked to dispense " + hop[i] + ".") time.sleep(1) print( " \033[1m4." + str(j) + " To brew the beer for this batch, " + str(weight[i]) + " oz of " + hop[ i] + " Hops needed.\033[0m\n") time.sleep(sleep_time) print(" ****Weight scale is calibrated to \033[1m0.0\033[0m. \n") time.sleep(sleep_time) input(" Press Enter to dispense \033[1m" + hop[i] + "\033[0m Hops:\n") for weight_scale in arange(float(weight[i])): weight_scale = weight_scale + 1 time.sleep(sleep_time * 2) print(" \033[1m" + str(weight_scale) + "\033[0m pound(s) \033[1m" + hop[ i] + "\033[0m Hops received. \033[1m" + str( float(weight[i]) - weight_scale) + "\033[0m pound(s) left to be dispensed. \n") time.sleep(sleep_time) if float(weight[i]) == weight_scale: time.sleep(sleep_time) print(" \033[1m" + hop[i] + "\033[0m Hops are measured and \033[1m" + str( weight_scale) + "\033[0m pounds received. \n") time.sleep(sleep_time) status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"WeightScale\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) self.log_no = self.log_no + 1 log = Log(self.log_no, "Prep.WeightScale", hop[i] + " hop received.", datetime.datetime.now(), "pass") print(log.generate_log()) time.sleep(sleep_time * 2) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Prep.WeightScale", hop[i] + "hop received.") time.sleep(sleep_time * 2) j = j + 1 i = i + 1 return weight_scale except Exception as e: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"WeightScale\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) self.log_no = self.log_no + 1 log = Log(self.log_no + 1, "Prep.WeightScale", "Failed to dispense " + hop[i] + ".", datetime.datetime.now(), "fail") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Prep.WeightScale", "Failed to dispense " + hop[i] + ".") print(e)
def stir_mash(self, recipe, request_number): #stirring the wort in progress """ Function to stir the Wort-in progress sparging tank :param recipe: a Recipe Instance :param request_number: a brew batch request number :return: Return log 2 """ try: self.stir_time = recipe.get_stir_time() status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Stirring Mash\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(2, "Mashing.Sparging", "Sparging Process Started", datetime.datetime.now(), "pass") print(log.generate_log()) print("-----------------------------------------" ) # prints line to separate statements & log 2 is created ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Sparging", "Sparging Process Started") while self.stir_time > 0: print("Stirring Time Left: ", self.stir_time, "min") # prints number of seconds left until stirring is # finished time.sleep(sleep_time) self.stir_time -= 1 if self.stir_time == 0: print( "SpargingTank stirred" ) # print validates that SpargingTank is finished stirring print("-----------------------------------------") status_log = "{\"batch_id\":\"" + request_number + "\",\"brew_batch_stage\":\"Mashing\",\"log\":\"Mash Stirred\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(3, "Mashing.Sparging", "Sparging Process Ended", datetime.datetime.now(), "pass") print(log.generate_log()) print("-----------------------------------------" ) # prints line to separate statements & log 3 is created ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Sparging", "Sparging Process Ended") print( "Mash Stirred") # print that the mashing is finished stirring print("-----------------------------------------" ) # prints line to separate process within SpargingTank self.sparg_the_tank(recipe, request_number) except Exception as e: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Mashing\", \"log\":\"Mashing Stirred Failed\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) log = Log(1, "Mashing.Sparging", "Mashing Stirred Failed", datetime.datetime.now(), "fail") print(log.generate_log()) print("-----------------------------------------") ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Mashing.Sparging", "Mashing Stirred Failed") print(e)
def yeast_temp(self, request_number): """ Determines if yeast is within temperature range through a while loop that checks this range. If the temperature of yeast is in range, a log is saved. And if not, another yeast is needed for temperature measurement :param request_number: a brew batch request number :return: void """ tmp = self.read_temp(request_number) # noinspection PyRedundantParentheses while (tmp > 80 or tmp < 60): try: print("\t\b***Temperature of yeast is out of range.***") print( " ***Bring another yeast and measure temperature again.*** \n" ) time.sleep(sleep_time * 3) status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"Temperature\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) self.log_no = self.log_no + 1 log = Log(self.log_no, "Prep.Temperature", "Temperature of yeast is not in range.", datetime.datetime.now(), "fail") print(log.generate_log()) time.sleep(sleep_time * 2) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog( ml, request_number, "Prep.Temperature", "Temperature of yeast is not in range.") time.sleep(sleep_time) except Exception as e: print(e) tmp = self.read_temp(request_number) try: print( " Temperature of yeast is in range and ready to use.\n") time.sleep(sleep_time * 2) status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"Temperature\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) self.log_no = self.log_no + 1 log = Log(self.log_no, "Prep.Temperature", "Temperature of yeast measured.", datetime.datetime.now(), "pass") print(log.generate_log()) time.sleep(sleep_time * 2) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog( ml, request_number, "Prep.Temperature", "Temperature of yeast measured") time.sleep(sleep_time * 2) except Exception as e: # Exception: checks if measurement has failed print(e) status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"Temperature\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) self.log_no = self.log_no + 1 log = Log(self.log_no, "Prep.Temperature", "Failed to measure temperature of yeast", datetime.datetime.now(), "fail") print(log.generate_log()) time.sleep(sleep_time * 2) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog( ml, request_number, "Prep.Temperature", "Failed to measure temperature of yeast") time.sleep(sleep_time)
def read_weight_grains(self, recipe, request_number): """ Displays the actual weight of the grains :param recipe: a Recipe instance :param request_number: brew request number :return: a float, the grains weight that goes into the weight scale """ try: grain = list(recipe.grain.keys()) weight = list(recipe.grain.values()) weight = list(map(lambda x: float(x.replace(",", "")), weight)) status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"WeightScale\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) self.log_no = self.log_no + 1 log = Log(self.log_no, "Prep.WeightScale", "Grains list and weight copied from ordered brew recipe.", datetime.datetime.now(), "pass") print(log.generate_log()) time.sleep(sleep_time) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Prep.WeightScale", "Grains list and weight copied from ordered brew recipe") time.sleep(1) status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"WeightScale\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) self.log_no = self.log_no + 1 log = Log(self.log_no, "Prep.WeightScale", "Hops list and weight copied from ordered brew recipe.", datetime.datetime.now(), "pass") print(log.generate_log()) time.sleep(sleep_time) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Prep.WeightScale", "Hops list and weight copied from ordered brew recipe") time.sleep(sleep_time) j = 1 for i in range(len(grain)): weight_scale = 0.0 status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"WeightScale\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) self.log_no = self.log_no + 1 log = Log(self.log_no + 1, "Prep.WeightScale", "Weight scale is set to zero.", datetime.datetime.now(), "pass") print(log.generate_log()) time.sleep(sleep_time) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Prep.WeightScale", "Weight scale is set to zero") time.sleep(sleep_time) status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"WeightScale\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) self.log_no = self.log_no + 1 log = Log(self.log_no, "Prep.WeightScale", "Brewer is being asked to dispense " + grain[i] + ".", datetime.datetime.now(), "pass") print(log.generate_log()) time.sleep(sleep_time) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Prep.WeightScale", "Brewer is being asked to dispense " + grain[i] + ".") time.sleep(sleep_time) print(" \033[1m3." + str(j) + " To brew the beer for this batch, " + str(weight[i]) + " pounds of " + grain[i] , " needed.\033[0m\n" ) time.sleep(sleep_time) print(" ****Weight scale is calibrated to \033[1m0.0\033[0m. \n") time.sleep(sleep_time) input(" Press the Enter to dispense \033[1m" + grain[i] + "\033[0m:\n") for weight_scale in arange(float(weight[i])): weight_scale = weight_scale + 1.0 time.sleep(sleep_time) print(" \033[1m" + str( weight_scale) + "\033[0;0m pound(s) \033[1m" + grain[i] + "\033[0m received. \033[1m" + str( weight[i] - weight_scale) + "\033[0m pound(s) left to be dispensed. \n") time.sleep(sleep_time) if float(weight[i]) == weight_scale: print(" \033[1m" + grain[i] + "\033[0m are measured and \033[1m" + str( weight_scale) + "\033[0m pounds received. \n") status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"WeightScale\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) self.log_no = self.log_no + 1 log = Log(self.log_no, "Prep.WeightScale", grain[i] + " grain received.", datetime.datetime.now(), "pass") print(log.generate_log()) time.sleep(sleep_time) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Prep.WeightScale", grain[i] + "grain received.") time.sleep(sleep_time) j = j + 1 i = i + 1 return weight_scale except Exception as e: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"WeightScale\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) self.log_no = self.log_no + 1 log = Log(self.log_no, "Prep.WeightScale", "Failed to dispense " + grain[i] + ".", datetime.datetime.now(), "fail") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog(ml, request_number, "Prep.WeightScale", "Failed to dispense " + grain[i] + ".") print(e)
def read_temp(self, request_number): """ Gathers temperature readings for yeast and logs those readings to ServiceNow and MongoDB A keyboard input is used proceed to the next step :param request_number: a brew batch request number :return: temperature reading """ try: status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"Temperature\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) self.log_no = self.log_no + 1 log = Log(self.log_no, "Prep.Temperature", "Waiting to measure temperature of yeast", datetime.datetime.now(), "pass") print(log.generate_log()) time.sleep(sleep_time) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog( ml, request_number, "Prep.Temperature", "Waiting to measure temperature of yeast") time.sleep(sleep_time) temperature = random.randrange(55, 85, 1) input( "\033[1m 2. Press Enter to measure temperature of yeast: \033[0m\n" ) time.sleep(sleep_time * 3) print( '\t\t\tTemp = \033[1m{0:0.0f}*\033[0;0m F'.format(temperature)) time.sleep(sleep_time * 2) status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"Temperature\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) self.log_no = self.log_no + 1 log = Log(self.log_no, "Prep.Temperature", "Temperature of yeast received", datetime.datetime.now(), "pass") print(log.generate_log()) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog( ml, request_number, "Prep.Temperature", "Temperature of yeast received") time.sleep(sleep_time * 2) return temperature except Exception as e: # Exception: checks if measurement has failed print(e) status_log = "{\"batch_id\":\"" + request_number + "\", \"brew_batch_stage\":\"Prep\", \"log\":\"Temperature\"}" sn_log = ServiceNowLog() ServiceNowLog.create_new_log(sn_log, status_log) self.log_no = self.log_no + 1 log = Log(self.log_no, "Prep.Temperature", "Failed to check temperature of yeast", datetime.datetime.now(), "fail") print(log.generate_log()) time.sleep(sleep_time * 2) ml = MongoLogging.MongoLogging() MongoLogging.MongoLogging.MongoLog( ml, request_number, "Prep.Temperature", "Fail to check temperature of yeast") time.sleep(sleep_time * 2)