gbdx_task_template/base.py
def check_and_create_outputs(self):
        """
        Iterate through the task outputs.
        Two scenarios:
            - User is running locally, check that output folders exist.
            - User is running remotely, when docker container runs filesystem, check that output folders exist.
            - Else, do nothing.
        :return: None
        """
        if self.task is None:
            raise TaskTemplateError('A task must be initialized before running a TaskTemplate subclass.')

        for output_port in self.task.output_ports:
            # Make the dir
            if output_port.type == 'directory':
                try:
                    is_file = os.path.isabs(output_port.value) and not os.path.isfile(output_port.value)
                    is_remote = output_port.is_valid_s3_url(output_port.value)
                except LocalPortValidationError:
                    is_file = False
                    is_remote = None
                except RemotePortValidationError:
                    is_remote = False

                self.logit.debug('Create Outputs: %s -> is_filesys %s, is_valid_s3_url %s' %
                                 (output_port.name, is_file, is_remote))

                if is_file and not is_remote:
                    try:
                        os.makedirs(output_port.value)
                    except OSError as e:
                        self.logit.exception(e)
                        if 'File exists' not in e.strerror:
                            raise e
def check_and_create_outputs(self):
        """
        Iterate through the task outputs.
        Two scenarios:
            - User is running locally, check that output folders exist.
            - User is running remotely, when docker container runs filesystem, check that output folders exist.
            - Else, do nothing.
        :return: None
        """
        if self.task is None:
            raise TaskTemplateError('A task must be initialized before running a TaskTemplate subclass.')

        for output_port in self.task.output_ports:
            # Make the dir
            if output_port.type == 'directory':
                try:
                    is_file = os.path.isabs(output_port.value) and not os.path.isfile(output_port.value)
                    is_remote = output_port.is_valid_s3_url(output_port.value)
                except LocalPortValidationError:
                    is_file = False
                    is_remote = None
                except RemotePortValidationError:
                    is_remote = False

                self.logit.debug('Create Outputs: %s -> is_filesys %s, is_valid_s3_url %s' %
                                 (output_port.name, is_file, is_remote))

                if is_file and not is_remote:
                    try:
                        os.makedirs(output_port.value)
                    except OSError as e:
                        self.logit.exception(e)
                        if 'File exists' not in e.strerror:
                            raise e
Iterate through the task outputs.
        Two scenarios:
            - User is running locally, check that output folders exist.
            - User is running remotely, when docker container runs filesystem, check that output folders exist.
            - Else, do nothing.
        :return: None