Skip to content
Snippets Groups Projects
Commit 9c14f990 authored by Gerhard Raven's avatar Gerhard Raven
Browse files

adapt to changes in LHCb to allow HltANNSvc configuration from input manifest

parent 7ad7794a
No related branches found
No related tags found
2 merge requests!1103Draft: Add AnalysisHelpers to DaVinci Stack,!733Adapt to LHCb!3528 - Enforce use of an encoding/decoding key (TCK) in all Hlt encoders/decoders, do not use online-reserved bits in SourceID, remove explicit mention of 'packed' locations, enable 'stable' persist reco locations
......@@ -15,7 +15,6 @@ from PyConf.application import configure, configure_input, configured_ann_svc
from PyConf.Algorithms import EventAccounting
from DaVinci.algorithms import (define_fsr_writer, apply_filters_and_unpacking)
from DaVinci.config import davinci_control_flow, prepare_davinci_nodes
from .utils import load_file
from PyConf.application import metainfo_repos
from Configurables import ApplicationMgr
......@@ -40,10 +39,13 @@ def add_davinci_configurables(options, user_algorithms, public_tools):
config = configure_input(options)
if options.input_manifest_file:
metainfo_repos.global_bind(
extra_central_tags=options.metainfo_additional_tags)
if options.metainfo_additional_tags:
metainfo_repos.global_bind(
extra_central_tags=options.metainfo_additional_tags)
ApplicationMgr().ExtSvc += [configured_ann_svc()]
ApplicationMgr().ExtSvc += [
configured_ann_svc(json_file=options.input_manifest_file)
]
elif options.annsvc_config: # this should be renamed to input_manifest_file
# distinguish between configuring the ANNSvc for decoding, and getting
......@@ -51,8 +53,7 @@ def add_davinci_configurables(options, user_algorithms, public_tools):
# do with the ANNSvc)
# Here we only do the decoding part. The unpacking manifest part we
# do in apply_filters_and_unpacking...
config.add(
configured_ann_svc(json_file=load_file(options.annsvc_config)))
config.add(configured_ann_svc(json_file=options.annsvc_config))
dvMainFlow = apply_filters_and_unpacking(options, user_algorithms,
unpack_only_mc)
......
###############################################################################
# (c) Copyright 2022 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
import os, XRootD.client
def load_file(fname):
if not fname: return None
if fname.startswith("root://eoslhcb.cern.ch//"):
with XRootD.client.File() as f:
status, _ = f.open(str(fname))
if not status.ok:
raise RuntimeError(f"could not open {fname}: {status.message}")
status, data = f.read()
if not status.ok:
raise RuntimeError(f"could not read {fname}: {status.message}")
return data.decode('utf-8')
else:
with open(os.path.expandvars(fname)) as f:
data = f.read()
return data.decode('utf-8')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment