示例#1
0
文件: worker.py 项目: wayne9qiu/aleph
 def dispatch_task(self, collection, task):
     stage = task.stage
     payload = task.payload
     sync = task.context.get("sync", False)
     if stage.stage == OP_INDEX:
         index_many(stage, collection, sync=sync, **payload)
     if stage.stage == OP_LOAD_MAPPING:
         load_mapping(stage, collection, **payload)
     if stage.stage == OP_FLUSH_MAPPING:
         flush_mapping(stage, collection, sync=sync, **payload)
     if stage.stage == OP_REINGEST:
         reingest_collection(collection, job_id=stage.job.id, **payload)
     if stage.stage == OP_REINDEX:
         reindex_collection(collection, sync=sync, **payload)
     if stage.stage == OP_XREF:
         xref_collection(stage, collection)
     if stage.stage == OP_XREF_ITEM:
         xref_item(stage, collection, **payload)
     log.info("Task [%s]: %s (done)", task.job.dataset, stage.stage)
示例#2
0
 def handle(self, task):
     stage = task.stage
     payload = task.payload
     collection = Collection.by_foreign_id(task.job.dataset.name)
     if collection is None:
         log.error("Collection not found: %s", task.job.dataset)
         return
     sync = task.context.get('sync', False)
     if stage.stage == OP_INDEX:
         index_many(stage, collection, sync=sync, **payload)
     if stage.stage == OP_LOAD_MAPPING:
         load_mapping(stage, collection, **payload)
     if stage.stage == OP_FLUSH_MAPPING:
         flush_mapping(stage, collection, sync=sync, **payload)
     if stage.stage == OP_REINGEST:
         reingest_collection(collection, job_id=stage.job.id, **payload)
     if stage.stage == OP_REINDEX:
         reindex_collection(collection, sync=sync, **payload)
     if stage.stage == OP_XREF:
         xref_collection(stage, collection)
     if stage.stage == OP_XREF_ITEM:
         xref_item(stage, collection, **payload)
     log.info("Task [%s]: %s (done)", task.job.dataset, stage.stage)
示例#3
0
文件: manage.py 项目: djoffrey/aleph
def reingest_casefiles(index=False):
    """Re-ingest all the casefile collections."""
    for collection in Collection.all_casefiles():
        log.info("[%s] Starting to re-ingest", collection)
        reingest_collection(collection, index=index)
示例#4
0
文件: manage.py 项目: djoffrey/aleph
def reingest(foreign_id, index=False):
    """Process documents and database entities and index them."""
    collection = get_collection(foreign_id)
    reingest_collection(collection, index=index)
示例#5
0
def op_reingest_handler(collection, task):
    reingest_collection(collection, job_id=task.stage.job.id, **task.payload)