@classmethod
def generate(cls, nprocess, executor, log_dir, mpi_command='mpirun -n'):
    """
        Build a parsl bash app that executes this pipeline stage
        """
    module = cls.get_module()
    module = module.split('.')[0]
    flags = [cls.name]
    for i, inp in enumerate(cls.input_tags()):
        flag = '--{}={{inputs[{}]}}'.format(inp, i)
        flags.append(flag)
    config_index = len(cls.input_tags())
    flags.append(f'--config={{inputs[{config_index}]}}')
    for i, out in enumerate(cls.output_tags()):
        flag = '--{}={{outputs[{}]}}'.format(out, i)
        flags.append(flag)
    flags = '   '.join(flags)
    if nprocess > 1:
        launcher = f'{mpi_command} {nprocess}'
        mpi_flag = '--mpi'
    else:
        launcher = ''
        mpi_flag = ''
    template = f"""
@parsl.app.app.bash_app(executors=[executor])
def {cls.name}(inputs, outputs, stdout='{log_dir}/{cls.name}.out', stderr='{log_dir}/{cls.name}.err'):
    cmd = '{launcher} python3 -m {module} {flags} {mpi_flag}'.format(inputs=inputs,outputs=outputs)
    print("Compiling command:")
    print(cmd)
    return cmd
"""
    return cls._generate(template, executor)
