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

trial

parent bfa5a598
No related branches found
No related tags found
1 merge request!7Treat dependencies among identifiables
Pipeline #9683 failed
...@@ -587,33 +587,31 @@ carefully and if the changes are ok, click on the following link: ...@@ -587,33 +587,31 @@ carefully and if the changes are ok, click on the following link:
else: else:
logger.debug("Id is known of: {}".format(ent)) logger.debug("Id is known of: {}".format(ent))
# insert missing, i.e. those which are not valid # insert missing, i.e. those which are not valid
missing_identifiables = db.Container() if ent.id is None or ent.id < 0:
missing_identifiables.extend([ent for ent in identifiables missing = ent
if ent.id is None or ent.id < 0]) ent.id = None
# TODO the following should not be necessary. Fix it else:
missing = None
for ent in missing_identifiables:
ent.id = None
if len(missing_identifiables) > 0: if missing:
info = "Going to insert the following entities:\n" #info = "Going to insert the following entities:\n"
for ent in missing_identifiables: # for ent in missing_identifiables:
info += str(ent)+"\n" # info += str(ent)+"\n"
logger.debug(info) # logger.debug(info)
if len(missing_identifiables) == 0: # if len(missing_identifiables) == 0:
logger.debug("No new entities to be inserted.") # logger.debug("No new entities to be inserted.")
else: # else:
try: # logger.info(
logger.info( # "Inserting {} Records...".format(
"Inserting {} Records...".format( # len(missing_identifiables)))
len(missing_identifiables))) try:
guard.safe_insert(missing_identifiables, unique=False, guard.safe_insert([missing], unique=False,
flags={"force-missing-obligatory": "ignore"}) flags={"force-missing-obligatory": "ignore"})
except Exception as e: except Exception as e:
DataModelProblems.evaluate_exception(e) DataModelProblems.evaluate_exception(e)
logger.debug("Retrieving entities from CaosDB...") logger.debug("Retrieving entities from CaosDB...")
identifiables.retrieve(unique=True, raise_exception_on_error=False) identifiables.retrieve(unique=True, raise_exception_on_error=False)
......
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