(self)
return status, progress
Returns the child-aware status and progress of this task.
        :return (str,str): status, progress_percent
Returns the child-aware status and progress of this task.
        :return (str,str): status, progress_percent
Returns the child - aware status and progress of this task . : return ( str str ) : status progress_percent
def status(self):
        """Returns the child-aware status and progress of this task.
        :return (str,str): status, progress_percent
        """

        # Try to access the task object associated with this item.
        try:
            self.task
        except TaskMeta.DoesNotExist:
            return 'FAILURE', ''

        status = self.task.status

        result = self.task.result
        if issubclass(type(result), dict):
            try:
                total_progress = int(result.get('progress', 0))
            except ValueError:
                total_progress = 0
        else:
            total_progress = 0

        if status == 'SUCCESS':
            total_progress = 100

        has_finished_child = False
        has_started_child = False
        total_weight = 1
        for child in self.children.all():
            total_weight += child.weight
            try:
                if child.task.status == 'SUCCESS':
                    total_progress += 100*child.weight
                    has_finished_child = True
                elif child.task.status != 'PENDING':
                    has_started_child = True
                    if issubclass(type(child.task.result), dict):
                        try:
                            total_progress += int(child.task.result.get('progress', 0))*child.weight
                        except ValueError:
                            # Don't add this child's progress on error
                            pass
            except TaskMeta.DoesNotExist:
                pass

        progress = '{:2.0f}%'.format(total_progress/total_weight)
        if status == 'PENDING':
            if has_finished_child:
                status = 'WORKING'
            elif has_started_child:
                status = 'STARTED'

        return status, progress
def status ( self ) : # Try to access the task object associated with this item. try : self . task except TaskMeta . DoesNotExist : return 'FAILURE' , '' status = self . task . status result = self . task . result if issubclass ( type ( result ) , dict ) : try : total_progress = int ( result . get ( 'progress' , 0 ) ) except ValueError : total_progress = 0 else : total_progress = 0 if status == 'SUCCESS' : total_progress = 100 has_finished_child = False has_started_child = False total_weight = 1 for child in self . children . all ( ) : total_weight += child . weight try : if child . task . status == 'SUCCESS' : total_progress += 100 * child . weight has_finished_child = True elif child . task . status != 'PENDING' : has_started_child = True if issubclass ( type ( child . task . result ) , dict ) : try : total_progress += int ( child . task . result . get ( 'progress' , 0 ) ) * child . weight except ValueError : # Don't add this child's progress on error pass except TaskMeta . DoesNotExist : pass progress = '{:2.0f}%' . format ( total_progress / total_weight ) if status == 'PENDING' : if has_finished_child : status = 'WORKING' elif has_started_child : status = 'STARTED' return status , progress