Workflow Retry - Workflow should skip Activities which are successful in previous run

Hello Gurus,

I have a situation where in I want to trigger entire workflow at the same time I want it to skip those activities which are successful and run only those activities which are failed and never run.

Please suggest how to achieve

Have you considered not failing workflow at all? Just keep retrying activities until they are fixed.

@maxim - pls pardon me if the questions are dump - I m trying to understand the temporal workflow behavior.

Basically I have retry policy for activities in place. But even after retrials of activity that is failing - fails - obviously we need to let the Workflow fail. That is when I want to retry policy for work flow in place where in I want to specify there to skip the activities which were succeeded in the previous run.

But @maxim can you pls tell me - if this is possible at all.

I guess this is possible only if the workflow and activity are designed to be stateful - meaning holding the state from the previous run.

can I make workflow and activity stateful. is it a good practice in the first place to make it stateful?

The simplest solution is to retry the activity forever as you expected it to be eventually fixed, and the duration of retries in Temporal is not limited. Once fixed the workflow continues without any additional intervention.

If you still want to fail an activity, Temporal allows resetting workflow to some past state, which means that all activities after the reset point will be reexecuted. But it doesn’t support reexecuting some activities and then skipping any that follow them.