Skip to content

Commit

Permalink
Added error-handling for panelization & tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
eidens committed Oct 10, 2023
1 parent 1dabd15 commit 65d596b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions sdg/sdneo.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def filter_existing_complete_articles(doi_list: List[str]):
else:
results = self.db.query(SDARTICLE_LOADING_STATUS(params={'doi': doi})) # 'complete' | 'partial' | 'absent'
if results:
if results[0]['status'] == 'partial':
status = results[0]['status']
if status in {'partial', 'error'}:
delete_result = self.db.query(DELETE_TREE(params={'doi': doi}))
logger.info(f"{delete_result[0][0]} trees deleted for {doi}")
filtered_list.append(doi)
Expand All @@ -59,9 +60,13 @@ def filter_existing_complete_articles(doi_list: List[str]):
logger.warning(f"!!!! Article '{a.title}'' has no doi.")
else:
logger.info(f"article {a.doi}")
figure_nodes = self.create_figures(a.children, a.doi)
self.create_relationships(a_node, figure_nodes, 'has_fig')
self.db.query(SET_STATUS(params={'doi': a.doi, 'status': 'complete'}))
try:
figure_nodes = self.create_figures(a.children, a.doi)
self.create_relationships(a_node, figure_nodes, 'has_fig')
self.db.query(SET_STATUS(params={'doi': a.doi, 'status': 'complete'}))
except Exception as e:
logger.error("!!!! Error creating figures for %s", a.doi, exc_info=True)
self.db.query(SET_STATUS(params={'doi': a.doi, 'status': 'error'}))
return article_nodes

def create_figures(self, figure_list, doi):
Expand Down

0 comments on commit 65d596b

Please sign in to comment.