当前位置: 首页>>代码示例>>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;未经允许,请勿转载。