Skip to content

tree.get always returns raw directory path #12

Description

@kcho

Hi,

In an example file structure that I received from Habib, the data in the source (eg. in dropbox) are arranged under either raw or processed directories.

The lochness.tree.get function returns the path of a directory, where the data should be saved locally. It also creates the folder if the folder does not exist locally.

However, lochness.tree.get function always returns raw_folder variable, which results all files, including the files in the processed folder to be downloaded in the raw directory.

I thought the files which were saved under the processed folder in the source, should return processed_folder variable rather than the raw_folder variable in the tree.get function.

def get(type, base, **kwargs):
'''get phoenix folder for a subject and datatype'''
if type not in Templates:
raise TreeError('no tree templates defined for {0}'.format(type))
raw_folder = None
processed_folder = None
if 'raw' in Templates[type]:
raw_folder = Templates[type]['raw'].substitute(base=base, **kwargs)
if 'processed' in Templates[type]:
processed_folder = Templates[type]['processed'].substitute(base=base, **kwargs)
if kwargs.get('makedirs', True):
if raw_folder and not os.path.exists(raw_folder):
logger.debug('creating raw folder {0}'.format(raw_folder))
os.makedirs(raw_folder)
if processed_folder and not os.path.exists(processed_folder):
logger.debug('creating processed folder {0}'.format(processed_folder))
os.makedirs(processed_folder)
os.chmod(processed_folder, 0o01777)
return raw_folder

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions