def batch_processing_documents(): _logger.info("start batch processing integration service for indexing and tagging documents...") isError = False error_message = "" results = {'success': True} try: integration.batch_processing_product_issue_attachments() except IntegrationException as integrationErr: isError = True error_message = "Error while indexing documents: " + str(integrationErr) _logger.error("error in integrationService:"+error_message) except Exception as error: isError = True error_message = "Error while indexing documents: " + str(error) _logger.error("error in integrationService:"+error_message) _logger.info("complete indexing documents from remote server:"+remote_solr_server) if not isError: _logger.info("start tagging documents in local server:"+local_solr_server) try: trTagger = IndustryTermRecogniser(local_solr_server) trTagger.terminology_tagging() except Exception as error: isError = True error_message = "Error while tagging documents: " + str(error) _logger.error(error_message) _logger.info("complete tagging documents indexed in local server:"+local_solr_server) if isError: results['success'] = False results['reason'] = error_message resp = Response(json.dumps(results), status=202, mimetype='application/json') else: resp = Response(json.dumps(results), status=200, mimetype='application/json') return resp
def test_request_attachment_url_by_id(): try: attachment_url = Integrator.request_attachment_url_by_id("2") print(attachment_url) except Exception as error: print("Exception: ", error) def test_retrieve_attachment_ids(): integrator = Integrator() integrator.retrieve_attachment_ids() def test_batch_processing_product_issue_attachments(): integrator = Integrator() integrator.batch_processing_product_issue_attachments() if __name__ == '__main__': import logging.config logging.config.fileConfig(os.path.join(os.path.dirname(__file__), '..', 'config', 'logging.conf')) integrator = Integrator() # test_request_attachment_url_by_id(); integrator.batch_processing_product_issue_attachments() trTagger = IndustryTermRecogniser(local_solr_server) trTagger.terminology_tagging()
attachment_url = Integrator.request_attachment_url_by_id("2") print(attachment_url) except Exception as error: print("Exception: ", error) def test_retrieve_attachment_ids(): integrator = Integrator() integrator.retrieve_attachment_ids() def test_batch_processing_product_issue_attachments(): integrator = Integrator() integrator.batch_processing_product_issue_attachments() if __name__ == '__main__': import logging.config logging.config.fileConfig( os.path.join(os.path.dirname(__file__), '..', 'config', 'logging.conf')) integrator = Integrator() # test_request_attachment_url_by_id(); integrator.batch_processing_product_issue_attachments() trTagger = IndustryTermRecogniser(local_solr_server) trTagger.terminology_tagging()