Skip to content
Snippets Groups Projects
Commit 1590919f authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

FIX: move logging of inserts and updates after the execution

parent c16a32d3
No related branches found
No related tags found
2 merge requests!105REL: v0.4.0,!102MAINT: add logging on inserts and updates
Pipeline #33846 passed
......@@ -49,6 +49,7 @@ from typing import Any, Optional, Type, Union
import caosdb as db
from caosadvancedtools.utils import create_entity_link
from caosadvancedtools.cache import UpdateCache, Cache
from caosadvancedtools.crawler import Crawler as OldCrawler
from caosdb.apiutils import (compare_entities, EntityMergeConflictError,
......@@ -1022,20 +1023,20 @@ class Crawler(object):
# to the existing ones
to_be_updated = self.remove_unnecessary_updates(to_be_updated, identified_records)
logger.info(f"Going to insert {len(to_be_inserted)} Entities:\n"
+ self.create_entity_summary(to_be_inserted))
logger.info(f"Going to update {len(to_be_inserted)} Entities:\n"
+ self.create_entity_summary(to_be_updated))
logger.info(f"Going to insert {len(to_be_inserted)} Entities and update "
f"{len(to_be_inserted)} Entities.")
if commit_changes:
self.execute_parent_updates_in_list(to_be_updated, securityMode=self.securityMode,
run_id=self.run_id, unique_names=unique_names)
logger.info(f"Added parent RecordTypes where necessary.")
self.execute_inserts_in_list(
to_be_inserted, self.securityMode, self.run_id, unique_names=unique_names)
logger.info(f"Executed inserts.")
logger.info(f"Executed inserts:\n"
+ self.create_entity_summary(to_be_inserted))
self.execute_updates_in_list(
to_be_updated, self.securityMode, self.run_id, unique_names=unique_names)
logger.info(f"Executed updates.")
logger.info(f"Executed updates:\n"
+ self.create_entity_summary(to_be_updated))
update_cache = UpdateCache()
pending_inserts = update_cache.get_inserts(self.run_id)
......@@ -1059,7 +1060,7 @@ class Crawler(object):
if pp.name not in parents:
parents[pp.name] = []
else:
parents[pp.name].append(el.id)
parents[pp.name].append(el)
output = ""
for key, value in parents.items():
output += f"{key}:\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment