obi import: added --space-priority option to import a view line by line
This commit is contained in:
@ -77,6 +77,11 @@ def addOptions(parser):
|
|||||||
help="Do a first readthrough of the dataset if it contains huge dictionaries (more than 100 keys) for "
|
help="Do a first readthrough of the dataset if it contains huge dictionaries (more than 100 keys) for "
|
||||||
"a much faster import. This option is not recommended and will slow down the import in any other case.")
|
"a much faster import. This option is not recommended and will slow down the import in any other case.")
|
||||||
|
|
||||||
|
group.add_argument('--space-priority',
|
||||||
|
action="store_true", dest="import:space_priority",
|
||||||
|
default=False,
|
||||||
|
help="If importing a view into another DMS, do it by importing each line, saving disk space if the original view "
|
||||||
|
"has a line selection associated.")
|
||||||
|
|
||||||
def run(config):
|
def run(config):
|
||||||
|
|
||||||
@ -142,7 +147,7 @@ def run(config):
|
|||||||
else:
|
else:
|
||||||
v = None
|
v = None
|
||||||
|
|
||||||
if config['obi']['taxdump'] or isinstance(input[1], View):
|
if config['obi']['taxdump'] or (isinstance(input[1], View) and not config['import']['space_priority']):
|
||||||
dms_only=True
|
dms_only=True
|
||||||
else:
|
else:
|
||||||
dms_only=False
|
dms_only=False
|
||||||
@ -170,12 +175,15 @@ def run(config):
|
|||||||
logger("info", "Done.")
|
logger("info", "Done.")
|
||||||
return
|
return
|
||||||
|
|
||||||
# If importing a view between two DMS, use C API
|
# If importing a view between two DMS and not wanting to save space if line selection in original view, use C API
|
||||||
if isinstance(input[1], View):
|
if isinstance(input[1], View) and not config['import']['space_priority']:
|
||||||
if obi_import_view(input[0].name_with_full_path, o_dms.name_with_full_path, input[1].name, tobytes((config['obi']['outputURI'].split('/'))[-1])) < 0 :
|
if obi_import_view(input[0].name_with_full_path, o_dms.name_with_full_path, input[1].name, tobytes((config['obi']['outputURI'].split('/'))[-1])) < 0 :
|
||||||
|
input[0].close(force=True)
|
||||||
|
output[0].close(force=True)
|
||||||
raise Exception("Error importing a view in a DMS")
|
raise Exception("Error importing a view in a DMS")
|
||||||
o_dms.record_command_line(" ".join(sys.argv[1:]))
|
o_dms.record_command_line(" ".join(sys.argv[1:]))
|
||||||
o_dms.close()
|
input[0].close(force=True)
|
||||||
|
output[0].close(force=True)
|
||||||
logger("info", "Done.")
|
logger("info", "Done.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user