Prepare a cromwell configuration within the current working directory.

def create_cromwell_config(args, work_dir, sample_file):
    """Prepare a cromwell configuration within the current working directory.
    """
    docker_attrs = ["String? docker", "String? docker_user"]
    cwl_attrs = ["Int? cpuMin", "Int? cpuMax", "Int? memoryMin", "Int? memoryMax", "String? outDirMin",
                 "String? outDirMax", "String? tmpDirMin", "String? tmpDirMax"]
    out_file = os.path.join(work_dir, "bcbio-cromwell.conf")
    run_config = _load_custom_config(args.runconfig) if args.runconfig else {}
    # Avoid overscheduling jobs for local runs by limiting concurrent jobs
    # Longer term would like to keep these within defined core window
    joblimit = args.joblimit
    if joblimit == 0 and not args.scheduler:
        joblimit = 1
    file_types = _get_filesystem_types(args, sample_file)
    std_args = {"docker_attrs": "" if args.no_container else "\n        ".join(docker_attrs),
                "submit_docker": 'submit-docker: ""' if args.no_container else "",
                "joblimit": "concurrent-job-limit = %s" % (joblimit) if joblimit > 0 else "",
                "cwl_attrs": "\n        ".join(cwl_attrs),
                "filesystem": _get_filesystem_config(file_types),
                "database": run_config.get("database", DATABASE_CONFIG % {"work_dir": work_dir})}
    cl_args, conf_args, scheduler, cloud_type = _args_to_cromwell(args)
    std_args["engine"] = _get_engine_filesystem_config(file_types, args, conf_args)
    conf_args.update(std_args)
    main_config = {"hpc": (HPC_CONFIGS[scheduler] % conf_args) if scheduler else "",
                   "cloud": (CLOUD_CONFIGS[cloud_type] % conf_args) if cloud_type else "",
                   "work_dir": work_dir}
    main_config.update(std_args)
    # Local run always seems to need docker set because of submit-docker in default configuration
    # Can we unset submit-docker based on configuration so it doesn't inherit?
    # main_config["docker_attrs"] = "\n        ".join(docker_attrs)
    with open(out_file, "w") as out_handle:
        out_handle.write(CROMWELL_CONFIG % main_config)
    return out_file