'Execute import tasks which require a custom function,
such as import_role'

def execute_special_task(self, task):

    start = datetime.now()
    s3 = current.response.s3
    if (task[0] == 2):
        fun = task[1]
        filepath = task[2]
        extraArgs = task[3]
        if (filepath is None):
            if (extraArgs is None):
                error = s3[fun]()
            else:
                error = s3[fun](*extraArgs)
        elif (extraArgs is None):
            error = s3[fun](filepath)
        else:
            error = s3[fun](filepath, *extraArgs)
        if error:
            self.errorList.append(error)
        end = datetime.now()
        duration = (end - start)
        try:
            duration = '{:.2f}'.format((duration.total_seconds() / 60))
            msg = ('%s    import    job    completed    in    %s    mins' % (fun, duration))
        except AttributeError:
            msg = ('%s    import    job    completed    in    %s' % (fun, duration))
        self.resultList.append(msg)
        current.log.debug(msg)
