scripts/scrapeForIntermittents.py
def main(argv):
    """
    Main program.  Expect script name plus 7 inputs in the following order:
    - This script name
    1. timestamp: time in s
    2. jenkins_job_name (JOB_NAME)
    3. build_id (BUILD_ID)
    4. git hash (GIT_COMMIT)
    5. node name (NODE_NAME)
    6. unit test category (JUnit, PyUnit, RUnit, Hadoop)
    7. Jenkins URL (JENKINS_URL)
    8. Text file name where failure summaries are stored
    9. Filename that stored all failed test info as a dictionary
    10. duration (month) to keep data: data older tghan this input will be removed

    @return: none
    """
    global g_script_name
    global g_test_root_dir
    global g_timestamp
    global g_job_name
    global g_build_id
    global g_git_hash
    global g_node_name
    global g_unit_test_type
    global g_jenkins_url
    global g_temp_filename
    global g_summary_text_filename  # store failed test info in csv format
    global g_failed_tests_dict      # store failed test info as a dictionary
    global g_resource_url
    global g_timestring
    global g_daily_failure_csv

    if len(argv) < 12:
        print "Wrong call.  Not enough arguments.\n"
        usage()
        sys.exit(1)
    else:   # we may be in business
        g_script_name = os.path.basename(argv[0])   # get name of script being run.
        g_timestamp = float(argv[1])
        g_job_name = argv[2]
        g_build_id = argv[3]
        g_git_hash = argv[4]
        g_node_name= argv[5]
        g_unit_test_type = argv[6]
        g_jenkins_url = argv[7]

        localtz = time.tzname[0]
        dt = parser.parse(time.ctime(g_timestamp)+ ' '+localtz)
        g_timestring = dt.strftime("%a %b %d %H:%M:%S %Y %Z")
        g_temp_filename = os.path.join(g_test_root_dir,'tempText')
        g_summary_text_filename = os.path.join(g_test_root_dir, argv[8])
        g_failed_tests_dict = os.path.join(g_test_root_dir, argv[9])
        monthToKeep = float(argv[10])
        g_daily_failure_csv = os.path.join(g_test_root_dir, argv[11])

        g_resource_url = '/'.join([g_jenkins_url, "job", g_job_name, g_build_id])
        get_console_out(g_resource_url+"/#showFailuresLink/")       # save remote console output in local directory
        extract_failed_tests_info()      # grab the console text and stored the failed tests/paths
        save_failed_tests_info()         # save new failed test info into a file
        if monthToKeep > 0:
            trim_data_back_to(monthToKeep)
def main(argv):
    """
    Main program.  Expect script name plus 7 inputs in the following order:
    - This script name
    1. timestamp: time in s
    2. jenkins_job_name (JOB_NAME)
    3. build_id (BUILD_ID)
    4. git hash (GIT_COMMIT)
    5. node name (NODE_NAME)
    6. unit test category (JUnit, PyUnit, RUnit, Hadoop)
    7. Jenkins URL (JENKINS_URL)
    8. Text file name where failure summaries are stored
    9. Filename that stored all failed test info as a dictionary
    10. duration (month) to keep data: data older tghan this input will be removed

    @return: none
    """
    global g_script_name
    global g_test_root_dir
    global g_timestamp
    global g_job_name
    global g_build_id
    global g_git_hash
    global g_node_name
    global g_unit_test_type
    global g_jenkins_url
    global g_temp_filename
    global g_summary_text_filename  # store failed test info in csv format
    global g_failed_tests_dict      # store failed test info as a dictionary
    global g_resource_url
    global g_timestring
    global g_daily_failure_csv

    if len(argv) < 12:
        print "Wrong call.  Not enough arguments.\n"
        usage()
        sys.exit(1)
    else:   # we may be in business
        g_script_name = os.path.basename(argv[0])   # get name of script being run.
        g_timestamp = float(argv[1])
        g_job_name = argv[2]
        g_build_id = argv[3]
        g_git_hash = argv[4]
        g_node_name= argv[5]
        g_unit_test_type = argv[6]
        g_jenkins_url = argv[7]

        localtz = time.tzname[0]
        dt = parser.parse(time.ctime(g_timestamp)+ ' '+localtz)
        g_timestring = dt.strftime("%a %b %d %H:%M:%S %Y %Z")
        g_temp_filename = os.path.join(g_test_root_dir,'tempText')
        g_summary_text_filename = os.path.join(g_test_root_dir, argv[8])
        g_failed_tests_dict = os.path.join(g_test_root_dir, argv[9])
        monthToKeep = float(argv[10])
        g_daily_failure_csv = os.path.join(g_test_root_dir, argv[11])

        g_resource_url = '/'.join([g_jenkins_url, "job", g_job_name, g_build_id])
        get_console_out(g_resource_url+"/#showFailuresLink/")       # save remote console output in local directory
        extract_failed_tests_info()      # grab the console text and stored the failed tests/paths
        save_failed_tests_info()         # save new failed test info into a file
        if monthToKeep > 0:
            trim_data_back_to(monthToKeep)
