From a0bbd92bcfda1cb26efd5eb40f99bf57ec8ea131 Mon Sep 17 00:00:00 2001 From: Mark Jordan Date: Thu, 17 Aug 2023 07:25:18 -0700 Subject: [PATCH] Resolves #676; WIP on #487. --- tests/assets/secondary_task_test/create.yml | 4 ++-- tests/assets/secondary_task_test/delete.yml | 4 ++-- tests/assets/secondary_task_test/secondary_create.yml | 4 ++-- tests/islandora_tests.py | 3 ++- workbench | 3 +++ 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/assets/secondary_task_test/create.yml b/tests/assets/secondary_task_test/create.yml index b8dfbfe5..94533760 100644 --- a/tests/assets/secondary_task_test/create.yml +++ b/tests/assets/secondary_task_test/create.yml @@ -1,7 +1,7 @@ task: create -host: "http://localhost:8000" +host: https://islandora.traefik.me username: admin -password: islandora +password: password input_dir: "tests/assets/secondary_task_test" nodes_only: true secondary_tasks: ['tests/assets/secondary_task_test/secondary_create.yml'] diff --git a/tests/assets/secondary_task_test/delete.yml b/tests/assets/secondary_task_test/delete.yml index 08dfe9ac..c7a2328b 100644 --- a/tests/assets/secondary_task_test/delete.yml +++ b/tests/assets/secondary_task_test/delete.yml @@ -1,6 +1,6 @@ task: delete -host: "http://localhost:8000" +host: https://islandora.traefik.me username: admin -password: islandora +password: password input_dir: "tests/assets/secondary_task_test" input_csv: /tmp/workbenchsecondarytasktestnids.txt diff --git a/tests/assets/secondary_task_test/secondary_create.yml b/tests/assets/secondary_task_test/secondary_create.yml index 08b1d01f..86f0c5f2 100644 --- a/tests/assets/secondary_task_test/secondary_create.yml +++ b/tests/assets/secondary_task_test/secondary_create.yml @@ -1,7 +1,7 @@ task: create -host: "http://localhost:8000" +host: https://islandora.traefik.me username: admin -password: islandora +password: password input_dir: "tests/assets/secondary_task_test" nodes_only: true csv_field_templates: diff --git a/tests/islandora_tests.py b/tests/islandora_tests.py index fe2f5643..c626b518 100644 --- a/tests/islandora_tests.py +++ b/tests/islandora_tests.py @@ -428,7 +428,8 @@ def tearDown(self): preprocessed_csv_path = os.path.join(self.current_dir, 'assets', 'secondary_task_test', 'metadata.csv.preprocessed') if os.path.exists(preprocessed_csv_path): os.remove(preprocessed_csv_path) - secondary_preprocessed_csv_path = os.path.join(self.current_dir, 'assets', 'secondary_task_test', 'secondary.csv.preprocessed') + + secondary_preprocessed_csv_path = os.path.join(self.temp_dir, 'secondary.csv.preprocessed') if os.path.exists(secondary_preprocessed_csv_path): os.remove(secondary_preprocessed_csv_path) diff --git a/workbench b/workbench index c50926be..e372146e 100755 --- a/workbench +++ b/workbench @@ -35,6 +35,8 @@ def create(): # If this is a secondary task, use the primary tasks execution start time. if os.environ.get('ISLANDORA_WORKBENCH_SECONDARY_TASKS') is not None: if os.path.abspath(args.config) in json.loads(os.environ["ISLANDORA_WORKBENCH_SECONDARY_TASKS"]): + # Ensure that query_csv_id_to_node_id_map_for_parents is True. + config['query_csv_id_to_node_id_map_for_parents'] = True workbench_execution_start_time = os.environ.get('ISLANDORA_WORKBENCH_PRIMARY_TASK_EXECUTION_START_TIME') else: message = "'ignore_existing_parent_ids' is set to false, parent IDs from previous Workbench sessions will be used." @@ -152,6 +154,7 @@ def create(): # Since all nodes, both ones just created and also ones created in previous runs of # Workbench, may have entries in the node ID map database, we always query it. if config['query_csv_id_to_node_id_map_for_parents'] is True and config['csv_id_to_node_id_map_path'] is not False and 'parent_id' in row and row['parent_id'] is not None: + parent_node_ids_from_id_map = [] current_parent_node_id = '' if config['ignore_duplicate_parent_ids'] is True: query = "select node_id from csv_id_to_node_id_map where csv_id = ? order by timestamp desc limit 1"