From ec874c095b3da9b4f4d4dc2a35090bef3a7abd05 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Fri, 20 Sep 2019 20:38:25 +0200 Subject: [PATCH] new command: clean_dms to clean and unlock a DMS after a bad exit. --- python/obitools3/commands/clean_dms.pyx | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 python/obitools3/commands/clean_dms.pyx diff --git a/python/obitools3/commands/clean_dms.pyx b/python/obitools3/commands/clean_dms.pyx new file mode 100755 index 0000000..4d4eb4a --- /dev/null +++ b/python/obitools3/commands/clean_dms.pyx @@ -0,0 +1,27 @@ +#cython: language_level=3 + +from obitools3.apps.optiongroups import addMinimalInputOption +from obitools3.uri.decode import open_uri +from obitools3.dms import DMS +from obitools3.dms.capi.obidms cimport obi_clean_dms +from obitools3.apps.config import logger +from obitools3.utils cimport tobytes + + +__title__="Clean a DMS from unfinished views and columns" + + +def addOptions(parser): + addMinimalInputOption(parser) + + +def run(config): + + DMS.obi_atexit() + + logger("info", "obi clean_dms") + + if obi_clean_dms(tobytes(config['obi']['inputURI'])) < 0 : + raise Exception("Error cleaning DMS", config['obi']['inputURI']) + + logger("info", "Done.")