The Gaudi Framework  v33r0 (d5ea422b)
__init__.py
Go to the documentation of this file.
1 
11 def getMetaData(path):
12  '''
13  Extract job metadata recorded by Gaudi::MetaDataSvc from a file.
14  '''
15  from cppyy.gbl import TFile
16  f = TFile.Open(path)
17  if not f:
18  raise RuntimeError('cannot open {0}'.format(path))
19  try:
20  # return dict((i.first, i.second) for i in f.info)
21  # FIXME: workaround for https://sft.its.cern.ch/jira/browse/ROOT-10474
22  import cppyy
23  cppyy.gbl.gInterpreter.Declare(r'''
24  #include <map>
25  #include <string>
26  #include <sstream>
27  auto get_keys(const std::map<std::string, std::string>& m) {
28  std::stringstream s;
29  for(auto& i: m) {
30  s << i.first << '\n';
31  }
32  return s.str();
33  }
34  ''')
35  keys = str(cppyy.gbl.get_keys(f.info)).strip().split('\n')
36  return dict((k, f.info[k]) for k in keys)
37  except AttributeError:
38  return {}
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
def getMetaData(path)
(c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations # # This software i...
Definition: __init__.py:11