Skip to content

Commit

Permalink
Resolves #676; WIP on #487.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjordan committed Aug 17, 2023
1 parent 54d2dca commit a0bbd92
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions tests/assets/secondary_task_test/create.yml
Original file line number Diff line number Diff line change
@@ -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']
Expand Down
4 changes: 2 additions & 2 deletions tests/assets/secondary_task_test/delete.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions tests/assets/secondary_task_test/secondary_create.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
3 changes: 2 additions & 1 deletion tests/islandora_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 3 additions & 0 deletions workbench
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit a0bbd92

Please sign in to comment.