當前位置: 首頁>>代碼示例>>Python>>正文


Python Client.add_datasets方法代碼示例

本文整理匯總了Python中rucio.client.Client.add_datasets方法的典型用法代碼示例。如果您正苦於以下問題:Python Client.add_datasets方法的具體用法?Python Client.add_datasets怎麽用?Python Client.add_datasets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rucio.client.Client的用法示例。


在下文中一共展示了Client.add_datasets方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: EMULATION_RUN

# 需要導入模塊: from rucio.client import Client [as 別名]
# 或者: from rucio.client.Client import add_datasets [as 別名]

#.........這裏部分代碼省略.........
                       ('data12_8TeV.NNNNNNNN.physics_JetTauEtmiss.merge.DESD_CALJET.f2_m6', 71),
                       ('data12_8TeV.NNNNNNNN.physics_JetTauEtmiss.merge.HIST.f2_m1', 1),
                       ('data12_8TeV.NNNNNNNN.physics_JetTauEtmiss.merge.NTUP_FASTMON.f2_m4_m8', 27),
                       ('data12_8TeV.NNNNNNNN.physics_JetTauEtmiss.merge.RAW', 3624),
                       ('data12_8TeV.NNNNNNNN.physics_JetTauEtmiss.merge.TAG.f2_m4_m3', 8),
                       ('data12_8TeV.NNNNNNNN.physics_JetTauEtmiss.recon.ESD.f2', 3624),
                       ('data12_8TeV.NNNNNNNN.physics_MinBias.merge.AOD.f2_m4', 21),
                       ('data12_8TeV.NNNNNNNN.physics_MinBias.merge.DESD_MBIAS.f2_m6', 24),
                       ('data12_8TeV.NNNNNNNN.physics_MinBias.merge.HIST.f2_m1', 1),
                       ('data12_8TeV.NNNNNNNN.physics_MinBias.merge.RAW', 403),
                       ('data12_8TeV.NNNNNNNN.physics_MinBias.merge.TAG.f2_m4_m3', 1),
                       ('data12_8TeV.NNNNNNNN.physics_MinBias.recon.ESD.f2', 403),
                       ('data12_8TeV.NNNNNNNN.physics_Muons.merge.AOD.f2_m4', 334),
                       ('data12_8TeV.NNNNNNNN.physics_Muons.merge.DESDM_RPVLL.f2_m6', 54),
                       ('data12_8TeV.NNNNNNNN.physics_Muons.merge.DESD_SGLMU.f2_m6', 254),
                       ('data12_8TeV.NNNNNNNN.physics_Muons.merge.DRAW_ZMUMU.f2_m9', 47),
                       ('data12_8TeV.NNNNNNNN.physics_Muons.merge.HIST.f2_m1', 1),
                       ('data12_8TeV.NNNNNNNN.physics_Muons.merge.NTUP_FASTMON.f2_m4_m8', 19),
                       ('data12_8TeV.NNNNNNNN.physics_Muons.merge.RAW', 3629),
                       ('data12_8TeV.NNNNNNNN.physics_Muons.merge.TAG.f2_m4_m3', 7),
                       ('data12_8TeV.NNNNNNNN.physics_Muons.recon.DAOD_ZMUMU.f2_m9_f1', 47),
                       ('data12_8TeV.NNNNNNNN.physics_Muons.recon.DESD_ZMUMU.f2_m9_f1', 47),
                       ('data12_8TeV.NNNNNNNN.physics_Muons.recon.ESD.f2', 3629),
                       ('data12_8TeV.NNNNNNNN.physics_Standby.merge.AOD.x1_m4', 2),
                       ('data12_8TeV.NNNNNNNN.physics_Standby.merge.HIST.x1_m1', 1),
                       ('data12_8TeV.NNNNNNNN.physics_Standby.merge.RAW', 24),
                       ('data12_8TeV.NNNNNNNN.physics_Standby.merge.TAG.x1_m4_m3', 1),
                       ('data12_8TeV.NNNNNNNN.physics_Standby.recon.ESD.x1', 24),
                       ('data12_8TeV.NNNNNNNN.physics_ZeroBias.merge.AOD.f2_m4', 21),
                       ('data12_8TeV.NNNNNNNN.physics_ZeroBias.merge.AOD.x1_m4', 21),
                       ('data12_8TeV.NNNNNNNN.physics_ZeroBias.merge.HIST.f2_m1', 1),
                       ('data12_8TeV.NNNNNNNN.physics_ZeroBias.merge.HIST.x1_m1', 1),
                       ('data12_8TeV.NNNNNNNN.physics_ZeroBias.merge.RAW', 402),
                       ('data12_8TeV.NNNNNNNN.physics_ZeroBias.merge.TAG.f2_m4_m3', 1),
                       ('data12_8TeV.NNNNNNNN.physics_ZeroBias.merge.TAG.x1_m4_m3', 1),
                       ('data12_8TeV.NNNNNNNN.physics_ZeroBias.recon.ESD.f2', 402),
                       ('data12_8TeV.NNNNNNNN.physics_ZeroBias.recon.ESD.x1', 402),
                       ('data12_8TeV.NNNNNNNN.physics_ZeroBiasOverlay.merge.RAW', 404),
                       ('data12_calib.0NNNNNNNN.calibration_MuonAll.daq.RAW', 70),
                       ]

        factor = runnumber / runspertag
        tagdict = {'x1': 'x%s' % (factor * 1 + 1),
                   'f1': 'f%s' % (factor * 2 + 1),
                   'f2': 'f%s' % (factor * 2 + 2),
                   'm1': 'm%s' % (factor * 10 + 1),
                   'm2': 'm%s' % (factor * 10 + 2),
                   'm3': 'm%s' % (factor * 10 + 3),
                   'm4': 'm%s' % (factor * 10 + 4),
                   'm6': 'm%s' % (factor * 10 + 6),
                   'm8': 'm%s' % (factor * 10 + 8),
                   'm9': 'm%s' % (factor * 10 + 9)
                   }

        # pre compute all datasets
        success = False
        while not success:
            try:
                ds = []
                tmp_uuid = uuid()
                for n, s in pattern:
                    # newname = n.replace('data12', dataXX).replace('NNNNNNNN', str(runnumber).zfill(8)) % tagdict
                    # TODO: fix when meta-data is working properly
                    newname = n.replace('data12', dataXX).replace('NNNNNNNN', tmp_uuid) % tagdict
                    newscope = newname.split('.')[0]
                    newsize = s * filescale
                    ds.append([newscope, newname, newsize, 0])  # 0 is initial value of file counter

                # register run number
                # client.add_value('run_number', runnumber)

                # open all datasets
                open_ds = list()
                for scope, datasetname, s, c in ds:
                    pcs = datasetname.split('.')
                    meta = {'project': pcs[0],
                            'stream_name': pcs[2],
                            'prod_step': pcs[3],
                            'datatype': pcs[4],
                            # 'version': pcs[5],
                            'guid': uuid(),
                            }
                    meta['group'] = tz_group
                    meta['provenance'] = tz_provenance
                    meta['run_number'] = runnumber
                    open_ds.append({'scope': scope, 'name': datasetname,
                                    'statuses': {'monotonic': True}, 'meta': meta,
                                    'rules': [{'account': tz_account, 'copies': 1,
                                               'rse_expression': tz_rse, 'grouping': 'DATASET'}]})  # The missing lifetime attribute indicated an infinite lifetime
                with monitor.record_timer_block(['emulator.tzero.client.add_datasets', ('emulator.tzero.client.add_datasets.normalized', len(open_ds))]):
                    client.add_datasets(open_ds)
                monitor.record_counter('emulator.tzero.client.datasets', len(open_ds))
                # dids = [{'scope': d['scope'], 'name': d['name']} for d in open_ds]
                # with monitor.record_timer_block(['tzero.add_replication_rule', ('tzero.add_replication_rule.normalized', len(open_ds))]):
                #    client.add_replication_rule(dids, copies=1, rse_expression=tz_rse,
                #                                grouping='DATASET', account=tz_account)
                success = True
            except Exception, e:
                monitor.record_counter('emulator.exceptions.tzero.EMULATION_RUN.%s' % e.__class__.__name__, 1)
                print traceback.format_exc()
開發者ID:pombredanne,項目名稱:rucio,代碼行數:104,代碼來源:tzero.py


注:本文中的rucio.client.Client.add_datasets方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。