all commands (almost): cleaner DMS closing at the end

This commit is contained in:
Celine Mercier
2020-04-12 17:31:58 +02:00
parent eef5156d95
commit 4d0299904e
16 changed files with 31 additions and 26 deletions

View File

@ -266,9 +266,9 @@ def run(config):
# If the input and the output DMS are different, delete the temporary result view in the input DMS # If the input and the output DMS are different, delete the temporary result view in the input DMS
if i_dms != o_dms: if i_dms != o_dms:
View.delete_view(i_dms, o_view_name) View.delete_view(i_dms, o_view_name)
o_dms.close() o_dms.close(force=True)
i_dms.close() i_dms.close(force=True)
logger("info", "Done.") logger("info", "Done.")

View File

@ -247,10 +247,10 @@ def run(config):
#print("\n\nOutput view:\n````````````", file=sys.stderr) #print("\n\nOutput view:\n````````````", file=sys.stderr)
#print(repr(view), file=sys.stderr) #print(repr(view), file=sys.stderr)
input[0].close() input[0].close(force=True)
if two_views: if two_views:
rinput[0].close() rinput[0].close(force=True)
output[0].close() output[0].close(force=True)
logger("info", "Done.") logger("info", "Done.")

View File

@ -379,7 +379,7 @@ def run(config):
# If the input and the output DMS are different, delete the temporary imported view used to create the final view # If the input and the output DMS are different, delete the temporary imported view used to create the final view
if i_dms != o_dms: if i_dms != o_dms:
View.delete_view(o_dms, imported_view_name) View.delete_view(o_dms, imported_view_name)
o_dms.close() o_dms.close(force=True)
i_dms.close() i_dms.close(force=True)
logger("info", "Done.") logger("info", "Done.")

View File

@ -97,9 +97,9 @@ def run(config):
# If the input and the output DMS are different, delete the temporary result view in the input DMS # If the input and the output DMS are different, delete the temporary result view in the input DMS
if i_dms != o_dms: if i_dms != o_dms:
View.delete_view(i_dms, o_view_name) View.delete_view(i_dms, o_view_name)
o_dms.close() o_dms.close(force=True)
i_dms.close() i_dms.close(force=True)
logger("info", "Done.") logger("info", "Done.")

View File

@ -133,7 +133,7 @@ def run(config):
#print(repr(view), file=sys.stderr) #print(repr(view), file=sys.stderr)
for d in idms_list: for d in idms_list:
d.close() d.close(force=True)
o_dms.close() o_dms.close(force=True)
logger("info", "Done.") logger("info", "Done.")

View File

@ -124,8 +124,8 @@ def run(config):
# If the input and the output DMS are different, delete the temporary result view in the input DMS # If the input and the output DMS are different, delete the temporary result view in the input DMS
if i_dms != o_dms: if i_dms != o_dms:
View.delete_view(i_dms, o_view_name) View.delete_view(i_dms, o_view_name)
o_dms.close() o_dms.close(force=True)
i_dms.close() i_dms.close(force=True)
logger("info", "Done.") logger("info", "Done.")

View File

@ -56,3 +56,5 @@ def run(config):
print(count2) print(count2)
else: else:
print(count1) print(count1)
input[0].close(force=True)

View File

@ -86,7 +86,7 @@ def run(config):
if not BrokenPipeError and not IOError: if not BrokenPipeError and not IOError:
output_object.close() output_object.close()
iview.close() iview.close()
input[0].close() input[0].close(force=True)
logger("info", "Done.") logger("info", "Done.")

View File

@ -370,7 +370,7 @@ def run(config):
# If the input and the output DMS are different, delete the temporary imported view used to create the final view # If the input and the output DMS are different, delete the temporary imported view used to create the final view
if i_dms != o_dms: if i_dms != o_dms:
View.delete_view(i_dms, o_view_name) View.delete_view(i_dms, o_view_name)
o_dms.close() o_dms.close(force=True)
i_dms.close() i_dms.close(force=True)
logger("info", "Done.") logger("info", "Done.")

View File

@ -103,7 +103,7 @@ def run(config):
# If the input and the output DMS are different, delete the temporary imported view used to create the final view # If the input and the output DMS are different, delete the temporary imported view used to create the final view
if i_dms != o_dms: if i_dms != o_dms:
View.delete_view(i_dms, o_view_name) View.delete_view(i_dms, o_view_name)
o_dms.close() o_dms.close(force=True)
i_dms.close() i_dms.close(force=True)
logger("info", "Done.") logger("info", "Done.")

View File

@ -55,3 +55,4 @@ def run(config):
else: else:
raise Exception("ASCII history only available for views") raise Exception("ASCII history only available for views")
input[0].close(force=True)

View File

@ -46,5 +46,5 @@ def run(config):
process.wait() process.wait()
iview.close() iview.close()
input[0].close() input[0].close(force=True)

View File

@ -36,6 +36,7 @@ def run(config):
l = [] l = []
for view in input[0]: for view in input[0]:
l.append(tostr(view) + "\t(Date created: " + str(bytes2str_object(dms[view].comments["Date created"]))+")") l.append(tostr(view) + "\t(Date created: " + str(bytes2str_object(dms[view].comments["Date created"]))+")")
dms[view].close()
l.sort() l.sort()
for v in l: for v in l:
print(v) print(v)
@ -52,3 +53,4 @@ def run(config):
print("\n### Comments:") print("\n### Comments:")
print(str(input[1].comments)) print(str(input[1].comments))
input[0].close(force=True)

View File

@ -141,7 +141,7 @@ def run(config):
# If the input and the output DMS are different, delete the temporary imported view used to create the final view # If the input and the output DMS are different, delete the temporary imported view used to create the final view
if i_dms != o_dms: if i_dms != o_dms:
View.delete_view(i_dms, o_view_name) View.delete_view(i_dms, o_view_name)
o_dms.close() o_dms.close(force=True)
i_dms.close() i_dms.close(force=True)
logger("info", "Done.") logger("info", "Done.")

View File

@ -106,7 +106,7 @@ def run(config):
# If the input and the output DMS are different, delete the temporary imported view used to create the final view # If the input and the output DMS are different, delete the temporary imported view used to create the final view
if i_dms != o_dms: if i_dms != o_dms:
View.delete_view(i_dms, o_view_name) View.delete_view(i_dms, o_view_name)
o_dms.close() o_dms.close(force=True)
i_dms.close() i_dms.close(force=True)
logger("info", "Done.") logger("info", "Done.")

View File

@ -529,7 +529,7 @@ def run(config):
test_taxo(config, infos) test_taxo(config, infos)
infos['view'].close() infos['view'].close()
infos['dms'].close() infos['dms'].close(force=True)
shutil.rmtree(config['obi']['defaultdms']+'.obidms', ignore_errors=True) shutil.rmtree(config['obi']['defaultdms']+'.obidms', ignore_errors=True)
print("Done.") print("Done.")