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

ENH: cfoods should use self.to_be_updated

parent 8176aeb6
No related branches found
No related tags found
No related merge requests found
...@@ -81,6 +81,7 @@ class AbstractCFood(object): ...@@ -81,6 +81,7 @@ class AbstractCFood(object):
self.crawled_file = crawled_file self.crawled_file = crawled_file
self.crawled_path = crawled_file.path self.crawled_path = crawled_file.path
self.match = type(self).match(crawled_file.path) self.match = type(self).match(crawled_file.path)
self.to_be_updated = db.Container()
@staticmethod @staticmethod
def get_re(): def get_re():
...@@ -113,8 +114,18 @@ class AbstractCFood(object): ...@@ -113,8 +114,18 @@ class AbstractCFood(object):
raise NotImplementedError() raise NotImplementedError()
def update_identifiables(self): def update_identifiables(self):
""" Changes the identifiables as needed and adds changed identifiables
to self.to_be_updated
"""
raise NotImplementedError() raise NotImplementedError()
def push_identifiables_to_CaosDB(self):
""" Updates the self.to_be_updated Container, i.e. pushes the changes
to CaosDB
"""
get_ids_for_entities_with_names(self.to_be_updated)
self.to_be_updated.update()
@staticmethod @staticmethod
# move to api? # move to api?
def set_parents(entity, names): def set_parents(entity, names):
......
...@@ -90,6 +90,7 @@ class Crawler(object): ...@@ -90,6 +90,7 @@ class Crawler(object):
self.cache.insert_list(hashes, identifiables) self.cache.insert_list(hashes, identifiables)
cfood.update_identifiables() cfood.update_identifiables()
cfood.push_identifiables_to_CaosDB()
except Exception as e: except Exception as e:
print(e) print(e)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment