Ejemplo n.º 1
0
def update_bundle_installer(table_name, bundle_root, products, DVD_names, date):
    logger = logging.getLogger(__name__)
    model = Model(table_name)
    column_list = ['bundle_path',]
    exist_bundles = [record['bundle_path'] for record in model.select(column_list)]
    bundle_folders = bundle.retrieve_bundle_folders(bundle_root, date)
    for bundle_folder in bundle_folders:
        if remove_path_prefix(bundle_folder) in exist_bundles:
            continue
        logger.info('Handle bundle installer: %s', bundle_folder)
        try:
            record = bundle.get_bundle_record(bundle_folder, products, DVD_names)
            logger.info('The record is: %s', record)
            table_record = {
                    'bundle_path': remove_path_prefix(record['bundle_path']),
                    'toolkit_path': remove_path_prefix(record['installer_path']),
                    'lv_version': record['lvVersion'],
                    'lv_api_version': record['lvAPIVersion'],
                    'safemode': record['safemode'],
                    'actual_size': record['actual_size'],
                    'dedupe_size': record['idea_size']
                    }
            model.insert(table_record)
        except Exception as e:
            logger.warning('Exception happened: %s', e)
Ejemplo n.º 2
0
def update_stack_test_results(root_folder, rating_dict, default_weight):
    LogConfig.init_logging()
    logger = logging.getLogger(__name__)
    daily_folders = testing.get_daily_directories(root_folder)
    model = Model('stack_test_result')
    column_list = ['daily_folder',]
    parsed_folders = [record['daily_folder'] for record in model.select(column_list)]
    
    for daily_folder in daily_folders:
        if daily_folder in parsed_folders:
            continue
        try:
            daily_results = testing.get_daily_results_from_daily_directory(daily_folder)
            parsed_results = testing.parse_test_result(daily_results, 
                    rating_dict, default_weight)
            crio_date = parsed_results['crio_date']
            results = parsed_results['results']
            for os_name, pass_rates in results.items():
                for target_model, pass_rate in pass_rates.items():
                    table_record = {
                            'daily_folder': daily_folder,
                            'validated_stack': crio_date,
                            'os_name': os_name,
                            'target_name': target_model,
                            'pass_rate': pass_rate
                    }
                    model.insert(table_record)
        except Exception as e:
            logger.warning('Exception happened: %s', e)
Ejemplo n.º 3
0
def update_table():
    if not session.get('logged_in'):
        abort(401) 
    table_name = request.form['table_name']
    key_name = request.form['key_name']
    primary_key = request.form['primary_key']
    comments = request.form['comments']
    print table_name, primary_key, comments
    print key_name
    model = Model(table_name)
    condition_dict = {key_name: primary_key}
    column_dict = {'comment': comments}
    model.update(column_dict, condition_dict, like=True)
    return jsonify(status='success')
Ejemplo n.º 4
0
def get_sanity_test_result(stack_name, bottom_line=1.0):
    model = Model('stack_test_result')
    column_list = ['pass_rate']
    condition_dict = { 'validated_stack': stack_name }
    records = model.select(column_list, condition_dict)
    pass_rates = [record['pass_rate'] for record in records]
    average_pass_rates = float(sum(pass_rates))/len(pass_rates) \
                if len(pass_rates) > 0 else -1
    if average_pass_rates == -1:
        return 'Not Tested'
    elif average_pass_rates >= bottom_line:
        return 'Pass'
    else:
        return 'Failed'
Ejemplo n.º 5
0
def detailed_sainity_test_result():
    stack_date = request.args.get('stack_date')
    model = Model('stack_test_result')
    column_list = ['daily_folder', 'pass_rate', 'validated_stack',
            'os_name', 'target_name']
    condition_dict = { 'validated_stack': stack_date }
    test_records = model.select(column_list, condition_dict)
    for record in test_records:
        record['test_date'] = record['daily_folder'].split('\\')[-1]
        record['os_folder_path'] = os.path.join(
                record['daily_folder'],
                record['os_name']
                )
    return render_template('detailed_sanity_test_result.html', 
            records = test_records, 
            stack_date = stack_date,
            bottom_line = main_config.SANITY_TEST_BOTTOMLINE)
