def build_directories(root_dir):
    """Constructs the subdirectories output, stderr, stdout, and jobs in the
    passed root directory. These subdirectories have the following roles:

        jobs             Stores the scripts for each job
        stderr           Stores the stderr output from SGE
        stdout           Stores the stdout output from SGE
        output           Stores output (if the scripts place the output here)

    - root_dir   Path to the top-level directory for creation of subdirectories
    """
    # If the root directory doesn't exist, create it
    if not os.path.exists(root_dir):
        os.mkdir(root_dir)

    # Create subdirectories
    directories = [os.path.join(root_dir, subdir) for subdir in
                   ("output", "stderr", "stdout", "jobs")]
    for dirname in directories:
        os.makedirs(dirname, exist_ok=True)
def build_directories ( root_dir ) : if not os . path . exists ( root_dir ) : os . mkdir ( root_dir ) directories = [ os . path . join ( root_dir , subdir ) for subdir in ( "output" , "stderr" , "stdout" , "jobs" ) ] for dirname in directories : os . makedirs ( dirname , exist_ok = True )
Constructs the subdirectories output, stderr, stdout, and jobs in the
    passed root directory. These subdirectories have the following roles:

        jobs             Stores the scripts for each job
        stderr           Stores the stderr output from SGE
        stdout           Stores the stdout output from SGE
        output           Stores output (if the scripts place the output here)

    - root_dir   Path to the top-level directory for creation of subdirectories