Beispiel #1
0
def test_noncontiguous_defectid_creation():
    """
    Test that defects are inserted correctly into non-contiguous ranges
    """
    ddb = DefectsDB(TEST_DATABASE, read_only=False)

    create_defect_type(ddb, 0)
    ddb._create_defect_with_id(2, "TEST_DEFECT_DQD_2", "")
    ddb.new_virtual_defect("DQD_TEST_VIRTUAL_DEFECT", "Comment",
                           "DQD_TEST_DEFECT_0 TEST_DEFECT_DQD_2")
    ddb.new_virtual_defect("DQD_TEST_VIRTUAL_DEFECT_2", "Comment",
                           "DQD_TEST_DEFECT_0 TEST_DEFECT_DQD_2")
    create_defect_type(ddb, 1)
    create_defect_type(ddb, 3)
    # assert primary and virtual defects are right
    ids, names, m = ddb.get_channels()
    assert m == {
        0: 'DQD_TEST_DEFECT_0',
        1: 'DQD_TEST_DEFECT_1',
        2: 'TEST_DEFECT_DQD_2',
        3: 'DQD_TEST_DEFECT_3',
        'DQD_TEST_DEFECT_3': 3,
        'DQD_TEST_DEFECT_0': 0,
        'DQD_TEST_DEFECT_1': 1,
        'TEST_DEFECT_DQD_2': 2
    }, 'Primary defect problem'
    ids, names, m = ddb.get_virtual_channels()
    assert m == {
        2147483648: 'DQD_TEST_VIRTUAL_DEFECT',
        2147483649: 'DQD_TEST_VIRTUAL_DEFECT_2',
        'DQD_TEST_VIRTUAL_DEFECT': 2147483648,
        'DQD_TEST_VIRTUAL_DEFECT_2': 2147483649
    }, 'Virtual defect problem'
Beispiel #2
0
                      help='Set DQ flag database (connection string format as in DQUtils.db.Databases)')

    opts, args = parser.parse_args()

    # get virtual flag IOVs
    import VirtualFlags, DQUtils
    from DQDefects import DefectsDB
    print 'Getting virtual flag information...',
    vfdb = DQUtils.db.Databases.get_folder(opts.vfdb)
    vff = VirtualFlags.VirtualFlagFolder(vfdb)
    mapping = vff.get_flag_name_id_mapping()
    print 'done'

    print 'Getting virtual defect information...',
    ddb = DefectsDB(opts.defectdb, read_only=True)
    defectids, defectnames, defectdict = ddb.get_virtual_channels()
    print 'done'

    print 'Retrieving run ends...',
    runends = get_runends()
    print 'done'
 
    for key in mapping:
        if not isinstance(key, basestring): continue
        #if '_' in key: continue
        if key not in defectdict or key in ['IDPF', 'LCD', 'MET', 'IDBCM', 'TIGB']:
            print 'MISSING:', key
            continue
        print key,
        vfiovs = do_compact(vff.browseObjects((152166,0), (167845,0), [key], 'DetStatus-v03-repro05-01', selection=lambda x: x.Code < 3))
        #print vfiovs