@classmethod
    def reorder(cls, *values):
        if len(values) == 0:
            raise ValueError("At least one (priority, value) pair is"
                             " required")
        elif len(values) == 1:
            v1 = values[0]
            # Even though this isn't used, we do the conversion because
            # all the other branches in this function do it so we do it
            # to be consistent (this also will raise on bad values, which
            # we want to do)...
            p1 = cls.convert(v1[0])
            return v1[1]
        else:
            # Order very very much matters in this tuple...
            priority_ordering = (cls.VERY_HIGH, cls.HIGH,
                                 cls.NORMAL, cls.LOW, cls.VERY_LOW)
            if len(values) == 2:
                # It's common to use this in a 2 tuple situation, so
                # make it avoid all the needed complexity that is done
                # for greater than 2 tuples.
                v1 = values[0]
                v2 = values[1]
                p1 = cls.convert(v1[0])
                p2 = cls.convert(v2[0])
                p1_i = priority_ordering.index(p1)
                p2_i = priority_ordering.index(p2)
                if p1_i <= p2_i:
                    return v1[1], v2[1]
                else:
                    return v2[1], v1[1]
            else:
                buckets = collections.defaultdict(list)
                for (p, v) in values:
                    p = cls.convert(p)
                    buckets[p].append(v)
                values = []
                for p in priority_ordering:
                    values.extend(buckets[p])
                return tuple(values)
Mark that task raised an exception
dataset/ETHPy150Open openstack/taskflow/taskflow/jobs/base.py/JobPriority.reorder--crossover with--dataset/ETHPy150Open pandaproject/panda/panda/models/task_status.py/TaskStatus.exception