Beispiel #1
0
def build_place_file(self, start):
    try:
        pl = ContextClassHarvesters.PlaceHarvester()
        entity_list = pl.build_entity_chunk(start)
        status = pl.build_solr_doc(entity_list, start)
        return status
    except ServerSelectionTimeoutError as ss:
        try:
            raise self.retry()
        except:
            log_failure("Places", start)
            return False
Beispiel #2
0
def build_agent_file(self, start):
    try:
        ag = ContextClassHarvesters.AgentHarvester()
        entity_list = ag.build_entity_chunk(start)
        status = ag.build_solr_doc(entity_list, start)
        return status
    except ServerSelectionTimeoutError as ss:
        try:
            raise self.retry()
        except MaxRetriesExceededError:
            log_failure("Agents", start)
            return False
Beispiel #3
0
def build_org_file(self, start):
    try:
        ol = ContextClassHarvesters.OrganizationHarvester()
        entity_list = ol.build_entity_chunk(start)
        status = ol.build_solr_doc(entity_list, start)
        return status
    except ServerSelectionTimeoutError as ss:
        try:
            raise self.retry()
        except:
            log_failure("Organization", start)
            return False
Beispiel #4
0
def build_timespan_file(self, start):
    try:
        tsh = ContextClassHarvesters.TimespanHarvester()
        entity_list = tsh.build_entity_chunk(start)
        status = tsh.build_solr_doc(entity_list, start)
        return status
    except ServerSelectionTimeoutError as ss:
        try:
            raise self.retry()
        except:
            log_failure("Timespan", start)
            return False
Beispiel #5
0
def build_concept_file(self, start):
    try:
        from entities import ContextClassHarvesters
        concept = ContextClassHarvesters.ConceptHarvester()
        entity_list = concept.build_entity_chunk(start)
        status = concept.build_solr_doc(entity_list, start)
        return status
    except ServerSelectionTimeoutError as ss:
        try:
            raise self.retry()
        except MaxRetriesExceededError:
            log_failure("Concepts", start)
            return False
Beispiel #6
0
def get_place_count(self):
    try:
        ph = ContextClassHarvesters.PlaceHarvester()
        entity_count = ph.get_entity_count()
        return entity_count
    # note that we don't handle all possible exceptions
    # Celery will pass most errors and exceptions onto the logger
    # and set the task status to failure if left unhandled
    # most of the time this is what we want
    except ServerSelectionTimeoutError as ss:
        try:
            raise self.retry()
        except MaxRetriesExceededError:
            log_failure("Places", "Count")
            return False