Careful, we return very early here if there is not a new instance list
(self)
| 555 | |
| 556 | # Tested |
| 557 | def annotation_update_main(self): |
| 558 | |
| 559 | """ |
| 560 | Careful, we return very early here |
| 561 | if there is not a new instance list |
| 562 | |
| 563 | """ |
| 564 | |
| 565 | if not self.instance_list_new and not self.clean_instances: |
| 566 | return self.return_orginal_file_type() |
| 567 | logger.debug('Bulding existing hash list...') |
| 568 | |
| 569 | self.instance_list_new = self.order_new_instances_by_date() |
| 570 | payload_includes_all_instances = self.__check_all_instances_available_in_new_instance_list() |
| 571 | |
| 572 | if not payload_includes_all_instances: |
| 573 | logger.error(f"Error updating annotation {str(self.log)}") |
| 574 | logger.error(f"Instance list is: {self.instance_list_new}") |
| 575 | return self.return_orginal_file_type() |
| 576 | |
| 577 | self.build_existing_hash_list() |
| 578 | |
| 579 | ### Main work |
| 580 | |
| 581 | self.update_instance_list() |
| 582 | self.add_missing_ids_to_new_relations() |
| 583 | ### |
| 584 | |
| 585 | # Early exit if errors, eg from instance limits |
| 586 | # This may be a little aggressive, eg maybe shuold just "warn" on instances that are invalid. |
| 587 | # Primary concern in current context is that we don't delete left over ones. |
| 588 | if len(self.log["error"].keys()) >= 1: |
| 589 | logger.error(f"Error updating annotation {str(self.log)}") |
| 590 | logger.error(f"Instance list is: {self.instance_list_new}") |
| 591 | return self.return_orginal_file_type() |
| 592 | |
| 593 | self.update_file_hash() |
| 594 | |
| 595 | self.left_over_instance_deletion() |
| 596 | |
| 597 | self.instance_list_cache_update() |
| 598 | |
| 599 | if len(self.log["error"].keys()) == 0: |
| 600 | self.log['success'] = True |
| 601 | # logger.info('Success updating annotation {}'.format(str(self.log))) |
| 602 | if self.task and self.complete_task: |
| 603 | result, new_file = task_complete.task_complete( |
| 604 | session = self.session, |
| 605 | task = self.task, |
| 606 | new_file = self.file, |
| 607 | project = self.project, |
| 608 | member = self.member) |
| 609 | |
| 610 | else: |
| 611 | logger.error(f"Error updating annotation {str(self.log)}") |
| 612 | return self.return_orginal_file_type() |
| 613 | |
| 614 | def main(self): |