Пример #1
0
with open('{0}/davinci_simulation.py'.format(base), 'w') as f:
    input_type = modeconfig[mode]['stream'].split('.')[-1]
    f.write((
        'from helpers import davinci\n\n'
        "davinci.configure(year={1}, mc=True, input_type='{0}',"
        "n_events={2}, root={3}, tfn='{4}')\n"
    ).format(input_type, year, 10000 if args.test else -1, ROOT, tfn))

print('Created all helper files for the options.')
print('Options files:' + ' '.join([s.format(path=base, year=year) for s in OPTIONS]))  # NOQA

j = Job(name=JNAME.format(
    polarity, year, mode
))
j.comment = (
    '{1} {2} MC {0} ntuple creation for k3pi mixing measurement.'
    .format(event_type, year, polarity)
)
j.application = DaVinci(version='v41r3')
j.application.optsfile = [s.format(path=base, year=year) for s in OPTIONS]

if args.test:
    # If testing, run over a couple of files locally,
    # saving the results to the sandbox
    j.inputdata = dataset[0:1]
    j.backend = Local()
    # Prepend test string to job name
    j.name = 'TEST_{0}'.format(j.name)
    j.outputfiles = [LocalFile(tfn)]
else:
    # If not testing, run over everything on the grid, splitting jobs
    # into groups of 10 files, notifying me on job completion/subjob failure,