When is a workout considered a fail?

It is better to pedal until I can pedal no more, stop, rest, and then finish the interval
or
Is it better to lower resistance and finish each interval?