(
        file_path='', events='', timeline_name='', index_name='',
        file_extension='', sketch_id=None, only_index=False, timeline_id=None)
return chain(index_task)
Build a pipeline for index and analysis.

    Args:
        file_path: The full path to a file to upload, either a file_path or
            or events need to be defined.
        events: String with the event data, either file_path or events
            needs to be defined.
        timeline_name: Name of the timeline to create.
        index_name: Name of the index to index to.
        file_extension: The file extension of the file.
        sketch_id: The ID of the sketch to analyze.
        only_index: If set to true then only indexing tasks are run, not
            analyzers. This is to be used when uploading data in chunks,
            we don't want to run the analyzers until all chunks have been
            uploaded.
        timeline_id: Optional ID of the timeline object this data belongs to.

    Returns:
        Celery chain with indexing task (or single indexing task) and analyzer
        task group.
Build a pipeline for index and analysis.
Build a pipeline for index and analysis .
def build_index_pipeline(
        file_path='', events='', timeline_name='', index_name='',
        file_extension='', sketch_id=None, only_index=False, timeline_id=None):
    """Build a pipeline for index and analysis.

    Args:
        file_path: The full path to a file to upload, either a file_path or
            or events need to be defined.
        events: String with the event data, either file_path or events
            needs to be defined.
        timeline_name: Name of the timeline to create.
        index_name: Name of the index to index to.
        file_extension: The file extension of the file.
        sketch_id: The ID of the sketch to analyze.
        only_index: If set to true then only indexing tasks are run, not
            analyzers. This is to be used when uploading data in chunks,
            we don't want to run the analyzers until all chunks have been
            uploaded.
        timeline_id: Optional ID of the timeline object this data belongs to.

    Returns:
        Celery chain with indexing task (or single indexing task) and analyzer
        task group.
    """
    if not (file_path or events):
        raise RuntimeError(
            'Unable to upload data, missing either a file or events.')
    index_task_class = _get_index_task_class(file_extension)
    sketch_analyzer_chain = None
    searchindex = SearchIndex.query.filter_by(index_name=index_name).first()

    index_task = index_task_class.s(
        file_path, events, timeline_name, index_name, file_extension,
        timeline_id)

    # TODO: Check if a scenario is set or an investigative question
    # is in the sketch, and then enable data finder on the newly
    # indexed data.
    if only_index:
        return index_task

    if sketch_id:
        sketch_analyzer_chain, _ = build_sketch_analysis_pipeline(
            sketch_id, searchindex.id, user_id=None)

    # If there are no analyzers just run the indexer.
    if not sketch_analyzer_chain:
        return index_task

    if sketch_analyzer_chain:
        return chain(
            index_task, run_sketch_init.s(), sketch_analyzer_chain)

    if current_app.config.get('ENABLE_EMAIL_NOTIFICATIONS'):
        return chain(
            index_task,
            run_email_result_task.s()
        )

    return chain(index_task)
def build_index_pipeline ( file_path = '' , events = '' , timeline_name = '' , index_name = '' , file_extension = '' , sketch_id = None , only_index = False , timeline_id = None ) : if not ( file_path or events ) : raise RuntimeError ( 'Unable to upload data, missing either a file or events.' ) index_task_class = _get_index_task_class ( file_extension ) sketch_analyzer_chain = None searchindex = SearchIndex . query . filter_by ( index_name = index_name ) . first ( ) index_task = index_task_class . s ( file_path , events , timeline_name , index_name , file_extension , timeline_id ) # TODO: Check if a scenario is set or an investigative question # is in the sketch, and then enable data finder on the newly # indexed data. if only_index : return index_task if sketch_id : sketch_analyzer_chain , _ = build_sketch_analysis_pipeline ( sketch_id , searchindex . id , user_id = None ) # If there are no analyzers just run the indexer. if not sketch_analyzer_chain : return index_task if sketch_analyzer_chain : return chain ( index_task , run_sketch_init . s ( ) , sketch_analyzer_chain ) if current_app . config . get ( 'ENABLE_EMAIL_NOTIFICATIONS' ) : return chain ( index_task , run_email_result_task . s ( ) ) return chain ( index_task )