Пример #1
0
    def walk_inputs(self, method=0):
        """Walks the inputs of this version

        :param method: The walk method, 0: Depth First, 1: Breadth First
        """
        from stalker.models import walk_hierarchy
        for v in walk_hierarchy(self, 'inputs', method=method):
            yield v
Пример #2
0
    def walk_inputs(self, method=0):
        """Walks the inputs of this version

        :param method: The walk method, 0: Depth First, 1: Breadth First
        """
        from stalker.models import walk_hierarchy
        for v in walk_hierarchy(self, 'inputs', method=method):
            yield v
Пример #3
0
def check_smartass_animator():
    """checks if the smartass animator is trying to create a new version for a
    completed animation scene silently
    """
    from stalker.models import walk_hierarchy
    # check the status of this task
    v = staging.get('version')
    t = v.task

    if t.status.code in ['CMPL']:
        # get the dependent tasks
        dependent_tasks = t.dependent_of

        # generate a white list for the resources
        # so anybody in the white list can publish it
        white_list_resources = []
        dependent_tasks_all_hierarchy = []

        for dt in dependent_tasks:
            for task in walk_hierarchy(dt, 'dependent_of'):
                white_list_resources.extend(task.resources)
                white_list_resources.extend(task.responsible)
                dependent_tasks_all_hierarchy.append(task)

        white_list_resources = list(set(white_list_resources))

        # get the logged in user
        from stalker import LocalSession
        local_session = LocalSession()
        logged_in_user = local_session.logged_in_user

        # if any of the dependent task has been started so the status is not
        # WFD or RTS in any of then
        #
        # also check if the logged in user is one of the resources of the
        # dependent tasks
        if any([t.status.code not in ['WFD', 'RTS']
                for t in dependent_tasks_all_hierarchy]) \
           and logged_in_user not in white_list_resources:
            # so the animator is trying to stab behind us
            # simply f**k him/her
            # by not allowing to publish the file
            raise PublishError(
                "You're not allowed to publish for this task:<br><br>"
                "Please <b>Request a REVISION</b>!!!!<br>")
Пример #4
0
    def finalize_review_set(self):
        """finalizes the current review set Review decisions
        """
        with DBSession.no_autoflush:
            hrev = Status.query.filter_by(code='HREV').first()
            cmpl = Status.query.filter_by(code='CMPL').first()

        # check if all the reviews are finalized
        if self.is_finalized():
            logger.debug('all reviews are finalized')

            # check if there are any RREV reviews
            revise_task = False

            # now we can extend the timing of the task
            total_seconds = self.task.total_logged_seconds
            for review in self.review_set:
                if review.status.code == 'RREV':
                    total_seconds += review.schedule_seconds
                    revise_task = True

            timing, unit = self.least_meaningful_time_unit(total_seconds)
            self.task._review_number += 1
            if revise_task:
                # revise the task timing if the task needs more time
                if total_seconds > self.task.schedule_seconds:
                    logger.debug(
                        'total_seconds including reviews: %s' % total_seconds
                    )

                    self.task.schedule_timing = timing
                    self.task.schedule_unit = unit
                self.task.status = hrev
            else:
                # approve the task
                self.task.status = cmpl

                # also clamp the schedule timing
                self.task.schedule_timing = timing
                self.task.schedule_unit = unit

            # update task parent statuses
            self.task.update_parent_statuses()

            from stalker import TaskDependency
            # update dependent task statuses

            for dep in walk_hierarchy(self.task, 'dependent_of', method=1):
                logger.debug('current TaskDependency object: %s' % dep)
                dep.update_status_with_dependent_statuses()
                if dep.status.code in ['HREV', 'PREV', 'DREV', 'OH', 'STOP']:
                    # for tasks that are still be able to continue to work,
                    # change the dependency_target to "onstart" to allow
                    # the two of the tasks to work together and still let the
                    # TJ to be able to schedule the tasks correctly
                    with DBSession.no_autoflush:
                        tdeps = TaskDependency.query\
                            .filter_by(depends_to=dep).all()
                    for tdep in tdeps:
                        tdep.dependency_target = 'onstart'

                # also update the status of parents of dependencies
                dep.update_parent_statuses()

        else:
            logger.debug('not all reviews are finalized yet!')
Пример #5
0
    def finalize_review_set(self):
        """finalizes the current review set Review decisions
        """
        with DBSession.no_autoflush:
            hrev = Status.query.filter_by(code="HREV").first()
            cmpl = Status.query.filter_by(code="CMPL").first()

        # check if all the reviews are finalized
        if self.is_finalized():
            logger.debug("all reviews are finalized")

            # check if there are any RREV reviews
            revise_task = False

            # now we can extend the timing of the task
            total_seconds = self.task.total_logged_seconds
            for review in self.review_set:
                if review.status.code == "RREV":
                    total_seconds += review.schedule_seconds
                    revise_task = True

            timing, unit = self.least_meaningful_time_unit(total_seconds)
            self.task._review_number += 1
            if revise_task:
                # revise the task timing if the task needs more time
                if total_seconds > self.task.schedule_seconds:
                    logger.debug("total_seconds including reviews: %s" % total_seconds)

                    self.task.schedule_timing = timing
                    self.task.schedule_unit = unit
                self.task.status = hrev
            else:
                # approve the task
                self.task.status = cmpl

                # also clamp the schedule timing
                self.task.schedule_timing = timing
                self.task.schedule_unit = unit

            # update task parent statuses
            self.task.update_parent_statuses()

            from stalker import TaskDependency

            # update dependent task statuses

            for dep in walk_hierarchy(self.task, "dependent_of", method=1):
                logger.debug("current TaskDependency object: %s" % dep)
                dep.update_status_with_dependent_statuses()
                if dep.status.code in ["HREV", "PREV", "DREV", "OH", "STOP"]:
                    # for tasks that are still be able to continue to work,
                    # change the dependency_target to "onstart" to allow
                    # the two of the tasks to work together and still let the
                    # TJ to be able to schedule the tasks correctly
                    tdeps = TaskDependency.query.filter_by(depends_to=dep).all()
                    for tdep in tdeps:
                        tdep.dependency_target = "onstart"

                # also update the status of parents of dependencies
                dep.update_parent_statuses()

        else:
            logger.debug("not all reviews are finalized yet!")