Ejemplo n.º 6
0
def toolkit_installer_dashboard(name, year):
    if not session.get('logged_in'):
        flash('Please login.')
        return redirect(url_for('welcome'))
    table_name = name+'_'+year+'_toolkit_installer_dashboard'
    key_name = 'installer_path'
    model = Model(table_name)
    column_list = ['installer_path', 'lv_version', 'lv_api_version', 
            'safemode', 'comment']
    records = model.select(column_list)
    records = sorted(records, 
                     key=lambda record: record['installer_path'], 
                     reverse=True)
    for record in records:
        record['installer_date'] = get_date(record['installer_path'])
        record['installer_path'] = add_path_prefix(record['installer_path'],
                main_config.PATH_PREFIX).rstrip('\\')
    return render_template('toolkit_installer_dashboard.html', records=records, 
                           name=name, year=year, table_name = table_name, 
                           key_name = key_name)
Ejemplo n.º 7
0
def myrio_roborio_stack_dashboard(year):
    if not session.get('logged_in'):
        flash('Please login.')
        return redirect(url_for('welcome'))
    table_name = 'myrio_roborio_' + year + '_stack_dashboard'
    key_name = 'validated_stack'
    model = Model(table_name)
    column_list = ['validated_stack', 'validated_stack_url', 'lv_version', 
            'lv_api_version', 'safemode', 'comment']
    records = model.select(column_list)
    records = sorted(records, key=lambda record: record['validated_stack'], 
            reverse=True)
    for record in records:
        stack_date = get_stack_date(record['validated_stack'])
        sanity_test_result = get_sanity_test_result(stack_date, 
                main_config.SANITY_TEST_BOTTOMLINE)
        record['sanity_test_result'] = sanity_test_result

    return render_template('myrio_roborio_stack_dashboard.html', records=records, 
            year=year, table_name=table_name, key_name = key_name)
Ejemplo n.º 8
0
def update_toolkit_installer(table_name, toolkit_folder, name, products, date):
    logger = logging.getLogger(__name__)
    model = Model(table_name)
    column_list = ['installer_path',]
    exist_installers = [record['installer_path'] for record in model.select(column_list)]
    installer_folders = installer.retrieve_installer_folders(toolkit_folder, name, date)
    for installer_folder in installer_folders:
        if remove_path_prefix(installer_folder) in exist_installers:
            continue
        logger.info('Handle toolkit installer: %s', installer_folder)
        try:
            record = installer.get_installer_record(installer_folder, products)
            logger.info('The record is: %s', record)
            table_record = {
                    'installer_path': remove_path_prefix(record['installer_path']),
                    'lv_version': record['lvVersion'],
                    'lv_api_version': record['lvAPIVersion'],
                    'safemode': record['safemode']
                    }
            model.insert(table_record)
        except Exception as e:
            logger.warning('Exception happened: %s', e)
Ejemplo n.º 9
0
def update_stack_dashboard(table_name, stack_web_url, date):
    logger = logging.getLogger(__name__)
    model = Model(table_name)
    column_list = ['validated_stack',]
    exist_stacks = [record['validated_stack'] for record in model.select(column_list)]

    stack_urls = niweb.extract_valid_stack_urls(stack_web_url)
    stack_url_dict = niweb.convert_stackurl_list_to_dict(stack_urls)
    for stack_name in sorted(stack_url_dict.keys()):
        try:
            if newer_than_date(stack_name, date) and stack_name not in exist_stacks:
                logger.info('Construct record for %s', stack_name)
                record = niweb.construct_record_dict(stack_url_dict[stack_name])
                table_record = {
                        'validated_stack': record['Validated Stack'],
                        'validated_stack_url': record['stackUrl'],
                        'lv_version': record['lvVersion'],
                        'lv_api_version': record['lvAPIVersion'],
                        'safemode': record['Safemode']
                        }
                logger.info('The record is: %s', record)
                model.insert(table_record)
        except Exception as e:
            logger.warning('Exception happened: %s', e)