def ChangeTune(tuneName): """ Change all the MIDAS values in the given tune path. """ for var, val in Midas.dirlist(TunePath + tuneName): MidasSetVar(GetVarName(var), val) Midas.sendmessage("pythonrc", "Changed tune to: " + tuneName)
def test_dirlist(self, mock_odbcommand, mock_dirlisttest): mock_odbcommand.return_value = "nothing" mock_dirlisttest.return_value = "value" result = Midas.dirlist("/a/path/") self.assertEqual(result, "value") mock_odbcommand.assert_called_once_with("ls " + "", "/a/path/") mock_dirlisttest.assert_called_once_with("/a/path/")
"%a %b %d %H:%M:%S %Y") FirstTriggered = time.mktime(FirstTriggered) except: FirstTriggered = 0 print "First Triggered Time is empty!" # Get the current time CurrentTime = time.mktime(time.localtime()) # If the current time and first triggered time are close together # send an email to the mailing list if CurrentTime - FirstTriggered < 10: SERVER = "localhost" FROM = "*****@*****.**" # Get list of addresses for email TO = [x[1] for x in Midas.dirlist("/Experiment/Variables/Contacts")] SUBJECT = "ALARM: MpetVacuum" TEXT = "Vacuum Alarm in MPET.\n\n" TEXT += "Please reset the Alarm on 'titan01.triumf.ca:8080'.\n\n" vaclevel = Midas.varget("/Equipment/Beamline/Variables/Measured[58]") TEXT += "Current Vacuum = %s Torr\n" % vaclevel #TEXT += "This is a test of the email list. Please ignore." # Prepare actual message message = """\ From: %s To: %s Subject: %s