scripts/run.py
def grab_java_message(node_list, curr_testname):
    """scan through the java output text and extract the java messages related to running
    test specified in curr_testname.
    Parameters
    ----------
    :param node_list:  list of H2O nodes
      List of H2o nodes associated with an H2OCloud (cluster) that are performing the test specified in curr_testname.
    :param curr_testname: str
      Store the unit test name (can be R unit or Py unit) that has been completed and failed.
    :return: a string object that is either empty or the java messages that associated with the test in curr_testname.
     The java messages can usually be found in one of the java_*_0.out.txt
    """

    global g_java_start_text  # contains text that describe the start of a unit test.

    java_messages = ""
    start_test = False  # denote when the current test was found in the java_*_0.out.txt file

    # grab each java file and try to grab the java messages associated with curr_testname
    for each_node in node_list:
        java_filename = each_node.output_file_name  # find the java_*_0.out.txt file
        if os.path.isfile(java_filename):
            java_file = open(java_filename, 'r')
            for each_line in java_file:
                if g_java_start_text in each_line:
                    start_str, found, end_str = each_line.partition(g_java_start_text)

                    if len(found) > 0:  # a new test is being started.
                        current_testname = end_str.strip()  # grab the test name and check if it is curr_testname
                        if current_testname == curr_testname:
                            # found the line starting with current test.  Grab everything now
                            start_test = True  # found text in java_*_0.out.txt that describe curr_testname

                            # add header to make JAVA messages visible.
                            java_messages += "\n\n**********************************************************\n"
                            java_messages += "**********************************************************\n"
                            java_messages += "JAVA Messages\n"
                            java_messages += "**********************************************************\n"
                            java_messages += "**********************************************************\n\n"


                        else:
                            # found a differnt test than our curr_testname.  We are done!
                            if start_test:
                                # in the middle of curr_testname but found a new test starting, can quit now.
                                break

                # store java message associated with curr_testname into java_messages
                if start_test:
                    java_messages += each_line

            java_file.close()  # finished finding java messages

        if start_test:
            # found java message associate with our test already. No need to continue the loop.
            break

    return java_messages
def grab_java_message(node_list, curr_testname):
    """scan through the java output text and extract the java messages related to running
    test specified in curr_testname.
    Parameters
    ----------
    :param node_list:  list of H2O nodes
      List of H2o nodes associated with an H2OCloud (cluster) that are performing the test specified in curr_testname.
    :param curr_testname: str
      Store the unit test name (can be R unit or Py unit) that has been completed and failed.
    :return: a string object that is either empty or the java messages that associated with the test in curr_testname.
     The java messages can usually be found in one of the java_*_0.out.txt
    """

    global g_java_start_text  # contains text that describe the start of a unit test.

    java_messages = ""
    start_test = False  # denote when the current test was found in the java_*_0.out.txt file

    # grab each java file and try to grab the java messages associated with curr_testname
    for each_node in node_list:
        java_filename = each_node.output_file_name  # find the java_*_0.out.txt file
        if os.path.isfile(java_filename):
            java_file = open(java_filename, 'r')
            for each_line in java_file:
                if g_java_start_text in each_line:
                    start_str, found, end_str = each_line.partition(g_java_start_text)

                    if len(found) > 0:  # a new test is being started.
                        current_testname = end_str.strip()  # grab the test name and check if it is curr_testname
                        if current_testname == curr_testname:
                            # found the line starting with current test.  Grab everything now
                            start_test = True  # found text in java_*_0.out.txt that describe curr_testname

                            # add header to make JAVA messages visible.
                            java_messages += "\n\n**********************************************************\n"
                            java_messages += "**********************************************************\n"
                            java_messages += "JAVA Messages\n"
                            java_messages += "**********************************************************\n"
                            java_messages += "**********************************************************\n\n"


                        else:
                            # found a differnt test than our curr_testname.  We are done!
                            if start_test:
                                # in the middle of curr_testname but found a new test starting, can quit now.
                                break

                # store java message associated with curr_testname into java_messages
                if start_test:
                    java_messages += each_line

            java_file.close()  # finished finding java messages

        if start_test:
            # found java message associate with our test already. No need to continue the loop.
            break

    return java_messages
scan through the java output text and extract the java messages related to running
    test specified in curr_testname.
    Parameters
    ----------
    :param node_list:  list of H2O nodes
      List of H2o nodes associated with an H2OCloud (cluster) that are performing the test specified in curr_testname.
    :param curr_testname: str
      Store the unit test name (can be R unit or Py unit) that has been completed and failed.
    :return: a string object that is either empty or the java messages that associated with the test in curr_testname.
     The java messages can usually be found in one of the java_*_0.out.txt