Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use _parent to name scratch subdirectories to match output directory base name #107

Open
rdmorin opened this issue Sep 13, 2020 · 0 comments

Comments

@rdmorin
Copy link
Collaborator

rdmorin commented Sep 13, 2020

Because we are sharing scratch directories within larger projects, it would be convenient if the base directory for those defined by scratch_subdirectories was named the same as _parent. This would allow more than one pipeline running the same tool to avoid trying to write to the same subdirectory (i.e. it could be named uniquely via a distinct _parent in the config). It looks like the implementation would mirror what is currently being done in this if block.

# Configure output directory if not specified and create it
    if mconfig["dirs"].get("_parent") is None:
        root_output_dir = mconfig.get("root_output_dir", "results")
        output_dir = os.path.join(root_output_dir, f"{name}-{version}")
        mconfig["dirs"]["_parent"] = output_dir
    mconfig["dirs"]["_parent"] = mconfig["dirs"]["_parent"].rstrip("/") + "/"
    os.makedirs(mconfig["dirs"]["_parent"], exist_ok=True)

    # Update paths to conda environments to be relative to the module directory
    for env_name, env_val in mconfig["conda_envs"].items():
        if env_val is not None:
            mconfig["conda_envs"][env_name] = os.path.realpath(env_val)

Does anyone know of a reason we would not want to make this change?

Here's the current code that would need to be wrapped in a similar "if" block.

    # Setup output sub-directories
    scratch_subdirs = mconfig.get("scratch_subdirectories", [])
    mconfig = setup_subdirs(mconfig, subdirectories, scratch_subdirs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant