obi cat: fixed open file descriptor leak and switch to version 3.0.0b34
This commit is contained in:
@ -48,9 +48,9 @@ def run(config):
|
|||||||
|
|
||||||
logger("info", "obi cat")
|
logger("info", "obi cat")
|
||||||
|
|
||||||
# Open the views to concatenate
|
# Check the views to concatenate
|
||||||
iview_list = []
|
|
||||||
idms_list = []
|
idms_list = []
|
||||||
|
iview_list = []
|
||||||
total_len = 0
|
total_len = 0
|
||||||
remove_qual = False
|
remove_qual = False
|
||||||
remove_rev_qual = False
|
remove_rev_qual = False
|
||||||
@ -68,8 +68,9 @@ def run(config):
|
|||||||
if REVERSE_QUALITY_COLUMN not in i_view: # same as above for reverse quality
|
if REVERSE_QUALITY_COLUMN not in i_view: # same as above for reverse quality
|
||||||
remove_rev_qual = True
|
remove_rev_qual = True
|
||||||
total_len += len(i_view)
|
total_len += len(i_view)
|
||||||
iview_list.append(i_view)
|
|
||||||
idms_list.append(i_dms)
|
idms_list.append(i_dms)
|
||||||
|
iview_list.append(i_view.name)
|
||||||
|
i_view.close()
|
||||||
|
|
||||||
# Open the output: only the DMS
|
# Open the output: only the DMS
|
||||||
output = open_uri(config['obi']['outputURI'],
|
output = open_uri(config['obi']['outputURI'],
|
||||||
@ -98,8 +99,10 @@ def run(config):
|
|||||||
# Initialize multiple elements columns
|
# Initialize multiple elements columns
|
||||||
if type(output_0)==BufferedWriter:
|
if type(output_0)==BufferedWriter:
|
||||||
dict_cols = {}
|
dict_cols = {}
|
||||||
for v in iview_list:
|
for v_uri in config["cat"]["views_to_cat"]:
|
||||||
|
v = open_uri(v_uri)[1]
|
||||||
for coln in v.keys():
|
for coln in v.keys():
|
||||||
|
col = v[coln]
|
||||||
if v[coln].nb_elements_per_line > 1:
|
if v[coln].nb_elements_per_line > 1:
|
||||||
if coln not in dict_cols:
|
if coln not in dict_cols:
|
||||||
dict_cols[coln] = {}
|
dict_cols[coln] = {}
|
||||||
@ -109,6 +112,7 @@ def run(config):
|
|||||||
else:
|
else:
|
||||||
dict_cols[coln]['eltnames'] = set(v[coln].elements_names + list(dict_cols[coln]['eltnames']))
|
dict_cols[coln]['eltnames'] = set(v[coln].elements_names + list(dict_cols[coln]['eltnames']))
|
||||||
dict_cols[coln]['nbelts'] = len(dict_cols[coln]['eltnames'])
|
dict_cols[coln]['nbelts'] = len(dict_cols[coln]['eltnames'])
|
||||||
|
v.close()
|
||||||
for coln in dict_cols:
|
for coln in dict_cols:
|
||||||
Column.new_column(o_view, coln, dict_cols[coln]['obitype'],
|
Column.new_column(o_view, coln, dict_cols[coln]['obitype'],
|
||||||
nb_elements_per_line=dict_cols[coln]['nbelts'], elements_names=list(dict_cols[coln]['eltnames']))
|
nb_elements_per_line=dict_cols[coln]['nbelts'], elements_names=list(dict_cols[coln]['eltnames']))
|
||||||
@ -120,7 +124,8 @@ def run(config):
|
|||||||
pb = None
|
pb = None
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
for v in iview_list:
|
for v_uri in config["cat"]["views_to_cat"]:
|
||||||
|
v = open_uri(v_uri)[1]
|
||||||
for entry in v:
|
for entry in v:
|
||||||
PyErr_CheckSignals()
|
PyErr_CheckSignals()
|
||||||
if pb is not None:
|
if pb is not None:
|
||||||
@ -131,6 +136,7 @@ def run(config):
|
|||||||
else:
|
else:
|
||||||
o_view[i] = entry
|
o_view[i] = entry
|
||||||
i+=1
|
i+=1
|
||||||
|
v.close()
|
||||||
|
|
||||||
# Deletes quality columns if needed
|
# Deletes quality columns if needed
|
||||||
if type(output_0)!=BufferedWriter:
|
if type(output_0)!=BufferedWriter:
|
||||||
@ -145,7 +151,7 @@ def run(config):
|
|||||||
|
|
||||||
# Save command config in DMS comments
|
# Save command config in DMS comments
|
||||||
command_line = " ".join(sys.argv[1:])
|
command_line = " ".join(sys.argv[1:])
|
||||||
o_view.write_config(config, "cat", command_line, input_dms_name=[d.name for d in idms_list], input_view_name=[v.name for v in iview_list])
|
o_view.write_config(config, "cat", command_line, input_dms_name=[d.name for d in idms_list], input_view_name=[vname for vname in iview_list])
|
||||||
o_dms.record_command_line(command_line)
|
o_dms.record_command_line(command_line)
|
||||||
|
|
||||||
#print("\n\nOutput view:\n````````````", file=sys.stderr)
|
#print("\n\nOutput view:\n````````````", file=sys.stderr)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
major = 3
|
major = 3
|
||||||
minor = 0
|
minor = 0
|
||||||
serial= '0b33'
|
serial= '0b34'
|
||||||
|
|
||||||
version ="%d.%d.%s" % (major,minor,serial)
|
version ="%d.%d.%s" % (major,minor,serial)
|
||||||
|
Reference in New Issue
Block a user