def get_pattern(template_dir):
    pattern_choices = []
    print('')
    print(fill('The following common ' + BOLD() + 'execution patterns' + ENDC() + ' are currently available for your programming language:'))

    pattern_choices.append('basic')
    print(' ' + BOLD() + 'basic' + ENDC())
    print(fill('Your app will run on a single machine from beginning to end.', initial_indent='   ', subsequent_indent='   '))

    if os.path.isdir(os.path.join(template_dir, 'parallelized')):
        pattern_choices.append('parallelized')
        print(' ' + BOLD() + 'parallelized' + ENDC())
        print(fill('Your app will subdivide a large chunk of work into multiple pieces that can be processed in parallel and independently of each other, followed by a final stage that will merge and process the results as necessary.', initial_indent='   ', subsequent_indent='   '))

    if os.path.isdir(os.path.join(template_dir, 'scatter-process-gather')):
        pattern_choices.append('scatter-process-gather')
        print(' ' + BOLD() + 'scatter-process-gather' + ENDC())
        print(fill('Similar to ' + BOLD() + 'parallelized' + ENDC() + ' but with the addition of a "scatter" entry point.  This allows you to break out the execution for splitting up the input, or you can call a separate app/applet to perform the splitting.',
                   initial_indent='   ',
                   subsequent_indent='   '))

    if len(pattern_choices) == 1:
        print('Automatically using the execution pattern "basic"')
        return 'basic'

    use_completer(Completer(pattern_choices))
    pattern = prompt_for_var('Execution pattern', 'basic', choices=pattern_choices)
    use_completer()
    return pattern
dataset/ETHPy150Open dnanexus/dx-toolkit/src/python/dxpy/templating/utils.py/get_pattern/original