def main ( argv ) : global g_script_name global g_test_root_dir global g_timestamp global g_job_name global g_build_id global g_git_hash global g_node_name global g_unit_test_type global g_jenkins_url global g_temp_filename global g_summary_text_filename # store failed test info in csv format global g_failed_tests_dict # store failed test info as a dictionary global g_resource_url global g_timestring global g_daily_failure_csv if len ( argv ) < 12 : print "Wrong call.  Not enough arguments.\n" usage ( ) sys . exit ( 1 ) else : # we may be in business g_script_name = os . path . basename ( argv [ 0 ] ) # get name of script being run. g_timestamp = float ( argv [ 1 ] ) g_job_name = argv [ 2 ] g_build_id = argv [ 3 ] g_git_hash = argv [ 4 ] g_node_name = argv [ 5 ] g_unit_test_type = argv [ 6 ] g_jenkins_url = argv [ 7 ] localtz = time . tzname [ 0 ] dt = parser . parse ( time . ctime ( g_timestamp ) + ' ' + localtz ) g_timestring = dt . strftime ( "%a %b %d %H:%M:%S %Y %Z" ) g_temp_filename = os . path . join ( g_test_root_dir , 'tempText' ) g_summary_text_filename = os . path . join ( g_test_root_dir , argv [ 8 ] ) g_failed_tests_dict = os . path . join ( g_test_root_dir , argv [ 9 ] ) monthToKeep = float ( argv [ 10 ] ) g_daily_failure_csv = os . path . join ( g_test_root_dir , argv [ 11 ] ) g_resource_url = '/' . join ( [ g_jenkins_url , "job" , g_job_name , g_build_id ] ) get_console_out ( g_resource_url + "/#showFailuresLink/" ) # save remote console output in local directory extract_failed_tests_info ( ) # grab the console text and stored the failed tests/paths save_failed_tests_info ( ) # save new failed test info into a file if monthToKeep > 0 : trim_data_back_to ( monthToKeep )
Main program.  Expect script name plus 7 inputs in the following order:
    - This script name
    1. timestamp: time in s
    2. jenkins_job_name (JOB_NAME)
    3. build_id (BUILD_ID)
    4. git hash (GIT_COMMIT)
    5. node name (NODE_NAME)
    6. unit test category (JUnit, PyUnit, RUnit, Hadoop)
    7. Jenkins URL (JENKINS_URL)
    8. Text file name where failure summaries are stored
    9. Filename that stored all failed test info as a dictionary
    10. duration (month) to keep data: data older tghan this input will be removed

    @return: none
Main program . Expect script name plus 7 inputs in the following order : - This script name 1 . timestamp : time in s 2 . jenkins_job_name ( JOB_NAME ) 3 . build_id ( BUILD_ID ) 4 . git hash ( GIT_COMMIT ) 5 . node name ( NODE_NAME ) 6 . unit test category ( JUnit PyUnit RUnit Hadoop ) 7 . Jenkins URL ( JENKINS_URL ) 8 . Text file name where failure summaries are stored 9 . Filename that stored all failed test info as a dictionary 10 . duration ( month ) to keep data : data older tghan this input will be removed