Beispiel #1
0
 def _run_tracking_script(self, madx_file_path, output_path):
     print "Running tracking code..."
     errcode = madxrunner.runForInputFile(madx_file_path,
                                          stdout=subprocess.PIPE)
     self.assertEqual(errcode, 0, "Error running MADX tracking code.")
     ADDbpmerror.convert_files(1, os.path.join(output_path, "trackone"),
                               os.path.join(output_path, "ALLBPMs"))
Beispiel #2
0
def callMadx(pathToInputFile, attemptsLeft=5):
    result = madxrunner.runForInputFile(pathToInputFile, stdout=devNull)
    if result is not 0: # then madx failed for whatever reasons, lets try it again (tbach)
        print "madx failed. result:", result, "pathToInputFile:", pathToInputFile, "attempts left:", attemptsLeft
        if attemptsLeft is 0:
            raise Exception("madx finally failed, can not continue")
        print "lets wait 0.5s and try again..."
        time.sleep(0.5)
        return callMadx(pathToInputFile, attemptsLeft - 1)
    return result
def callMadx(pathToInputFile, attemptsLeft=5):
    result = madxrunner.runForInputFile(pathToInputFile, stdout=devNull)
    if result is not 0:  # then madx failed for whatever reasons, lets try it again (tbach)
        print "madx failed. result:", result, "pathToInputFile:", pathToInputFile, "attempts left:", attemptsLeft
        if attemptsLeft is 0:
            raise Exception("madx finally failed, can not continue")
        print "lets wait 0.5s and try again..."
        time.sleep(0.5)
        return callMadx(pathToInputFile, attemptsLeft - 1)
    return result
Beispiel #4
0
 def _run_tracking_script(self, madx_file_path, output_path):
     print "Running tracking code..."
     errcode = madxrunner.runForInputFile(madx_file_path, stdout=subprocess.PIPE)
     self.assertEqual(errcode, 0, "Error running MADX tracking code.")
     ADDbpmerror.convert_files(1, os.path.join(output_path, "trackone"), os.path.join(output_path, "ALLBPMs"))