diff --git a/src/caosadvancedtools/cache.py b/src/caosadvancedtools/cache.py index 85e2afffdcf74e87982884a398e9ccd4ecd62bf6..0aef80defaa43ce53328642fe5cfab1f2230c95c 100644 --- a/src/caosadvancedtools/cache.py +++ b/src/caosadvancedtools/cache.py @@ -349,12 +349,12 @@ class UpdateCache(AbstractCache): return old_ones def insert(self, cont, run_id, insert=False): - """Insert a pending, unauthorized inserts + """Insert a pending, unauthorized insert or update Parameters ---------- - cont: Container with the records to be inserted containing the desired + cont: Container with the records to be inserted or updated containing the desired version, i.e. the state after the update. run_id: int diff --git a/src/caosadvancedtools/crawler.py b/src/caosadvancedtools/crawler.py index 6a0cdb58f50b718cff3850586720b8e5031e64ea..2fac6243ef35dfc56b208ecbc91902e77569e622 100644 --- a/src/caosadvancedtools/crawler.py +++ b/src/caosadvancedtools/crawler.py @@ -210,11 +210,14 @@ class Crawler(object): """ cache = UpdateCache() inserts = cache.get_inserts(run_id) + all_inserts = 0 + all_updates = 0 for _, _, _, new, _ in inserts: new_cont = db.Container() new_cont = new_cont.from_xml(new) new_cont.insert(unique=False) logger.info("Successfully inserted {} records!".format(len(new_cont))) + all_inserts += len(new_cont) logger.info("Finished with authorized updates.") changes = cache.get_updates(run_id) @@ -238,7 +241,9 @@ class Crawler(object): new_cont.update(unique=False) logger.info("Successfully updated {} records!".format( len(new_cont))) + all_updates += len(new_cont) logger.info("Finished with authorized updates.") + return all_inserts, all_updates def collect_cfoods(self): """