def get_output_list_from_task(task, placeholder_dict):
    """
    Purpose: Parse a Task object to extract the files to be staged as the output.

    Details: The extracted data is then converted into the appropriate RP directive depending on whether the data
    is to be copied/downloaded.

    :arguments:
        :task: EnTK Task object
        :placeholder_dict: dictionary holding the values for placeholders

    :return: list of RP directives for the files that need to be staged out

    """

    try:

        if not isinstance(task, Task):
            raise TypeError(expected_type=Task, actual_type=type(task))

        output_data = []

        if task.copy_output_data:

            for path in task.copy_output_data:

                path = resolve_placeholders(path, placeholder_dict)

                if len(path.split('>')) > 1:

                    temp = {
                        'source': path.split('>')[0].strip(),
                        'target': path.split('>')[1].strip(),
                        'action': rp.COPY
                    }
                else:
                    temp = {
                        'source': path.split('>')[0].strip(),
                        'target': os.path.basename(path.split('>')[0].strip()),
                        'action': rp.COPY
                    }
                output_data.append(temp)

        if task.download_output_data:

            for path in task.download_output_data:

                path = resolve_placeholders(path, placeholder_dict)

                if len(path.split('>')) > 1:

                    temp = {
                        'source': path.split('>')[0].strip(),
                        'target': path.split('>')[1].strip()
                    }
                else:
                    temp = {
                        'source': path.split('>')[0].strip(),
                        'target': os.path.basename(path.split('>')[0].strip())
                    }
                output_data.append(temp)

        if task.move_output_data:

            for path in task.move_output_data:

                path = resolve_placeholders(path, placeholder_dict)

                if len(path.split('>')) > 1:

                    temp = {
                        'source': path.split('>')[0].strip(),
                        'target': path.split('>')[1].strip(),
                        'action': rp.MOVE
                    }
                else:
                    temp = {
                        'source': path.split('>')[0].strip(),
                        'target': os.path.basename(path.split('>')[0].strip()),
                        'action': rp.MOVE
                    }

                output_data.append(temp)


        return output_data

    except Exception, ex:
        logger.exception('Failed to get output list of files from task, error: %s' % ex)
        raise
def get_output_list_from_task ( task , placeholder_dict ) : try : if not isinstance ( task , Task ) : raise TypeError ( expected_type = Task , actual_type = type ( task ) ) output_data = [ ] if task . copy_output_data : for path in task . copy_output_data : path = resolve_placeholders ( path , placeholder_dict ) if len ( path . split ( '>' ) ) > 1 : temp = { 'source' : path . split ( '>' ) [ 0 ] . strip ( ) , 'target' : path . split ( '>' ) [ 1 ] . strip ( ) , 'action' : rp . COPY } else : temp = { 'source' : path . split ( '>' ) [ 0 ] . strip ( ) , 'target' : os . path . basename ( path . split ( '>' ) [ 0 ] . strip ( ) ) , 'action' : rp . COPY } output_data . append ( temp ) if task . download_output_data : for path in task . download_output_data : path = resolve_placeholders ( path , placeholder_dict ) if len ( path . split ( '>' ) ) > 1 : temp = { 'source' : path . split ( '>' ) [ 0 ] . strip ( ) , 'target' : path . split ( '>' ) [ 1 ] . strip ( ) } else : temp = { 'source' : path . split ( '>' ) [ 0 ] . strip ( ) , 'target' : os . path . basename ( path . split ( '>' ) [ 0 ] . strip ( ) ) } output_data . append ( temp ) if task . move_output_data : for path in task . move_output_data : path = resolve_placeholders ( path , placeholder_dict ) if len ( path . split ( '>' ) ) > 1 : temp = { 'source' : path . split ( '>' ) [ 0 ] . strip ( ) , 'target' : path . split ( '>' ) [ 1 ] . strip ( ) , 'action' : rp . MOVE } else : temp = { 'source' : path . split ( '>' ) [ 0 ] . strip ( ) , 'target' : os . path . basename ( path . split ( '>' ) [ 0 ] . strip ( ) ) , 'action' : rp . MOVE } output_data . append ( temp ) return output_data except Exception , ex : logger . exception ( 'Failed to get output list of files from task, error: %s' % ex ) raise
Purpose: Parse a Task object to extract the files to be staged as the output.

    Details: The extracted data is then converted into the appropriate RP directive depending on whether the data
    is to be copied/downloaded.

    :arguments:
        :task: EnTK Task object
        :placeholder_dict: dictionary holding the values for placeholders

    :return: list of RP directives for the files that need to be staged out