17 from __future__
import absolute_import
18 from __future__
import print_function
22 import sys, subprocess, json
23 from larbatch_utilities
import convert_str
33 jobinfo = subprocess.Popen([
'sam_metadata_dumper', inputfile],
34 stdout=subprocess.PIPE,
35 stderr=subprocess.PIPE)
36 jobout, joberr = jobinfo.communicate()
41 raise RuntimeError(
'sam_metadata_dumper failed with status %d' % rc)
47 n = jobout.find(
'"runs"')
49 m = jobout.rfind(
'\n', 0, n)
51 json_str = jobout[:m+1]
52 k = jobout.find(
'\n', n)
54 json_str += jobout[k+1:]
60 js = json.loads(json_str)
65 if 'data_stream' in md:
66 result = md[
'data_stream']
68 raise RuntimeError(
'Sam metadata does not contain stream.')
76 if __name__ ==
"__main__":
do one_file $F done echo for F in find $TOP name CMakeLists txt print