def run_process_with_distribution(study_config, process, use_soma_workflow=
    False, resource_id=None, password=None, config=None, rsa_key_pass=None,
    queue=None, input_file_processing=None, output_file_processing=None,
    keep_workflow=False, keep_failed_workflow=False):
    """ Run the given process, either sequentially or distributed through
    Soma-Workflow.

    Parameters
    ----------
    study_config: StudyConfig instance
    process: Process instance
        the process to execute (or pipeline, or iteration...)
    use_soma_workflow: bool or None (default=None)
        if False, run sequentially, otherwise use Soma-Workflow. Its
        configuration has to be setup and valid for non-local execution, and
        additional file transfer options may be used.
    resource_id: string (default=None)
        soma-workflow resource ID, defaults to localhost
    password: string
        password to access the remote computing resource. Do not specify it if
        using a ssh key.
    config: dict (optional)
        Soma-Workflow config: Not used for now...
    rsa_key_pass: string
        RSA key password, for ssh key access
    queue: string
        Queue to use on the computing resource. If not specified, use the
        default queue.
    input_file_processing: brainvisa.workflow.ProcessToSomaWorkflow processing code
        Input files processing: local_path (NO_FILE_PROCESSING),
        transfer (FILE_TRANSFER), translate (SHARED_RESOURCE_PATH),
        or translate_shared (BV_DB_SHARED_PATH).
    output_file_processing: same as for input_file_processing
        Output files processing: local_path (NO_FILE_PROCESSING),
        transfer (FILE_TRANSFER), or translate (SHARED_RESOURCE_PATH).
        The default is local_path.
    keep_workflow: bool
        keep the workflow in the computing resource database after execution.
        By default it is removed.
    keep_failed_workflow: bool
        keep the workflow in the computing resource database after execution,
        if it has failed. By default it is removed.
    """
    if use_soma_workflow is not None:
        study_config.use_soma_workflow = use_soma_workflow
    if study_config.use_soma_workflow:
        swm = study_config.modules['SomaWorkflowConfig']
        resource_id = swm.get_resource_id(resource_id, set_it=True)
        if password is not None or rsa_key_pass is not None:
            swm.set_computing_resource_password(resource_id, password,
                rsa_key_pass)
        if queue is not None:
            if not hasattr(study_config.
                somaworkflow_computing_resources_config, resource_id):
                setattr(study_config.
                    somaworkflow_computing_resources_config, resource_id, {})
            getattr(study_config.somaworkflow_computing_resources_config,
                resource_id).queue = queue
    res = study_config.run(process)
    return res
